class Packerman::Client

Public Instance Methods

convert(file) click to toggle source
# File lib/packerman/client.rb, line 2
def convert(file)
  basename = File.basename(file, ".*")
  puts "converting #{file} to #{basename}.json ..."

  template = File.open(file).read
  File.open("#{basename}.json", "w") do |f|
    f.write to_json(template)
  end
  puts "converted!"
end

Private Instance Methods

to_json(template) click to toggle source
# File lib/packerman/client.rb, line 15
def to_json(template)
  converted_hash = Packerman::Evaluator.new.evaluate(template)
  JSON.pretty_generate(converted_hash)
end