From d6f567e765390cf5d78ae24959b45ba7f2d45021 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sat, 12 Apr 2014 14:02:12 -0700 Subject: [PATCH] try to get travis build working --- .travis.yml | 4 ++++ config.yml.travis | 7 +++++++ environment.rb | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 config.yml.travis diff --git a/.travis.yml b/.travis.yml index ddf7e4af..0e6e8755 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ language: ruby rvm: - "2.1.0" +addons: + postgresql: "9.3" +before_script: + - psql -c 'create database travis_ci_test;' -U postgres diff --git a/config.yml.travis b/config.yml.travis new file mode 100644 index 00000000..6870b205 --- /dev/null +++ b/config.yml.travis @@ -0,0 +1,7 @@ +database: 'postgres://postgres@localhost/travis_ci_test' +database_pool: 1 +session_secret: 's3cr3t' +recaptcha_public_key: '1234' +recaptcha_private_key: '5678' +phantomjs_url: + - http://localhost:8910 \ No newline at end of file diff --git a/environment.rb b/environment.rb index 04504503..a4bcefe9 100644 --- a/environment.rb +++ b/environment.rb @@ -12,7 +12,16 @@ require 'zip' Bundler.require Bundler.require :development if ENV['RACK_ENV'] == 'development' -$config = YAML.load_file(File.join(DIR_ROOT, 'config.yml'))[ENV['RACK_ENV']] +if ENV['TRAVIS'] + $config = YAML.load_file File.join(DIR_ROOT, 'config.yml.travis') +else + begin + $config = YAML.load_file(File.join(DIR_ROOT, 'config.yml'))[ENV['RACK_ENV']] + rescue Errno::ENOENT + puts "ERROR: Please provide a config.yml file." + exit + end +end DB = Sequel.connect $config['database'], sslmode: 'disable', max_connections: $config['database_pool'] DB.extension :pagination