Class: ESP::CommandsTasks
- Inherits:
-
Object
- Object
- ESP::CommandsTasks
- Defined in:
- lib/esp/commands/commands_tasks.rb
Overview
This is a class which takes in an esp command and initiates the appropriate initiation sequence.
Warning: This class mutates ARGV because some commands require manipulating it before they are run.
Constant Summary collapse
- HELP_MESSAGE =
<<-EOT Usage: esp COMMAND [environment] [ARGS] The ESP commands are: console Start the ESP console (short-cut alias: "c") add_external_account Adds external accounts to ESP (short-cut alias: "a") All commands can be run with -h (or --help) for more information. EOT
- COMMAND_WHITELIST =
%w(console add_external_account version help)
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #add_external_account ⇒ Object
- #console ⇒ Object
- #help ⇒ Object
-
#initialize(argv) ⇒ CommandsTasks
constructor
A new instance of CommandsTasks.
- #run_command!(command) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(argv) ⇒ CommandsTasks
Returns a new instance of CommandsTasks.
22 23 24 |
# File 'lib/esp/commands/commands_tasks.rb', line 22 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
:nodoc:
8 9 10 |
# File 'lib/esp/commands/commands_tasks.rb', line 8 def argv @argv end |
Instance Method Details
#add_external_account ⇒ Object
44 45 46 |
# File 'lib/esp/commands/commands_tasks.rb', line 44 def add_external_account require_command!("add_external_account") end |
#console ⇒ Object
37 38 39 40 41 42 |
# File 'lib/esp/commands/commands_tasks.rb', line 37 def console require_command!("console") ESP::Console.new.start end |
#help ⇒ Object
53 54 55 |
# File 'lib/esp/commands/commands_tasks.rb', line 53 def help end |
#run_command!(command) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/esp/commands/commands_tasks.rb', line 26 def run_command!(command) command = parse_command(command) if COMMAND_WHITELIST.include?(command) set_env! require_relative '../../../lib/esp_sdk' send(command) else (command) end end |