-
-
Save knoxknox/5d8ad010578ca23a99cc4e1cbf409d4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# cap rails:console | |
# https://gist.github.com/benedikt/1115513#comment-576015 | |
# | |
namespace :rails do | |
desc "Remote console" | |
task :console, roles: :app do | |
run_interactively "bundle exec rails console #{rails_env}" | |
end | |
end | |
def run_interactively(command, server=nil) | |
server ||= find_servers_for_task(current_task).first | |
exec %Q(ssh -l #{user} #{server} -t 'su - #{user} -c "cd #{current_path} && #{command}"') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment