You will need the following packages to get travis-api to work:
- PostgreSQL 9.3 or higher
- Bundler
- Redis
- Optional: RabbitMQ Server
- Optional: Nginx - If working in Ubuntu please install nginx manually from source: Download and extract latest nginx version, open a terminal in extracted folder and then run the following:
$ sudo apt-get install libpcre3 libpcre3-dev
$ auto/configure --user=$USER
$ make
$ sudo make install
$ sudo ln -s /usr/local/nginx/sbin/nginx /bin/nginx
$ bundle install
You might need to create a role first. For this you should run the following:
$ sudo -u postgres psql -c "CREATE USER yourusername WITH SUPERUSER PASSWORD 'yourpassword'"
Databases are set up with a Rake task that uses the database schemas (structure.sql
) in travis-migrations
which is loaded as a Gem. Details can be found in the Rakefile
.
If there have been new migrations added to travis-migrations
since you bundle installed, you will need to update travis-migrations
to ensure you have the latest version with the new migrations.
bundle update travis-migrations
To create and migrate the Databases:
$ RAILS_ENV=development bundle exec rake db:create
$ RAILS_ENV=test bundle exec rake db:create
Please Note: The database names are configured using the environment variable RAILS_ENV. If you are using a different configuration you will have to make your own adjustments.
$ bundle exec rake
ENV=development bundle exec ruby -Ilib -S rackup
$ bundle exec script/server
If you have problems with Nginx because the websocket is already in use, try restarting your computer.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
v3 documentation can be found at https://developer.travis-ci.org which is a repository that can be found at https://github.com/travis-pro/developer
Start with the find/get spec (for example: spec/v3/services/caches/find_spec.rb) for your new endpoint. If you don't have a find route start with whatever route you want to add first. Run the test and add the files you need to clear the errors. They should be:
- A service (lib/travis/api/v3/services/caches/find.rb)
- A query (lib/travis/api/v3/queries/caches.rb)
- Register the service in v3/services.rb (alphabetical order please)
- Add a route (v3/routes.rb) Re-run the test at this point. Depending on what objects you are returning you may also need to add:
- Add a model (either pulls from the DB or a wrapper for the class of the objects returned from another source (s3 for example), or that structures the result you will be passing back to the client)
- Add a renderer (if needed to display your new model/object/collection)