class PuppetPal::Cli

Public Class Methods

new() click to toggle source
# File lib/puppet_pal/cli.rb, line 6
def initialize

end

Public Instance Methods

run() click to toggle source
# File lib/puppet_pal/cli.rb, line 10
def run
  opts = GetoptLong.new(
    [ '--puppet_file', '-f', GetoptLong::REQUIRED_ARGUMENT ],
  )
  # Shove our options into a hash
  @options = {puppet_file: "Puppetfile"}
  opts.each do |opt, arg|
    key=opt.split("--").last
    if arg && !arg.empty?
      @options[key.to_sym]=arg
    else
      @options[key.to_sym]=true
    end
  end
  raise "Cannot find Puppetfile: #{@options[:puppet_file]}." unless File.exists?(@options[:puppet_file])
  pal = PuppetPal::Pal.new(@options[:puppet_file])
  pal.run
end