Class: Linecook::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/linecook-gem/cli.rb

Instance Method Summary collapse

Instance Method Details

#bakeObject

method_option :package, type: :boolean, default: false, desc: ‘Package the resulting image. Implies –upload and –snapshot’, aliases: ‘-p’



91
92
93
94
95
96
# File 'lib/linecook-gem/cli.rb', line 91

def bake
  opts = options.symbolize_keys
  image = Linecook::Image.new(opts[:name], opts[:group], opts[:tag])
  baker = Linecook::Baker::Baker.new(image, directory: opts[:directory])
  baker.bake(snapshot: opts[:snapshot], upload: opts[:upload], keep: opts[:keep])
end

#cleanObject



100
101
102
103
104
105
# File 'lib/linecook-gem/cli.rb', line 100

def clean
  opts = options.symbolize_keys
  image = Linecook::Image.new(nil, nil, nil)
  baker = Linecook::Baker::Baker.new(image, directory: opts[:directory])
  baker.clean_kitchen
end

#manObject



108
109
110
111
# File 'lib/linecook-gem/cli.rb', line 108

def man
  path = File.join(Gem::Specification.find_by_name('linecook-gem').gem_dir, 'man', 'LINECOOK.1' )
  system("man #{path}")
end

#versionObject



114
115
116
# File 'lib/linecook-gem/cli.rb', line 114

def version
  puts Linecook::VERSION
end