Class: Vagabond::Kitchen
- Inherits:
-
Thor
- Object
- Thor
- Vagabond::Kitchen
- Includes:
- Thor::Actions, Helpers
- Defined in:
- lib/vagabond/kitchen.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#kitchen ⇒ Object
readonly
Returns the value of attribute kitchen.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
-
#vagabondfile ⇒ Object
readonly
Returns the value of attribute vagabondfile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Kitchen
constructor
A new instance of Kitchen.
- #teardown(cookbook) ⇒ Object
- #test(cookbook) ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(*args) ⇒ Kitchen
Returns a new instance of Kitchen.
30 31 32 |
# File 'lib/vagabond/kitchen.rb', line 30 def initialize(*args) super end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
28 29 30 |
# File 'lib/vagabond/kitchen.rb', line 28 def action @action end |
#kitchen ⇒ Object (readonly)
Returns the value of attribute kitchen.
23 24 25 |
# File 'lib/vagabond/kitchen.rb', line 23 def kitchen @kitchen end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/vagabond/kitchen.rb', line 27 def name @name end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
26 27 28 |
# File 'lib/vagabond/kitchen.rb', line 26 def ui @ui end |
#vagabondfile ⇒ Object (readonly)
Returns the value of attribute vagabondfile.
25 26 27 |
# File 'lib/vagabond/kitchen.rb', line 25 def vagabondfile @vagabondfile end |
Class Method Details
.basename ⇒ Object
16 17 18 |
# File 'lib/vagabond/kitchen.rb', line 16 def basename 'vagabond kitchen' end |
Instance Method Details
#teardown(cookbook) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vagabond/kitchen.rb', line 43 def teardown(cookbook) ui.info "#{ui.color('Vagabond:', :bold)} - Kitchen teardown for cookbook #{ui.color(name, :red)}" plats = [platform || [:platform] || platform_map.keys].flatten plats.each do |plat| validate_platform!(plat) ui.info ui.color(" -> Tearing down platform: #{plat}", :red) vagabond_instance(:destroy, plat).send(:execute) ui.info ui.color(" -> Teardown of platform: #{plat} - COMPLETE!", :red) end end |
#test(cookbook) ⇒ 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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/vagabond/kitchen.rb', line 77 def test(cookbook) setup(cookbook, :test) ui.info "#{ui.color('Vagabond:', :bold)} - Kitchen testing for cookbook #{ui.color(name, :cyan)}" results = Mash.new platforms = [[:platform] || platform_map.keys].flatten if([:cluster]) ui.info ui.color(" -> Cluster Testing #{[:cluster]}!", :yellow) if(kitchen[:clusters].nil? || kitchen[:clusters][[:cluster]].nil?) ui.fatal "Requested cluster is not defined: #{[:cluster]}" exit EXIT_CODES[:cluster_invalid] end serv = Server.new serv. = serv.auto_upload # upload everything : make optional? suites = kitchen[:clusters][[:cluster]] platforms.each do |platform| %w(local_server_provision test destroy).each do |action| suites.each do |suite_name| res = self.send("#{action}_node", platform, suite_name) if(action == 'test') results[platform] ||=[] results[platform] << { :suite_name => suite_name, :result => res } end end end end else suites = [:suites] ? [:suites].split(',') : ['default'] platforms.each do |platform| suites.each do |suite_name| provision_node(platform, suite_name) results[platform] ||= [] results[platform] << { :suite_name => suite_name, :result => test_node(platform, suite_name) } destroy_node(platform, suite_name) end end end ui.info ui.color('Kitchen Test Results:', :bold) results.each do |platform, infos| ui.info " Platform: #{ui.color(platform, :blue, :bold)}" infos.each do |res| ui.info " Suite: #{res[:suite_name]} -> #{res[:result] ? ui.color('SUCCESS!', :green) : ui.color('FAILED!', :red)}" end end end |