Class: Fastball::CLI
- Inherits:
-
Object
- Object
- Fastball::CLI
- Defined in:
- lib/fastball/cli.rb
Constant Summary collapse
- HELP =
" usage: fastball COMMAND [options]\n\n Fastball is the safest, fastest way to build and deploy dynamic applications.\n\n Commands:\n config - generate config files from erb templates\n\n Examples:\n fastball config\n"
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Class Method Summary collapse
Instance Method Summary collapse
- #help_text ⇒ Object
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
17 18 19 20 |
# File 'lib/fastball/cli.rb', line 17 def initialize(argv) @argv = argv @command = argv.shift end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
3 4 5 |
# File 'lib/fastball/cli.rb', line 3 def argv @argv end |
Class Method Details
.help_text ⇒ Object
22 23 24 |
# File 'lib/fastball/cli.rb', line 22 def self.help_text HELP.gsub(/^ {6}/, '') end |
Instance Method Details
#help_text ⇒ Object
26 27 28 |
# File 'lib/fastball/cli.rb', line 26 def help_text self.class.help_text end |
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fastball/cli.rb', line 30 def run case @command when 'config' Fastball::Config.generate when 'help' puts help_text else puts help_text exit 1 end end |