Class: Guard::Teaspoon
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Teaspoon
- Defined in:
- lib/guard/teaspoon.rb,
lib/guard/teaspoon/runner.rb,
lib/guard/teaspoon/resolver.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#failed_paths ⇒ Object
Returns the value of attribute failed_paths.
-
#last_failed ⇒ Object
Returns the value of attribute last_failed.
-
#resolver ⇒ Object
Returns the value of attribute resolver.
-
#runner ⇒ Object
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Teaspoon
constructor
A new instance of Teaspoon.
- #reload ⇒ Object
- #run_all ⇒ Object
- #run_on_modifications(original_paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Teaspoon
Returns a new instance of Teaspoon.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/guard/teaspoon.rb', line 11 def initialize( = {}) super @options = { focus_on_failed: false, all_after_pass: true, all_on_start: true, keep_failed: true, formatters: 'clean', run_all: {}, run_on_modifications: {} }.merge() end |
Instance Attribute Details
#failed_paths ⇒ Object
Returns the value of attribute failed_paths.
9 10 11 |
# File 'lib/guard/teaspoon.rb', line 9 def failed_paths @failed_paths end |
#last_failed ⇒ Object
Returns the value of attribute last_failed.
9 10 11 |
# File 'lib/guard/teaspoon.rb', line 9 def last_failed @last_failed end |
#resolver ⇒ Object
Returns the value of attribute resolver.
9 10 11 |
# File 'lib/guard/teaspoon.rb', line 9 def resolver @resolver end |
#runner ⇒ Object
Returns the value of attribute runner.
9 10 11 |
# File 'lib/guard/teaspoon.rb', line 9 def runner @runner end |
Instance Method Details
#reload ⇒ Object
44 45 46 47 |
# File 'lib/guard/teaspoon.rb', line 44 def reload @last_failed = false @failed_paths = [] end |
#run_all ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/guard/teaspoon.rb', line 32 def run_all passed = @runner.run_all(@options[:run_all]) if passed reload true else @last_failed = true throw :task_has_failed end end |
#run_on_modifications(original_paths) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/guard/teaspoon.rb', line 49 def run_on_modifications(original_paths) @resolver.resolve(original_paths) failed = false @resolver.suites.each do |suite, files| failed = true unless @runner.run(files, @options[:run_on_modifications].merge(suite: suite)) end if failed @last_failed = true Notifier.notify("Failed", title: "Teaspoon Guard", image: :failed) throw :task_has_failed else Notifier.notify("Success", title: "Teaspoon Guard", image: :success) run_all if @last_failed end end |