Class: Itamae::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/itamae/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, opts, config) ⇒ CLI


9
10
11
12
13
14
15
# File 'lib/itamae/cli.rb', line 9

def initialize(args, opts, config)
  opts = Config.new(opts).load
  super(args, opts, config)

  Itamae::Logger.level = ::Logger.const_get(options[:log_level].upcase)
  Itamae::Logger.formatter.colored = options[:color]
end

Instance Method Details

#local(*recipe_files) ⇒ Object


23
24
25
26
27
28
29
# File 'lib/itamae/cli.rb', line 23

def local(*recipe_files)
  if recipe_files.empty?
    raise "Please specify recipe files."
  end

  Runner.run(recipe_files, :local, options)
end

#ssh(*recipe_files) ⇒ Object


44
45
46
47
48
49
50
# File 'lib/itamae/cli.rb', line 44

def ssh(*recipe_files)
  if recipe_files.empty?
    raise "Please specify recipe files."
  end

  Runner.run(recipe_files, :ssh, options)
end

#versionObject


53
54
55
# File 'lib/itamae/cli.rb', line 53

def version
  puts "Itamae v#{Itamae::VERSION}"
end