Class: Guard::Spinach::Runner
- Inherits:
-
Object
- Object
- Guard::Spinach::Runner
- Defined in:
- lib/guard/spinach/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
-
#initialize(paths, opts = nil) ⇒ Runner
constructor
A new instance of Runner.
- #notify(passed) ⇒ Object
- #run ⇒ Object
- #run_command ⇒ Object
Constructor Details
#initialize(paths, opts = nil) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 |
# File 'lib/guard/spinach/runner.rb', line 6 def initialize(paths, opts = nil) @paths = paths @options = opts || {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/guard/spinach/runner.rb', line 4 def @options end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
4 5 6 |
# File 'lib/guard/spinach/runner.rb', line 4 def paths @paths end |
Instance Method Details
#notify(passed) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/guard/spinach/runner.rb', line 32 def notify(passed) opts = {title: 'Spinach results', priority: 2} if passed status = 'Passed' image = :success else status = 'Failed' image = :failed end Guard::Compat::UI.notify(status, opts.merge(image: image)) end |
#run ⇒ Object
11 12 13 14 15 |
# File 'lib/guard/spinach/runner.rb', line 11 def run puts "Running #{paths.empty? ? "all Spinach features" : paths.join(" ")}" system(run_command) notify($? == 0) end |
#run_command ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/guard/spinach/runner.rb', line 17 def run_command cmd = [] cmd << @options[:command_prefix] if @options[:command_prefix] if @options[:binstubs] cmd << 'bin/spinach' else cmd << 'spinach' end cmd << paths.join(" ") cmd << '-g' if @options[:generate] cmd << "-t #{@options[:tags].join(',')}" if @options[:tags] && @options[:tags].any? cmd << '-b' if @options[:backtrace] cmd.join(" ") end |