Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Travis CI: don't try to test mysql2 adapter on Rails 3.0

  • Loading branch information...
commit 16636f5a7cb9abb3a4a96fe925a6687c092062c1 1 parent 033f9e7
@mislav mislav authored
View
6 .travis.yml
@@ -1,11 +1,7 @@
+script: spec/ci.rb
rvm:
- 1.8.7
- 1.9.2
gemfile:
- Gemfile
- Gemfile.rails3.0
-env:
- - DB=sqlite3
- - DB=mysql
- - DB=mysql2
- - DB=postgres
View
5 Gemfile.rails3.0
@@ -12,10 +12,7 @@ gem 'mocha', '~> 0.9.8'
gem 'sqlite3', '~> 1.3.3'
-group :mysql do
- gem 'mysql', '~> 2.8.1'
- gem 'mysql2', '>= 0.3.6'
-end
+gem 'mysql', '~> 2.8.1', :group => :mysql
gem 'pg', '~> 0.11', :group => :pg
group :debug do
View
2  Gemfile.rails3.0.lock
@@ -39,7 +39,6 @@ GEM
ruby_core_source (>= 0.1.4)
mocha (0.9.12)
mysql (2.8.1)
- mysql2 (0.3.6)
pg (0.11.0)
rack (1.2.3)
rack-mount (0.6.14)
@@ -83,7 +82,6 @@ DEPENDENCIES
activeresource (~> 3.0.0)
mocha (~> 0.9.8)
mysql (~> 2.8.1)
- mysql2 (>= 0.3.6)
pg (~> 0.11)
rake
rspec (~> 2.6.0)
View
14 Rakefile
@@ -3,7 +3,7 @@ begin
rescue LoadError
# no spec tasks
else
- task :default => [:create_database, :spec]
+ task :default => :spec
desc 'Run ALL OF the specs'
RSpec::Core::RakeTask.new(:spec) do |t|
@@ -19,18 +19,6 @@ 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'
View
29 spec/ci.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+databases = %w[ sqlite3 mysql mysql2 postgres ]
+databases.delete 'mysql2' if ENV['BUNDLE_GEMFILE'].to_s.include? 'rails3.0'
+
+def announce(name, msg)
+ puts "\n\e[1;33m[#{name}] #{msg}\e[m\n"
+end
+
+def system(*args)
+ puts "$ #{args.join(' ')}"
+ super
+end
+
+if ENV['TRAVIS']
+ system "mysql -e 'create database will_paginate;' >/dev/null"
+ abort "failed to create mysql database" unless $?.success?
+ system "psql -c 'create database will_paginate;' -U postgres >/dev/null"
+ abort "failed to create postgres database" unless $?.success?
+end
+
+failed = false
+
+for db in databases
+ announce "DB", db
+ ENV['DB'] = db
+ failed = true unless system %(rake)
+end
+
+exit 1 if failed
Please sign in to comment.
Something went wrong with that request. Please try again.