Class: Guard::Ecukes
- Defined in:
- lib/guard/ecukes.rb,
lib/guard/ecukes/runner.rb,
lib/guard/ecukes/inspector.rb
Overview
The Ecukes guard that gets notifications about the following Guard events: ‘start`, `stop`, `reload`, `run_all` and `run_on_change`.
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Ecukes
constructor
Initialize Guard::Ecukes.
-
#reload ⇒ Object
Gets called when the Guard should reload itself.
-
#run_all ⇒ Object
Gets called when all specs should be run.
-
#run_on_changes(paths) ⇒ Object
Gets called when watched paths and files have changes.
-
#start ⇒ Object
Gets called once when Guard starts.
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Ecukes
Initialize Guard::Ecukes.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/guard/ecukes.rb', line 25 def initialize(watchers = [], = {}) super @options = { :all_after_pass => true, :all_on_start => true, }.update() @last_failed = false end |
Instance Method Details
#reload ⇒ Object
Gets called when the Guard should reload itself.
60 61 |
# File 'lib/guard/ecukes.rb', line 60 def reload end |
#run_all ⇒ Object
Gets called when all specs should be run.
48 49 50 51 52 53 54 |
# File 'lib/guard/ecukes.rb', line 48 def run_all passed = Runner.run(['features'], @options.merge(@options[:run_all] || {}).merge(:message => 'Running all features')) @last_failed = !passed throw :task_has_failed unless passed end |
#run_on_changes(paths) ⇒ Object
Gets called when watched paths and files have changes.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/guard/ecukes.rb', line 68 def run_on_changes(paths) paths = Inspector.clean(paths) passed = Runner.run(paths, paths.include?('features') ? @options.merge({ :message => 'Running all features' }) : @options) if passed # run all the specs if the changed specs failed, like autotest run_all if @last_failed && @options[:all_after_pass] else # track whether the changed feature failed for the next change @last_failed = true end throw :task_has_failed unless passed end |
#start ⇒ Object
Gets called once when Guard starts.
40 41 42 |
# File 'lib/guard/ecukes.rb', line 40 def start run_all if @options[:all_on_start] end |