Class: Pebbles::Command::Base
- Inherits:
-
Object
- Object
- Pebbles::Command::Base
- Includes:
- Helpers
- Defined in:
- lib/pebbles/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
- #api ⇒ Object
- #app ⇒ Object
-
#initialize(args = [], options = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Helpers
#action, #ask, #confirm_command, #create_git_remote, #debug, #debugging?, #display, #error, error_with_failure, error_with_failure=, #flatten_hash, #format_bytes, #format_error, #format_with_bang, #git, #has_git?, #has_git_remote?, #has_http_git_entry_in_netrc, #home_directory, #hputs, #json_decode, #launchy, #line_formatter, #longest, #output_with_bang, #running_on_a_mac?, #running_on_windows?, #styled_array, #styled_error, #styled_hash, #styled_header, #update_git_remote, #with_tty
Constructor Details
#initialize(args = [], options = {}) ⇒ Base
Returns a new instance of Base.
15 16 17 18 |
# File 'lib/pebbles/command/base.rb', line 15 def initialize(args=[], ={}) @args = args = end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
12 13 14 |
# File 'lib/pebbles/command/base.rb', line 12 def args @args end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/pebbles/command/base.rb', line 13 def end |
Class Method Details
.namespace ⇒ Object
8 9 10 |
# File 'lib/pebbles/command/base.rb', line 8 def self.namespace self.to_s.split("::").last.downcase end |
Instance Method Details
#api ⇒ Object
38 39 40 |
# File 'lib/pebbles/command/base.rb', line 38 def api Pebbles::Auth.api end |
#app ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pebbles/command/base.rb', line 20 def app @app ||= Pebbles.app_name = if [:confirm].is_a?(String) if [:app] && ([:app] != [:confirm]) error("Mismatch between --app and --confirm") end [:confirm] elsif [:app].is_a?(String) [:app] elsif ENV.has_key?('PEBBLES_APP') ENV['PEBBLES_APP'] elsif app_from_dir = extract_app_in_dir(Dir.pwd) app_from_dir else # raise instead of using error command to enable rescuing when app is optional raise Pebbles::Command::CommandFailed.new("No app specified.\nRun this command from an app folder or specify which app to use with --app APP.") unless [:ignore_no_app] end end |