Rakefile in rspec_candy-0.3.1 vs Rakefile in rspec_candy-0.4.0
- old
+ new
@@ -1,48 +1,41 @@
require 'rake'
+require 'bundler/gem_tasks'
-require "bundler/gem_tasks"
-
desc 'Default: Run all specs.'
task :default => 'all:spec'
-namespace :travis_ci do
-
- desc 'Things to do before Travis CI begins'
- task :prepare => :slimgems
-
- desc 'Install slimgems'
- task :slimgems do
- system('gem install slimgems')
- end
-
+task :spec do
+ rspec_binary = ENV['BUNDLE_GEMFILE'].include?('rspec1') ? 'spec' : 'rspec'
+ examples = ENV['SPEC'] || 'spec'
+ success &= system("bundle exec #{rspec_binary} #{examples}")
end
namespace :all do
- desc "Run specs on all spec apps"
+ desc "Run specs on all versions"
task :spec do
success = true
- for_each_directory_of('spec/**/Rakefile') do |directory|
- env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
- success &= system("cd #{directory} && #{env} bundle exec rake spec")
+ for_each_gemfile do
+ Rake::Task['spec'].execute
end
fail "Tests failed" unless success
end
- desc "Bundle all spec apps"
+ desc "Bundle all versions"
task :bundle do
- for_each_directory_of('spec/**/Gemfile') do |directory|
- system("cd #{directory} && rm -f Gemfile.lock && bundle install")
+ for_each_gemfile do
+ system('bundle install')
end
end
end
-def for_each_directory_of(path, &block)
- Dir[path].sort.each do |rakefile|
- directory = File.dirname(rakefile)
- puts '', "\033[44m#{directory}\033[0m", ''
- block.call(directory)
+def for_each_gemfile
+ version = ENV['VERSION'] || '*'
+ Dir["gemfiles/Gemfile.#{version}"].sort.each do |gemfile|
+ next if gemfile =~ /.lock/
+ puts '', "\033[44m#{gemfile}\033[0m", ''
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ yield
end
end
-