Class: Pakman::Runner
- Inherits:
-
Object
- Object
- Pakman::Runner
- Includes:
- LogUtils::Logging
- Defined in:
- lib/pakman/cli/runner.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run(args) ⇒ Object
Constructor Details
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
13 14 15 |
# File 'lib/pakman/cli/runner.rb', line 13 def opts @opts end |
Instance Method Details
#run(args) ⇒ Object
15 16 17 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 |
# File 'lib/pakman/cli/runner.rb', line 15 def run( args ) opt=OptionParser.new do |cmd| cmd. = "Usage: pakman [options]" cmd.on( '-f', '--fetch URI', 'Fetch Templates' ) do |uri| opts.fetch_uri = uri end cmd.on( '-t', '--template MANIFEST', 'Generate Templates' ) do |manifest| opts.generate = true opts.manifest = manifest end cmd.on( '-l', '--list', "List Installed Templates" ) { opts.list = true } cmd.on( '-c', '--config PATH', "Configuration Path (default is #{opts.config_path})" ) do |path| opts.config_path = path end cmd.on( '-o', '--output PATH', "Output Path (default is #{opts.output_path})" ) { |path| opts.output_path = path } cmd.on( '-v', '--version', "Show version" ) do puts Pakman. exit end cmd.on( "--verbose", "Show debug trace" ) do ## logger.datetime_format = "%H:%H:%S" ## logger.level = Logger::DEBUG # fix: use logutils - set to debug end cmd.on_tail( "-h", "--help", "Show this message" ) do puts <<EOS pakman - Lets you manage template packs. #{cmd.help} Examples: pakman -f URI # to be done pakman -f URI -c ~/.slideshow/templates pakman -l # to be done pakman -l -c ~/.slideshow/templates pakman -t s6 pakman -t s6 ruby19.yml pakman -t s6 ruby19.yml tagging.yml pakman -t s6 -o o pakman -t s6 -c ~/.slideshow/templates Further information: http://geraldb.github.com/pakman EOS exit end end opt.parse!( args ) puts Pakman. if opts.list? List.new( opts ).run elsif opts.generate? Gen.new( opts ).run( args ) elsif opts.fetch? Fetch.new( opts ).run else puts "-- No command do nothing for now. --" ## run help?? puts "Done." end end |