Skip to content

Instantly share code, notes, and snippets.

@ej2015
Forked from joost/deploy.rb
Created October 10, 2018 09:12
Show Gist options
  • Save ej2015/78a7ad5ef33e34e6712c1eb084bc34d7 to your computer and use it in GitHub Desktop.
Save ej2015/78a7ad5ef33e34e6712c1eb084bc34d7 to your computer and use it in GitHub Desktop.
Capistrano 3 rails console tasks
# encoding: UTF-8
Capistrano::Configuration.instance(:must_exist).load do
namespace :rails do
desc "Open the rails console on one of the remote servers"
task :console, :roles => :app do
hostname = find_servers_for_task(current_task).first
exec "ssh -l #{user} #{hostname} 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment