Class: Nimbu::Command::Base
- Inherits:
-
Object
- Object
- Nimbu::Command::Base
- Includes:
- Helpers
- Defined in:
- lib/nimbu/command/base.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
-
#initialize(args = [], options = {}) ⇒ Base
constructor
A new instance of Base.
- #nimbu ⇒ Object
Methods included from Helpers
#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, disable_error_capture, #display, #display_header, #display_object, #display_row, #display_table, enable_error_capture, #error, #error_with_failure, extended, extended_into, #fail, #format_bytes, #format_date, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #longest, #output, #output_with_arrow, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #status, #string_distance, #time_ago, #truncate, #with_tty
Constructor Details
#initialize(args = [], options = {}) ⇒ Base
Returns a new instance of Base.
16 17 18 19 |
# File 'lib/nimbu/command/base.rb', line 16 def initialize(args=[], ={}) @args = args @options = end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
13 14 15 |
# File 'lib/nimbu/command/base.rb', line 13 def args @args end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/nimbu/command/base.rb', line 14 def @options end |
Class Method Details
.namespace ⇒ Object
9 10 11 |
# File 'lib/nimbu/command/base.rb', line 9 def self.namespace self.to_s.split("::").last.downcase end |
Instance Method Details
#app ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nimbu/command/base.rb', line 21 def app @app ||= if [:app].is_a?(String) if confirm_mismatch? raise Nimbu::Command::CommandFailed, "Mismatch between --app and --confirm" end [:app] elsif [:confirm].is_a?(String) [:confirm] elsif app_from_dir = extract_app_in_dir(Dir.pwd) app_from_dir else raise Nimbu::Command::CommandFailed, "No app specified.\nRun this command from an app folder or specify which app to use with --app <app name>" end end |