class Placer
Public Class Methods
new(args)
click to toggle source
# File lib/placer.rb, line 6 def initialize(args) @args, @params = parse_options(args) @logger = @params[:log] ? MyLogger.new : MyLogger.new(:all) end
Public Instance Methods
parse_options(args)
click to toggle source
# File lib/placer.rb, line 28 def parse_options(args) opts = OptionParser.new params = {} banner = <<BANNER placer - a simpler deployment deployment back to the basics If you have no config, just start off by the example in the repo/placer.yaml. In case you are wondering, public/private key auth is the only way. We don't support manual solutions. This tool is thought for automated use. Usage: placer [options] BANNER opts.banner = banner params[:log] = true opts.on('-q', '--[no-]log', 'toggle logging') do |val| params[:log] = val end params[:config_path] = 'placer.rb' opts.on('-c', '--config FILE', 'path to config FILE to use default: ' << params[:config_path]) do |file| params[:config_path] = file end params[:debug] = false opts.on('--debug', 'enable debugging') do params[:debug] = true end opts.on_tail('-h', '--help', 'shows this message') do puts opts exit end args = opts.parse(args) [args, params] end
run()
click to toggle source
# File lib/placer.rb, line 24 def run PlacerDSL.new(File.read(@params[:config_path]), @logger) end
start()
click to toggle source
# File lib/placer.rb, line 11 def start @logger.log(:info, "Loading config file #{@params[:config_path]}") if @params[:debug] run else begin run rescue => e @logger.log(:error, e) end end end