Method: Vmreverter::CLI#initialize
- Defined in:
- lib/vmreverter/cli.rb
#initialize ⇒ CLI
Returns a new instance of CLI.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vmreverter/cli.rb', line 3 def initialize = Vmreverter::Options.parse_args @logger = Vmreverter::Logger.new() if [:lockfile] if Pathname.new([:lockfile]).exist? report_and_raise(@logger, ArgumentError.new("Specified lockfile path '#{@options[:lockfile]}' is locked."), "Lockfile is locked") else FileUtils.touch([:lockfile]) end end if not [:config] report_and_raise(@logger, ArgumentError.new("Missing config, specify one (-c or --config)!"), "CLI: initialize") end @logger.debug("Options") .each do |opt, val| if val and val != [] @logger.debug("\t#{opt.to_s}:") if val.kind_of?(Array) val.each do |v| @logger.debug("\t\t#{v.to_s}") end else @logger.debug("\t\t#{val.to_s}") end end end Vmreverter::Configuration.build(, @logger) @config = Vmreverter::Configuration.instance end |