Module: Vagabond::Helpers::Knife
- Defined in:
- lib/vagabond/helpers/knife.rb
Class Method Summary collapse
Instance Method Summary collapse
- #knife_command(action, opts = {}) ⇒ Object
- #knife_config(args = {}) ⇒ Object
- #knife_config_build ⇒ Object
Class Method Details
Instance Method Details
#knife_command(action, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vagabond/helpers/knife.rb', line 11 def knife_command(action, opts={}) conf = knife_config_build.to_a.map do |ary| scrub = ary.compact.map do |arg| if(arg) arg.gsub('_', '-') end end "--#{scrub.join(' ')}" end.join(' ') build_command("knife #{action} #{conf}", :shellout => opts) end |
#knife_config(args = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/vagabond/helpers/knife.rb', line 31 def knife_config(args = {}) Settings[:knife] ||= Mash.new Settings[:knife].merge!(args) Settings[:knife] end |
#knife_config_build ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/vagabond/helpers/knife.rb', line 23 def knife_config_build base = Mash.new if(File.exists?(kconf = File.join(vagabondfile.store_directory, '.chef/knife.rb'))) base[:config] = File.(kconf) end base.merge(knife_config) end |