Skip to content

Instantly share code, notes, and snippets.

@col
Forked from benedikt/rails.rb
Created January 31, 2013 04:43
Show Gist options
  • Save col/4680270 to your computer and use it in GitHub Desktop.
Save col/4680270 to your computer and use it in GitHub Desktop.
# 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