Class: Manman::Runner
- Inherits:
-
Object
- Object
- Manman::Runner
- Defined in:
- lib/manman/runner.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ Runner
constructor
A new instance of Runner.
- #run(args) ⇒ Object
Constructor Details
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
16 17 18 |
# File 'lib/manman/runner.rb', line 16 def logger @logger end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
16 17 18 |
# File 'lib/manman/runner.rb', line 16 def opts @opts end |
Instance Method Details
#run(args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/manman/runner.rb', line 18 def run( args ) opt=OptionParser.new do |cmd| cmd. = "Usage: manman [options]" cmd.on( '-r', '--release RELEASE', 'Release Version (e.g. 2013.08)' ) do |release| opts.release = release end cmd.on( '-e', '--env ENV', 'Environment (e.g. TEST)' ) do |env| opts.env = env end cmd.on( '-u', '--valid_until VALID', 'Valid until (e.g. 2014.01.31)' ) do |valid| opts.valid = valid end cmd.on( '-d', '--dir PATH', "Path to Packages (default is #{opts.base})" ) do |path| opts.base = path end cmd.on( '-t', '--template FILE', "Input Template (default is #{opts.template})" ) do |file| opts.template = file end cmd.on( '-o', '--out FILE', "Output File (default is #{opts.output})" ) do |file| opts.output = file end cmd.on( '-v', '--version', "Show version" ) do puts Manman. exit end cmd.on( "--verbose", "Show debug trace" ) do logger.datetime_format = "%H:%H:%S" logger.level = Logger::DEBUG end cmd.on_tail( "-h", "--help", "Show this message" ) do puts <<EOS manman - Manifest Manager, Version #{VERSION} #{cmd.help} Examples: manman -r 2013.08 -e TEST -u 2014.12.31 EOS exit end end opt.parse!( args ) puts Manman. # check for required args puts "*** Missing Argument: -r/--release Release Argument Required" if opts.release.nil? puts "*** Missing Argument: -e/--env Argument Required" if opts.env.nil? if opts.release.nil? || opts.env.nil? puts puts "Use -h/--help for usage options." return ## exit ?? end # puts "Using settings:" # pp opts worker = Worker.new( logger, opts ) worker.run # puts 'Done.' end |