Skip to content

Instantly share code, notes, and snippets.

@danielmsong
Last active December 19, 2015 09:49
Show Gist options
  • Save danielmsong/5936101 to your computer and use it in GitHub Desktop.
Save danielmsong/5936101 to your computer and use it in GitHub Desktop.

Revisions

  1. danielmsong revised this gist Jul 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion travis_setup.md
    Original file line number Diff line number Diff line change
    @@ -54,6 +54,6 @@
    host:localhost


    If you have a production environment, make sure to add a default to that environment as well


    7.Commit and push to a branch in git. If you go to your travis home page, you will see that travis runs test on the commit you just made to ensure that your specs all pass.
  2. danielmsong revised this gist Jul 5, 2013. 1 changed file with 16 additions and 16 deletions.
    32 changes: 16 additions & 16 deletions travis_setup.md
    Original file line number Diff line number Diff line change
    @@ -36,22 +36,22 @@
    <<: *<%= "postgresql" %>

    development:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_development
    host:localhost

    staging:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_staging
    host:localhost

    test:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_test
    host:localhost
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_development
    host:localhost

    staging:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_staging
    host:localhost

    test:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_test
    host:localhost


    If you have a production environment, make sure to add a default to that environment as well
  3. danielmsong revised this gist Jul 5, 2013. 1 changed file with 16 additions and 6 deletions.
    22 changes: 16 additions & 6 deletions travis_setup.md
    Original file line number Diff line number Diff line change
    @@ -36,13 +36,23 @@
    <<: *<%= "postgresql" %>

    development:
    <<: *defaults
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_development
    host:localhost

    staging:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_staging
    host:localhost

    test:
    adapter: postgresql
    encoding: utf-8
    database: ops_hospital_mapper_test
    host:localhost

    staging:
    <<: *defaults

    test:
    <<: *defaults

    If you have a production environment, make sure to add a default to that environment as well

  4. danielmsong created this gist Jul 5, 2013.
    49 changes: 49 additions & 0 deletions travis_setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    <h2>Setting up travis is a pain in the ass. never liked that name.</h2>
    <br />
    <p>
    <b>Anyway, here are the steps I took to make it work for our app:</b></p>

    1. go <a href=https://travis-ci.org/>here</a> and have the repo owner log into travis using github oAuth
    2. once you're logged into travis, you'll notice that your repo list is empty. go to the top right of the nav, drag down and click 'Accounts'. Turn the switch to 'on' for which repo you want travis to run on
    3. visit the github service hooks page (located under repo -> settings) and you should see that the travis hook has been activated with your github username and travis token. if not, fill those in
    4. add a '.travis.yml' file to your repository (where Rakefile and Gemfile are- not in a folder
    Here's what mine looked like:

    language: ruby
    rvm:
    - 1.9.3
    env:
    - DB=postgresql
    script:
    - RAILS_ENV=test bundle exec rake --trace db:migrate #test
    before_script:
    - psql -c 'create database ops_hospital_mapper_test' -U postgres

    5. After you write your .travis.yml file, go to <a href=http://lint.travis-ci.org/>this page</a>, copy and paste your file and make sure that you're green
    6. go to your config/database.yml file and write something like this:

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

    defaults: &defaults
    pool: 5
    timeout: 5000
    host: localhost
    <<: *<%= "postgresql" %>

    development:
    <<: *defaults

    staging:
    <<: *defaults

    test:
    <<: *defaults

    If you have a production environment, make sure to add a default to that environment as well

    7.Commit and push to a branch in git. If you go to your travis home page, you will see that travis runs test on the commit you just made to ensure that your specs all pass.