runspecs in schema_validations-0.2.0 vs runspecs in schema_validations-0.2.1
- old
+ new
@@ -1,9 +1,10 @@
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
+require 'shellwords'
require 'tempfile'
RUBY_VERSIONS = %W[1.8.7 1.9.2 1.9.3]
RAILS_VERSIONS = %W[2.3 3.0 3.1 3.2]
@@ -37,10 +38,14 @@
opts.on("--quick", "quick run ruby #{RUBY_VERSIONS.last} and rails #{RAILS_VERSIONS.last}") do
o.ruby_versions = [RUBY_VERSIONS.last]
o.rails_versions = [RAILS_VERSIONS.last]
end
+ opts.on("--rspec", "run rspec rather than rake") do |v|
+ o.rspec = v
+ end
+
end.parse!
Combo = Struct.new(:ruby, :rails)
@@ -51,26 +56,27 @@
end
}
GEMFILES_DIR = File.expand_path('../gemfiles', __FILE__)
-total = o.ruby_versions.size * o.rails_versions.size
errs = []
combos.each_with_index do |combo, n|
ruby = combo.ruby
rails = combo.rails
cmd = case
when o.update
"bundle update"
when o.install
"bundle install"
+ when o.rspec
+ "bundle exec rspec"
else
"bundle exec rake spec"
end
- command = %Q{BUNDLE_GEMFILE="#{File.join(GEMFILES_DIR, "Gemfile.rails-#{rails}")}" rvm #{ruby} do #{cmd}}
+ command = %Q{BUNDLE_GEMFILE="#{File.join(GEMFILES_DIR, "Gemfile.rails-#{rails}")}" rvm #{ruby} do #{cmd} #{Shellwords.join(ARGV)}}
puts "\n\n*** ruby version #{ruby} - rails version #{rails} [#{n+1} of #{combos.size}]\n\n#{command}"
next if o.dry_run
@@ -79,5 +85,6 @@
file.rewind
errs << "ruby #{ruby}, rails #{rails}" if file.readlines.grep(/^Failed examples/).any?
end
end
puts errs.any? ? "\n*** #{errs.size} failures:\n\t#{errs.join("\n\t")}" : "\n*** #{combos.size > 1 ? 'all versions' : 'spec'} succeeded ***" unless o.dry_run
+exit !errs.any?