Class: Guard::Kitchen
- Defined in:
- lib/guard/kitchen.rb,
lib/guard/kitchen/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#reload ⇒ Object
56 57 58 59 |
# File 'lib/guard/kitchen.rb', line 56 def reload stop start end |
#run_all ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/guard/kitchen.rb', line 61 def run_all ::Guard::UI.info("Guard::Kitchen is running all tests") cmd = Mixlib::ShellOut.new("kitchen verify", :timeout => 10800) cmd.live_stream = STDOUT cmd.run_command begin cmd.error! Notifier.notify('Kitchen verify succeeded', :title => 'test-kitchen', :image => :success) ::Guard::UI.info("Kitchen verify succeeded") rescue Mixlib::ShellOut::ShellCommandFailed => e Notifier.notify('Kitchen verify failed', :title => 'test-kitchen', :image => :failed) ::Guard::UI.info("Kitchen verify failed with #{e.to_s}") throw :task_has_failed end end |
#run_on_changes(paths) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/guard/kitchen.rb', line 77 def run_on_changes(paths) suites = {} paths.each do |path| if path =~ /test\/integration\/(.+?)\/.+/ suites[$1] = true end end if suites.length > 0 ::Guard::UI.info("Guard::Kitchen is running suites: #{suites.keys.join(', ')}") cmd = Mixlib::ShellOut.new("kitchen verify '(#{suites.keys.join('|')})-.+' -p", :timeout => 10800) cmd.live_stream = STDOUT cmd.run_command begin cmd.error! Notifier.notify("Kitchen verify succeeded for: #{suites.keys.join(', ')}", :title => 'test-kitchen', :image => :success) ::Guard::UI.info("Kitchen verify succeeded for: #{suites.keys.join(', ')}") rescue Mixlib::ShellOut::ShellCommandFailed => e Notifier.notify("Kitchen verify failed for: #{suites.keys.join(', ')}", :title => 'test-kitchen', :image => :failed) ::Guard::UI.info("Kitchen verify failed with #{e.to_s}") throw :task_has_failed end else ::Guard::UI.info("Guard::Kitchen is running converge for all suites") cmd = Mixlib::ShellOut.new("kitchen converge", :timeout => 10800) cmd.live_stream = STDOUT cmd.run_command begin cmd.error! Notifier.notify("Kitchen converge succeeded", :title => 'test-kitchen', :image => :success) ::Guard::UI.info("Kitchen converge succeeded") rescue Mixlib::ShellOut::ShellCommandFailed => e Notifier.notify("Kitchen converge failed", :title => 'test-kitchen', :image => :failed) ::Guard::UI.info("Kitchen converge failed with #{e.to_s}") throw :task_has_failed end end end |
#start ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/guard/kitchen.rb', line 23 def start ::Guard::UI.info("Guard::Kitchen is starting") cmd = Mixlib::ShellOut.new("kitchen create", :timeout => 10800) cmd.live_stream = STDOUT cmd.run_command begin cmd.error! Notifier.notify('Kitchen created', :title => 'test-kitchen', :image => :success) rescue Mixlib::ShellOut::ShellCommandFailed => e Notifier.notify('Kitchen create failed', :title => 'test-kitchen', :image => :failed) ::Guard::UI.info("Kitchen failed with #{e.to_s}") throw :task_has_failed end end |
#stop ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/guard/kitchen.rb', line 38 def stop ::Guard::UI.warning("Guard::Kitchen cannot stop for you, due to strange bug.") ::Guard::UI.warning("You likely want to run 'kitchen destroy'") #::Guard::UI.info("Guard::Kitchen is stopping") #cmd = Mixlib::ShellOut.new("kitchen destroy") #cmd.live_stream = STDOUT #cmd.run_command #begin # cmd.error! #rescue Mixlib::ShellOut::ShellCommandFailed => e # ::Guard::UI.info("Kitchen failed with #{e.to_s}") # throw :task_has_failed #ensure # # Sometimes, we leave the occasional shell process unreaped! # Process.waitall #end end |