From bb92628716627b0eabd44ab845ff117da2794d47 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 4 Aug 2011 10:38:52 -0400 Subject: [PATCH] set up hydra for testing --- .gitignore | 1 + Gemfile | 2 ++ Rakefile | 24 +++++++++++++++++++++++- config/hydra.yml | 5 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 config/hydra.yml diff --git a/.gitignore b/.gitignore index ef518d4..198d3eb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner *.o moc_*.* .DS_Store +hydra-runner.log diff --git a/Gemfile b/Gemfile index c16218b..9b90a14 100644 --- a/Gemfile +++ b/Gemfile @@ -12,3 +12,5 @@ gem 'guard-coffeescript' gem 'growl' gem 'rake', '0.8.7' gem 'mocha', '0.9.12' +gem 'hydra', :git => 'git://github.com/johnbintz/hydra.git' +gem 'facter' diff --git a/Rakefile b/Rakefile index 02ec64b..ace6ed3 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,28 @@ include Rake::DSL if defined?(Rake::DSL) require 'bundler' Bundler::GemHelper.install_tasks +begin + require 'hydra' + require 'hydra/tasks' + require 'facter' + + Hydra::TestTask.new('hydra:spec') do |t| + t.add_files 'spec/**/*_spec.rb' + end +rescue LoadError + warn "$! - hydra not loaded" +end + +HYDRA_LOG = 'hydra-runner.log' + +task 'hydra:before' do + rm HYDRA_LOG if File.file?(HYDRA_LOG) +end + +task('hydra:spec').enhance(%w{hydra:before}) do + puts File.read(HYDRA_LOG) if File.file?(HYDRA_LOG) +end + require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) @@ -22,7 +44,7 @@ namespace :spec do %w{1.8.7 1.9.2 ree}.each do |version| puts "Switching to #{version}" Bundler.with_clean_env do - system %{bash -c 'source ~/.rvm/scripts/rvm ; rvm #{version} ; bundle install ; bundle exec rake spec'} + system %{bash -c 'source ~/.rvm/scripts/rvm ; rvm #{version} ; bundle install ; bundle exec rake hydra:spec'} end if $?.exitstatus != 0 fail = true diff --git a/config/hydra.yml b/config/hydra.yml new file mode 100644 index 0000000..44bfd23 --- /dev/null +++ b/config/hydra.yml @@ -0,0 +1,5 @@ +<% Facter.loadfacts %> +workers: + - type: local + runners: <%= Facter.sp_number_processors %> +