This commit is contained in:
John Bintz 2011-08-03 18:53:10 -04:00
parent 3f7d19cba2
commit 69e883a67a
2 changed files with 23 additions and 24 deletions

View File

@ -0,0 +1 @@
require 'guard/rspec-hydra'

View File

@ -2,35 +2,33 @@ require 'guard'
require 'guard/guard' require 'guard/guard'
require 'guard/rspec' require 'guard/rspec'
module Guard class Guard::RSpecHydra < Guard::RSpec
class RSpecHydra < Guard::RSpec def initialize(watchers = [], options = {})
def initialize(watchers = [], options = {}) super
super
@options = { @options = {
:rails_env => 'test', :rails_env => 'test',
:rake_task => 'hydra:spec', :rake_task => 'hydra:spec',
:runner_log => 'hydra-runner.log', :runner_log => 'hydra-runner.log',
:show_runner_log => true :show_runner_log => true
}.merge(@options) }.merge(@options)
end end
def start def start
UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!" Guard::UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!"
super super
end end
def run_all def run_all
File.unlink(@options[:runner_log]) if runner_log? File.unlink(@options[:runner_log]) if runner_log?
system %{rake RAILS_ENV=#{@options[:rails_env]} #{@options[:rake_task]}} system %{rake RAILS_ENV=#{@options[:rails_env]} #{@options[:rake_task]}}
puts File.read(@options[:runner_log]) if runner_log? && @options[:show_runner_log] puts File.read(@options[:runner_log]) if runner_log? && @options[:show_runner_log]
end end
private private
def runner_log? def runner_log?
File.exist?(@options[:runner_log]) File.exist?(@options[:runner_log])
end
end end
end end