Class: Heroku::Command::Run
Overview
run one-off commands (console, rake)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#console ⇒ Object
run:console [COMMAND].
-
#detached ⇒ Object
run:detached COMMAND.
-
#index ⇒ Object
run COMMAND.
-
#rake ⇒ Object
run:rake COMMAND.
Methods inherited from Base
#api, #app, #heroku, #initialize, namespace
Methods included from Helpers
#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #host_name, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty
Constructor Details
This class inherits a constructor from Heroku::Command::Base
Instance Method Details
#console ⇒ Object
run:console [COMMAND]
open a remote console session
if COMMAND is specified, run the command and exit
NOTE: For Cedar apps, use ‘pogo run console`
Examples:
$ pogo console Ruby console for example.heroku.com >>
98 99 100 101 102 103 104 |
# File 'lib/heroku/command/run.rb', line 98 def console puts "`pogo #{current_command}` has been removed. Please use: `pogo run` instead." puts "For more information, please see:" puts " * https://devcenter.heroku.com/articles/one-off-dynos" puts " * https://devcenter.heroku.com/articles/rails3#console" puts " * https://devcenter.heroku.com/articles/console-bamboo" end |
#detached ⇒ Object
run:detached COMMAND
run a detached dyno, where output is sent to your logs
-s, –size SIZE # specify dyno size -t, –tail # stream logs for the dyno
Example:
$ pogo run:detached ls Running ‘ls` detached… up, run.1 Use `pogo logs -p run.1` to view the output.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/heroku/command/run.rb', line 40 def detached command = args.join(" ") error("Usage: pogo run COMMAND") if command.empty? opts = { :attach => false, :command => command } opts[:size] = get_size if [:size] app_name = app process_data = action("Running `#{command}` detached", :success => "up") do process_data = api.post_ps(app_name, command, opts).body status(process_data['process']) process_data end if [:tail] opts = [] opts << "tail=1" opts << "ps=#{process_data['process']}" log_displayer = ::Heroku::Helpers::LogDisplayer.new(heroku, app, opts) log_displayer.display_logs else display("Use `pogo logs -p #{process_data['process']}` to view the output.") end end |
#index ⇒ Object
run COMMAND
run an attached dyno
-s, –size SIZE # specify dyno size
Example:
$ pogo run bash Running ‘bash` attached to terminal… up, run.1 ~ $
21 22 23 24 25 |
# File 'lib/heroku/command/run.rb', line 21 def index command = args.join(" ") error("Usage: pogo run COMMAND") if command.empty? run_attached(command) end |
#rake ⇒ Object
run:rake COMMAND
WARNING: ‘pogo run:rake` has been deprecated. Please use `pogo run rake` instead.“
remotely execute a rake command
Example:
$ pogo run:rake -T Running ‘rake -T` attached to terminal… up, run.1 (in /app) rake test # run tests
76 77 78 79 80 |
# File 'lib/heroku/command/run.rb', line 76 def rake deprecate("`pogo #{current_command}` has been deprecated. Please use `pogo run rake` instead.") command = "rake #{args.join(' ')}" run_attached(command) end |