class Guard::Teaspoon
Attributes
failed_paths[RW]
last_failed[RW]
resolver[RW]
runner[RW]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/guard/teaspoon.rb, line 11 def initialize(options = {}) 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(options) end
Public Instance Methods
reload()
click to toggle source
# File lib/guard/teaspoon.rb, line 44 def reload @last_failed = false @failed_paths = [] end
run_all()
click to toggle source
# 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)
click to toggle source
# 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
start()
click to toggle source
# File lib/guard/teaspoon.rb, line 24 def start reload @resolver = Resolver.new(@options) @runner = Runner.new(@options) UI.info "Guard::Teaspoon is running" run_all if @options[:all_on_start] end
Private Instance Methods
add_failed(paths)
click to toggle source
# File lib/guard/teaspoon.rb, line 73 def add_failed(paths) if @options[:keep_failed] @failed_paths += paths @failed_paths.uniq! end end
remove_failed(paths)
click to toggle source
# File lib/guard/teaspoon.rb, line 69 def remove_failed(paths) @failed_paths -= paths if @options[:keep_failed] end