Class: DeployRubygem::Kitchen
- Inherits:
-
Object
- Object
- DeployRubygem::Kitchen
- Defined in:
- lib/deploy_rubygem/kitchen.rb
Overview
Using Kitchen to deploy and manage Kitchen
Instance Attribute Summary collapse
-
#cookbook ⇒ Object
readonly
Returns the value of attribute cookbook.
-
#kitchen_name ⇒ Object
readonly
Returns the value of attribute kitchen_name.
Instance Method Summary collapse
- #check_file ⇒ Object
- #converge ⇒ Object
- #destroy ⇒ Object
-
#initialize(kitchen_name, cookbook) ⇒ Kitchen
constructor
A new instance of Kitchen.
- #ip ⇒ Object
- #target ⇒ Object
- #verify(showing: true) ⇒ Object
Constructor Details
#initialize(kitchen_name, cookbook) ⇒ Kitchen
Returns a new instance of Kitchen.
10 11 12 13 |
# File 'lib/deploy_rubygem/kitchen.rb', line 10 def initialize(kitchen_name, cookbook) @kitchen_name = kitchen_name @cookbook = cookbook end |
Instance Attribute Details
#cookbook ⇒ Object (readonly)
Returns the value of attribute cookbook.
8 9 10 |
# File 'lib/deploy_rubygem/kitchen.rb', line 8 def cookbook @cookbook end |
#kitchen_name ⇒ Object (readonly)
Returns the value of attribute kitchen_name.
8 9 10 |
# File 'lib/deploy_rubygem/kitchen.rb', line 8 def kitchen_name @kitchen_name end |
Instance Method Details
#check_file ⇒ Object
15 16 17 |
# File 'lib/deploy_rubygem/kitchen.rb', line 15 def check_file ::File.join("#{kitchen_name}_check.log") end |
#converge ⇒ Object
19 20 21 |
# File 'lib/deploy_rubygem/kitchen.rb', line 19 def converge system("kitchen converge #{kitchen_name}") end |
#destroy ⇒ Object
23 24 25 |
# File 'lib/deploy_rubygem/kitchen.rb', line 23 def destroy system("kitchen destroy #{kitchen_name}") end |
#ip ⇒ Object
27 28 29 30 |
# File 'lib/deploy_rubygem/kitchen.rb', line 27 def ip switch_to_cookbook system("kitchen exec #{kitchen_name} -c 'hostname -I'") end |
#target ⇒ Object
41 42 43 44 |
# File 'lib/deploy_rubygem/kitchen.rb', line 41 def target verify(showing: false) system("grep -n Target #{check_file}") end |
#verify(showing: true) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/deploy_rubygem/kitchen.rb', line 32 def verify(showing: true) cookbook.switch_to_cookbook if showing system("kitchen verify #{kitchen_name}") else system("kitchen verify #{kitchen_name} > #{check_file}") end end |