Class: Trooper::CLI
- Inherits:
-
Object
- Object
- Trooper::CLI
- Defined in:
- lib/trooper/cli.rb
Instance Attribute Summary (collapse)
-
- (Object) argv
readonly
Returns the value of attribute argv.
-
- (Object) command
readonly
Returns the value of attribute command.
-
- (Object) config
Returns the value of attribute config.
-
- (Object) options
readonly
Returns the value of attribute options.
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) execute
-
- (CLI) initialize(argv)
constructor
A new instance of CLI.
Constructor Details
- (CLI) initialize(argv)
A new instance of CLI
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/trooper/cli.rb', line 16 def initialize(argv) @argv = argv @options = { :environment => :production } @command = option_parser.parse!(@argv)[0] if @command @command = @command.to_sym else raise CliArgumentError, "You didnt pass an action" end end |
Instance Attribute Details
- (Object) argv (readonly)
Returns the value of attribute argv
13 14 15 |
# File 'lib/trooper/cli.rb', line 13 def argv @argv end |
- (Object) command (readonly)
Returns the value of attribute command
13 14 15 |
# File 'lib/trooper/cli.rb', line 13 def command @command end |
- (Object) config
Returns the value of attribute config
14 15 16 |
# File 'lib/trooper/cli.rb', line 14 def config @config end |
- (Object) options (readonly)
Returns the value of attribute options
13 14 15 |
# File 'lib/trooper/cli.rb', line 13 def @options end |
Class Method Details
+ (Object) start(argv = ARGV)
7 8 9 10 11 |
# File 'lib/trooper/cli.rb', line 7 def self.start(argv = ARGV) cli = self.new(argv) cli.execute cli end |
Instance Method Details
- (Object) execute
29 30 31 32 33 34 35 36 37 |
# File 'lib/trooper/cli.rb', line 29 def execute case command when :init Configuration.init else config = Configuration.new() config.execute command end end |