Class: IV::CLI::Command::Init

Inherits:
IV::CLI::Command show all
Defined in:
lib/iv-cli/commands/init.rb

Instance Attribute Summary

Attributes inherited from IV::CLI::Command

#iv_config

Instance Method Summary collapse

Methods inherited from IV::CLI::Command

invalid_command?, run_command

Methods included from Helpers::SubclassRegistration

included

Methods included from Helpers::Errors

included

Instance Method Details

#run(args, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/iv-cli/commands/init.rb', line 21

def run(args, options = {})
  parse_options(args)
  validate

  puts "Generating config directory in ~/.iv"
  ::FileUtils.mkdir_p(self.class.config_dir)

  puts "Generating config file ~/.iv/config.yml"
  ::File.open(self.class.config_file, "w") do |f|
    f.puts "---"
    write_default_opscode(f)
  end
end