Jan 302014
 

travisci-300x225By now we know that testing is important or more than that, vital!! so our apps will always have tests. If you have your code on Github the there is the possibility of using  Travis CI as a Continuous Integration Service that is free for Open Source projects. So every time you do a commit, your tests will be run by Travis and you’ll be notified by mail if they pass or not.

Travis CI documentation is great, everything explained but sometimes when you have a simple project, you just don’t want to go through all the documentation, figure out how it all works, etc you expect to be able to copy&paste a simple configuration file and done.

So, I’ll share the files for a simple case like the webcalendar. Where for testing I’m using rspec, the test DB is sqlite and since the app is deployed in heroku my production DB is postgresql. The configuration files needed are config/database.yml and .travis.yml

The database.yml file looks like

sqlite: &sqlite
adapter: sqlite3
database: db/<%= Rails.env %>.sqlite3

postgresql: &postgresql
adapter: postgresql
username: postgres
password:
database: webcalendar_<%= Rails.env %>
min_messages: ERROR

defaults: &defaults
pool: 16
timeout: 5000
host: localhost
<<: *<%= p ENV[‘DB’] || “sqlite” %>

development:
<<: *defaults

test:
<<: *defaults

production:
<<: *defaults

Don’t worry about seeing here the user and password of the postgreql DB, they work on Travis but are not the ones used in Heroku 😛 …

The .travis.yml file on your root directory that looks like

rvm:
1.9.3

env:
– DB=sqlite
– DB=postgresql

before_script:
– psql -c ‘create database webcalendar_test;’ -U postgres

script:
– RAILS_ENV=test bundle exec rake –trace db:migrate spec

Using this configuration files is working for me, so I help is of some help to some else and does not have to spend a couple of hours trying to figure out how to make travis-ci work on your github account 🙂

 

 

 Posted by at 12:45 pm
Jan 142014
 

Over Christmas I wanted to do many things, that could be summarized in learning everything about Ruby&Rails, Javascript, JQuery, CSS3, HTML5. But of course, you go back home and find out that is much better to just meet with friends, talk about life, spend time “doing nothing”. So I didn’t learn everything about everything but I did learn a lot about HTML5, and not only learn but actually implemented it in the webcalendar app that I’m developing, I would say even more, really loving the idea of how HTML5 brings more semantics to the web.

Guide to HTML5Several months ago (many) a friend recommended me a guide, which I started looking but did not manage to find the time to actually read it carefully ,the guide is “Dive into HTML5“, and I must say that is one of the best guides I ever read. Normally I get bored with guides and begin skipping things or jumping from one place to the other, but this time I really enjoyed reading it carefully, page by page.

It gives a really good overview, deep enough to understand and implement things, and lightly written to actually catch your attention, so I highly recommend reading it.

Of course, procrastination is part of the reading, so in the way I found other resources that had to do with HTML5 that I find interesting.

The HTML5 reset style sheet, the HTML5 outliner which helps you to see the structure of your HMTL5 document. Mozilla Foundation has a good documentation site for developers.

If you are semantic fan, as I am, making the UI semantic is really interesting, and there is this semantic UI , which helps to give semantics to the front-end, and of course there is a gem to use semantic UI in rails, the semantic-ui-sass gem. Also you can find a podcast in The changelog about Semantic UI with Jack Lukic.

Another of the amazing things, refered to semantics is that HTML5 gives you the possibility of extending semantics through microdata, and there is already a microdata vocabulary initiative for defining the most common things, data-vocabulary.org, and you can follow schema.org blog for the latests news.

So if you feel that you want to play with HTML5 you can use Initializr which is a templates generator to help you getting started with a new project based on HTML5.

Sep 252013
 

I don’t like to hawoman indicating ssh ve several of anything, because at the end I always get mixed up (yes, everyday I mixed all my different passwords, I never remember which one I have to use).
So having several ssh keys was not something that I wanted to have, but for X reason it just happened and I have to handle with it.

So thanks to Christophe, he told be how to configure my ssh file so that I could have manage several keys without pain 🙂

The thing is create on you home directory, under .ssh folder a config file

➜  ~  touch .ssh/config

Then you can edit the file and insert the following lines

 

Host heroku.com
IdentityFile ~/.ssh/my_public_key
IdentityFile ~/.ssh/my_second_public_key
IdentitiesOnly yes

Host github.com
IdentityFile ~/.ssh/my_public_key
IdentitiesOnly yes

As you can see, you need to specify for each server which key or keys you are using, so that when it tries to connect the server will just find out which one is the valid one 🙂

 Posted by at 1:38 am
Sep 202013
 

oh-my-zsh-logo I was quite fond of bash shell, or maybe I’m not the kind of person that if something works need to change it for something new, but lately I was finding really annoying the fact of not being able to access to the whole history of the command line, just because bash does not handle the history when having several tabs, it just “remembers” the last tab history when you close the terminal.
I was couping with this fact, not very happy, but as I said, I have too many things normally in mind to really spend time in searching about this, but sometimes happens, that you ask, and someone gives you a nice answer 🙂

This happened yesterday, when they recommended me zsh shell, now I’ve installed it, it looks and feels really good, it is also optimized to use ruby, rails, git, bundler ,  so I’m going to give it a try 🙂

you can download zsh from
https://github.com/robbyrussell/oh-my-zsh

 Posted by at 5:16 am
Sep 202013
 

cup - hacker inside Sometimes, one thinks that is going to do one thing and ends up doing something else. So yesterday, since what the to-do task got complicated and I had the opportunity of being with a nice sysadmin, that wants to shared good practices, we ended up improving the performance of the laptop, but removing from background processes that run on the starting up.
Since I have a really bad memory, I preferred to post it for my own sake and also to share it.

I had always running redis-server, mysql, postgres, apache, things that actually I don’t need by default, and when I need them I can just start them 🙂

So, to remove a process in init.d from the start up, it had to be done the following

lala@lala:~$ sudo update-rc.d -f redis-server remove
lala@lala:~$ sudo update-rc.d -f postgresql remove
lala@lala:~$ sudo update-rc.d -f apache2 remove

If I need them, I just need to

lala@lala:~$ sudo service redis-server start
lala@lala:~$ sudo service postgres start

Also I discovered that initial processes are not only on /etc/init.d but also on /etc/init

But the way to remove them from the start up, is a bit different, you need to create a .override file

For example I wanted to deactivate MySQL, so I’ve done

sonduk@sonduk:~$ echo ‘manual’ | sudo tee /etc/init/mysql.override

now I have a new file called mysqld.override and inside just one word “manual” 🙂

 Posted by at 4:53 am