Class: Chefdore::Cli

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

Instance Method Summary collapse

Instance Method Details

#convertObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/chefdore/cli.rb', line 11

def convert
  ARGV.replace []
  stdin = ARGF.read

  begin
    json = JSON.parse(stdin)
  rescue JSON::ParserError => e
    puts e.message
    exit 1
  end

  toa = %w(default_attributes override_attributes)

  toa.each do |type|
    attr = json[type]
    prefix = type.split('_').first
    Chefdore::Magic.convert(attr, prefix)
  end
end

#versionObject



32
33
34
# File 'lib/chefdore/cli.rb', line 32

def version
  say Chefdore::VERSION
end