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/rspec'
module Guard
class RSpecHydra < Guard::RSpec
def initialize(watchers = [], options = {})
super
class Guard::RSpecHydra < Guard::RSpec
def initialize(watchers = [], options = {})
super
@options = {
:rails_env => 'test',
:rake_task => 'hydra:spec',
:runner_log => 'hydra-runner.log',
:show_runner_log => true
}.merge(@options)
end
@options = {
:rails_env => 'test',
:rake_task => 'hydra:spec',
:runner_log => 'hydra-runner.log',
:show_runner_log => true
}.merge(@options)
end
def start
UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!"
super
end
def start
Guard::UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!"
super
end
def run_all
File.unlink(@options[:runner_log]) if runner_log?
def run_all
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]
end
puts File.read(@options[:runner_log]) if runner_log? && @options[:show_runner_log]
end
private
def runner_log?
File.exist?(@options[:runner_log])
end
private
def runner_log?
File.exist?(@options[:runner_log])
end
end