Class: Guard::Gotest::Runner
- Inherits:
-
Object
- Object
- Guard::Gotest::Runner
- Defined in:
- lib/guard/gotest/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(paths, options = {}) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 10 11 12 |
# File 'lib/guard/gotest/runner.rb', line 6 def initialize( = {}) @options = { :env => nil, :notification => true, :sleep_time => 1 }.merge() end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/guard/gotest/runner.rb', line 4 def @options end |
Instance Method Details
#run(paths, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/guard/gotest/runner.rb', line 14 def run(paths, = {}) return false if paths.empty? = [:message] || "Running: #{paths.join(' ')}" UI.info(, :reset => true) = @options.merge() success = system(gotest_command(paths, )) if @options[:notification] && !success Notifier.notify('Failed', :title => 'Gotest results', :image => :failed, :priority => 2) end success end |
#stop ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/guard/gotest/runner.rb', line 30 def stop ps_go_pid.each do |pid| system %{kill -KILL #{pid}} end while ps_go_pid.count > 0 sleep @options[:sleep_time].to_f || 1 end end |