class Capistrano::Remote::Runner
The primary interface for actually running tasks on a remote host.
Attributes
host[R]
Public Class Methods
new(host)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 7 def initialize(host) @host = host end
Public Instance Methods
rails(command)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 15 def rails(command) run_interactively(in_current_path(rails_command(command))) end
rake(task)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 11 def rake(task) run_interactively(in_current_path(rake_command(task))) end
Private Instance Methods
bundle_command()
click to toggle source
# File lib/capistrano/remote/runner.rb, line 21 def bundle_command fetch(:bundle_command, SSHKit.config.command_map[:bundle]) end
hostname()
click to toggle source
# File lib/capistrano/remote/runner.rb, line 25 def hostname host.hostname end
in_current_path(command)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 29 def in_current_path(command) "cd #{current_path} && #{command}" end
rails_command(command)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 33 def rails_command(command) "#{bundle_command} exec rails #{command}" end
rake_command(arguments)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 37 def rake_command(arguments) command = fetch(:rake_command, SSHKit.config.command_map[:rake]) "#{command} #{arguments}" end
run_interactively(remote_command)
click to toggle source
# File lib/capistrano/remote/runner.rb, line 42 def run_interactively(remote_command) parts = [ 'ssh', (user ? "-l #{user}" : nil), hostname, "-t #{Shellwords.escape(remote_command)}" ] local_command = parts.compact.join(' ') exec local_command end
user()
click to toggle source
# File lib/capistrano/remote/runner.rb, line 53 def user fetch(:user, host.user) end