
There is a tendency that
every Ruby project joins
Travis . Travis is a very simple, open-source
integration system. We are usually too lazy to connect all our projects to automatic testing of builds. Travis allows you to do this in minutes.
This is a step-by-step instruction on how to add your project to Travis
and make a delicious Martini cocktail in about 15 minutes. It should be noted that the preparation of Martini will take about five minutes, so the part about Travis will take 10 minutes of your life.
')
Make sure our project has everything you need (2 minutes)
To join Travis, the project requires three prerequisites:
- This is a ruby project on github.
- He uses a Bundler to control gems. (In fact, this is not a limitation, but it greatly simplifies the setup for Travis.)
- Tests for the project can be run with a simple command. This is usually the rake command, but the other commands (say, bundle exec rspec spec ) are also great.
It is necessary that your project can be tested on a new machine by simply running
bundle install before the testing team. If the configuration is more complicated, you will have to add additional configs for Travis. In any case, simplifying the installation of your project is a good idea, regardless of whether you use Travis or not.
I assume that your project meets all three prerequisites, and that tests can be run using the
bundle exec rake test .
Create a Travis configuration file (3 minutes)
Create a
.travis.yml file in the project root. This is what mine looks like:
rvm: # Ruby, - 1.9.3 - jruby - rbx script: "bundle exec rake test" #
All settings have rational default values, so your configuration can be even easier. For example, if you omit the
script property, Travis will use
bundle exec rake , or simply
rake , if not using the Bundler. See the
Travis documentation for more details.
Activate the project on Travis (2 minutes)
Go to
travis-ci.org and log in using your GitHub account. We provide Travis read / write access to your GitHub. Your own Travis token is on
your profile page .

In fact, don't bother about the token yet - but since you're on the profile page, click on the project switch that will be tested on Travis.
Run the first build (3 minutes)
Send changes to your git repository (make sure to commit the .travis.yml file), then go to
Travis home , sit back and watch Travis add your project to the build queue, install the bundle and run the tests. When the build is completed, check the mail, there you will see a love message from Travis - and congratulations that everything is green (or red)!
If interesting...
Why does Travis need read access to your GitHub account? Because Travis automatically configures GitHub to notify him that you are pushing into a project. If you want to - check: on the project administration page in GitHub -
Service Hooks - click on the
Travis hook. The configuration will look like this:

If you click
Test Hook , Travis will schedule the build right now.
Cooking Martini (5 minutes)

Fill the frozen cocktail glass with cold gin, add a little vermouth and mix. Decorate with olive.
(If you are in a hurry, you can combine this step with the previous one, which will save you three minutes while Travis is busy building your project)
Drink Martini (extra time)
I don't think my help is needed here. Find a good company and have fun. But do not drink much!