Class: Azuki::Command::Run

Inherits:
Base
  • Object
show all
Defined in:
lib/azuki/command/run.rb

Overview

run one-off commands (console, rake)

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#api, #app, #azuki, #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, #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 Azuki::Command::Base

Instance Method Details

#consoleObject

run:console [COMMAND]

open a remote console session

if COMMAND is specified, run the command and exit

NOTE: For Cedar apps, use ‘azuki run console`

Examples:

$ azuki console Ruby console for example.azukiapp.com >>



93
94
95
96
97
98
99
# File 'lib/azuki/command/run.rb', line 93

def console
  puts "`azuki #{current_command}` has been removed. Please use: `azuki run` instead."
  puts "For more information, please see:"
  puts " * https://devcenter.azukiapp.com/articles/one-off-dynos"
  puts " * https://devcenter.azukiapp.com/articles/rails3#console"
  puts " * https://devcenter.azukiapp.com/articles/console-bamboo"
end

#detachedObject

run:detached COMMAND

run a detached process, where output is sent to your logs

-t, –tail # stream logs for the process

Example:

$ azuki run:detached ls Running ‘ls` detached… up, run.1 Use `azuki logs -p run.1` to view the output.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/azuki/command/run.rb', line 37

def detached
  command = args.join(" ")
  error("Usage: azuki run COMMAND") if command.empty?
  opts = { :attach => false, :command => command }
  app_name = app
  process_data = action("Running `#{command}` detached", :success => "up") do
    process_data = api.post_ps(app_name, command, { :attach => false }).body
    status(process_data['process'])
    process_data
  end
  if options[:tail]
    opts = []
    opts << "tail=1"
    opts << "ps=#{process_data['process']}"
    log_displayer = ::Azuki::Helpers::LogDisplayer.new(azuki, app, opts)
    log_displayer.display_logs
  else
    display("Use `azuki logs -p #{process_data['process']}` to view the output.")
  end
end

#indexObject

run COMMAND

run an attached process

Example:

$ azuki run bash Running ‘bash` attached to terminal… up, run.1 ~ $



19
20
21
22
23
# File 'lib/azuki/command/run.rb', line 19

def index
  command = args.join(" ")
  error("Usage: azuki run COMMAND") if command.empty?
  run_attached(command)
end

#rakeObject

run:rake COMMAND

WARNING: ‘azuki run:rake` has been deprecated. Please use `azuki run rake` instead.“

remotely execute a rake command

Example:

$ azuki run:rake -T Running ‘rake -T` attached to terminal… up, run.1 (in /app) rake test # run tests



71
72
73
74
75
# File 'lib/azuki/command/run.rb', line 71

def rake
  deprecate("`azuki #{current_command}` has been deprecated. Please use `azuki run rake` instead.")
  command = "rake #{args.join(' ')}"
  run_attached(command)
end