Rakefile in ci_reporter-1.9.0 vs Rakefile in ci_reporter-1.9.1

- old
+ new

@@ -23,17 +23,17 @@ p.description = p.paragraphs_of('README.rdoc', 0...1).join("\n\n") p.extra_rdoc_files += ["README.rdoc"] p.test_globs = ["spec/**/*_spec.rb"] p.extra_deps << [ 'builder', '>= 2.1.2' ] p.extra_dev_deps << [ 'hoe-git', '~> 1.5.0' ] - p.extra_dev_deps << [ 'cucumber', '~> 0.10.0' ] + p.extra_dev_deps << [ 'cucumber', '>= 1.3.3' ] p.extra_dev_deps << [ 'rspec', '> 2.0.0' ] p.extra_dev_deps << [ 'test-unit', '> 2.4.9' ] p.extra_dev_deps << [ 'minitest', '~> 2.2.0' ] - p.extra_dev_deps << [ 'spinach', '< 0.2' ] - + p.extra_dev_deps << [ 'spinach', '>= 0.8.7' ] p.clean_globs += ["spec/reports", "acceptance/reports"] + p.license 'MIT' end hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"] task :gemspec do File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby } @@ -41,40 +41,59 @@ task :package => :gemspec rescue LoadError puts "You really need Hoe installed to be able to package this gem" end -task :generate_output do - rm_rf "acceptance/reports" - ENV['CI_REPORTS'] = "acceptance/reports" +def run_ruby_acceptance(cmd) + ENV['CI_REPORTS'] ||= "acceptance/reports" if ENV['RUBYOPT'] opts = ENV['RUBYOPT'] ENV['RUBYOPT'] = nil else opts = "-rubygems" end - rspec = "#{Gem.loaded_specs['rspec-core'].gem_dir}/exe/rspec" - cucumber = "#{Gem.loaded_specs['cucumber'].gem_dir}/bin/cucumber" begin result_proc = proc {|ok,*| puts "Failures above are expected." unless ok } - ruby "-Ilib #{opts} -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb", &result_proc - ruby "-Ilib #{opts} -rci/reporter/rake/minitest_loader acceptance/minitest_example_test.rb", &result_proc - ruby "-Ilib #{opts} -S #{rspec} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb", &result_proc - ruby "-Ilib #{opts} -rci/reporter/rake/cucumber_loader -S #{cucumber} --format CI::Reporter::Cucumber acceptance/cucumber", &result_proc - Dir.chdir 'acceptance/spinach' do - Bundler.with_clean_env do - ENV['CI_REPORTS'] = "../reports/spinach" - sh "bundle" - spinach = "#{Gem.loaded_specs['spinach'].gem_dir}/bin/spinach" - ruby "-I../../lib #{opts} -rci/reporter/rake/spinach_loader -S #{spinach}", &result_proc - end - end + ruby "-Ilib #{opts} #{cmd}", &result_proc ensure ENV['RUBYOPT'] = opts if opts != "-rubygems" ENV.delete 'CI_REPORTS' end end -task :acceptance => :generate_output + + +namespace :generate do + task :test_unit do + run_ruby_acceptance "-rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb" + end + + task :minitest do + run_ruby_acceptance "-rci/reporter/rake/minitest_loader acceptance/minitest_example_test.rb" + end + + task :rspec do + rspec = "#{Gem.loaded_specs['rspec-core'].gem_dir}/exe/rspec" + run_ruby_acceptance "-S #{rspec} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb" + end + + task :cucumber do + cucumber = "#{Gem.loaded_specs['cucumber'].gem_dir}/bin/cucumber" + run_ruby_acceptance "-rci/reporter/rake/cucumber_loader -S #{cucumber} --format CI::Reporter::Cucumber acceptance/cucumber" + end + + task :spinach do + spinach = "#{Gem.loaded_specs['spinach'].gem_dir}/bin/spinach" + run_ruby_acceptance "-I../../lib -rci/reporter/rake/spinach_loader -S #{spinach} -r ci_reporter -f acceptance/spinach/features" + end + + task :clean do + rm_rf "acceptance/reports" + end + + task :all => [:clean, :test_unit, :minitest, :rspec, :cucumber, :spinach] +end + +task :acceptance => "generate:all" require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:acceptance_spec) do |t| t.pattern = FileList['acceptance/verification_spec.rb'] t.rspec_opts = "--color"