Class: Enviera::CLI
- Inherits:
-
Object
- Object
- Enviera::CLI
- Defined in:
- lib/enviera/CLI.rb
Class Method Summary collapse
Class Method Details
.execute ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/enviera/CLI.rb', line 38 def self.execute executor = Enviera::Options[:executor] begin result = executor.execute puts result unless result.nil? rescue Exception => e Utils.warn e. Utils.debug e.backtrace.join("\n") end end |
.parse ⇒ Object
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 |
# File 'lib/enviera/CLI.rb', line 10 def self.parse Utils.require_dir 'enviera/subcommands' Enviera.subcommands = Utils.find_all_subclasses_of({ :parent_class => Enviera::Subcommands }).collect {|classname| Utils.snakecase classname} Enviera.subcommand = ARGV.shift subcommand = case Enviera.subcommand when nil ARGV.delete_if {true} "unknown_command" when /^\-/ ARGV.delete_if {true} "help" else Enviera.subcommand end command_class = Subcommand.find subcommand = command_class.parse [:executor] = command_class = command_class.validate Enviera::Options.set Enviera::Options.trace end |