Skip to content

Instantly share code, notes, and snippets.

@SpringMT
Created March 18, 2017 06:00
Show Gist options
  • Save SpringMT/167327770105041987530722d9b4cc24 to your computer and use it in GitHub Desktop.
Save SpringMT/167327770105041987530722d9b4cc24 to your computer and use it in GitHub Desktop.
require 'optparse'
require 'yaml'
require 'erb'
require 'pp'
verbose = false
opt = OptionParser.new
opt.on('--verbose') {|v| verbose = v }
opt.parse!(ARGV)
file_name = ARGV.first
begin
file_contents = open(file_name).read
contents = YAML.load(ERB.new(file_contents).result)
rescue => e
puts e
puts "\e[31mFail\e[m"
exit 1
end
if verbose
pp contents
end
puts "\e[32mSuccess\e[m"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment