-
-
Save col/4680270 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
# encoding: UTF-8 | |
namespace :rails do | |
desc "Remote console" | |
task :console, :roles => :app do | |
run_interactively "bundle exec rails console #{rails_env}" | |
end | |
desc "Remote dbconsole" | |
task :dbconsole, :roles => :app do | |
run_interactively "bundle exec rails dbconsole #{rails_env}" | |
end | |
end | |
def run_interactively(command, server=nil) | |
server ||= find_servers_for_task(current_task).first | |
exec "ssh -l #{user} #{server.host} -t 'source ~/.bash_profile && cd #{deploy_to}/current && #{command}'" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment