Class: Neetob::CLI::Heroku::Execute
- Defined in:
- lib/neetob/cli/heroku/execute.rb
Constant Summary
Constants inherited from Base
Constants inherited from Base
Instance Attribute Summary collapse
-
#apps ⇒ Object
Returns the value of attribute apps.
-
#command_to_execute ⇒ Object
Returns the value of attribute command_to_execute.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#should_run_in_rails_console ⇒ Object
Returns the value of attribute should_run_in_rails_console.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(apps, command_to_execute, should_run_in_rails_console = false, sandbox = false) ⇒ Execute
constructor
A new instance of Execute.
- #run ⇒ Object
Methods inherited from Base
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize(apps, command_to_execute, should_run_in_rails_console = false, sandbox = false) ⇒ Execute
Returns a new instance of Execute.
11 12 13 14 15 16 17 |
# File 'lib/neetob/cli/heroku/execute.rb', line 11 def initialize(apps, command_to_execute, should_run_in_rails_console = false, sandbox = false) super() @apps = apps @command_to_execute = command_to_execute @should_run_in_rails_console = should_run_in_rails_console @sandbox = sandbox end |
Instance Attribute Details
#apps ⇒ Object
Returns the value of attribute apps.
9 10 11 |
# File 'lib/neetob/cli/heroku/execute.rb', line 9 def apps @apps end |
#command_to_execute ⇒ Object
Returns the value of attribute command_to_execute.
9 10 11 |
# File 'lib/neetob/cli/heroku/execute.rb', line 9 def command_to_execute @command_to_execute end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
9 10 11 |
# File 'lib/neetob/cli/heroku/execute.rb', line 9 def sandbox @sandbox end |
#should_run_in_rails_console ⇒ Object
Returns the value of attribute should_run_in_rails_console.
9 10 11 |
# File 'lib/neetob/cli/heroku/execute.rb', line 9 def should_run_in_rails_console @should_run_in_rails_console end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/neetob/cli/heroku/execute.rb', line 19 def run matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox) rails_runner_command = "rails runner '#{command_to_execute}'" heroku_command = should_run_in_rails_console ? "run \"#{rails_runner_command}\"" : command_to_execute matching_apps.each do |app| ui.info("\n Working on #{app}\n") output = `heroku #{heroku_command} -a #{app}` unless $?.success? ui.error("There is a problem in accessing the app with name \"#{app}\" in your account.") ui.error("Please check the specified app name and ensure you're authorized to view that app.") next end ui.success(output) end end |