Skip to content
Browse files

try to fix travis build

  • Loading branch information...
1 parent e434738 commit db32fcf2020db3bb894d472cf620ed6a8e4c18ab @mislav committed Jul 28, 2011
Showing with 13 additions and 4 deletions.
  1. +0 −3 .travis.yml
  2. +13 −1 Rakefile
View
3 .travis.yml
@@ -4,9 +4,6 @@ rvm:
gemfile:
- Gemfile
- Gemfile.rails3.0
-before_script:
- - "mysql -e 'create database will_paginate;'"
- - "psql -c 'create database will_paginate;' -U postgres"
env:
- DB=sqlite3
- DB=mysql
View
14 Rakefile
@@ -3,7 +3,7 @@ begin
rescue LoadError
# no spec tasks
else
- task :default => :spec
+ task :default => [:create_database, :spec]
desc 'Run ALL OF the specs'
RSpec::Core::RakeTask.new(:spec) do |t|
@@ -19,6 +19,18 @@ else
end
end
+desc 'Create necessary databases'
+task :create_database do |variable|
+ case ENV['DB']
+ when 'mysql', 'mysql2'
+ `mysql -e 'create database will_paginate;'`
+ abort "failed to create mysql database" unless $?.success?
+ when 'postgres'
+ `psql -c 'create database will_paginate;' -U postgres`
+ abort "failed to create postgres database" unless $?.success?
+ end
+end
+
desc 'Run specs against both Rails 3.1 and Rails 3.0'
task :rails3 do |variable|
system 'bundle exec rake spec && BUNDLE_GEMFILE=Gemfile.rails3.0 bundle exec rake spec:rails'

0 comments on commit db32fcf

Please sign in to comment.
Something went wrong with that request. Please try again.