Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace :rails do
- desc "Open the rails console"
- task :console do
- on roles(:app) do
- rails_env = fetch(:rails_env, 'production')
- execute_interactively "$HOME/.rbenv/bin/rbenv exec bundle exec rails console #{rails_env}"
- end
- end
- desc "Open the rails dbconsole"
- task :dbconsole do
- on roles(:app) do
- rails_env = fetch(:rails_env, 'production')
- execute_interactively "$HOME/.rbenv/bin/rbenv exec bundle exec rails dbconsole #{rails_env}"
- end
- end
- def execute_interactively(command)
- user = fetch(:user)
- port = fetch(:port) || 22
- exec "ssh -l #{user} #{host} -p #{port} -t 'cd #{deploy_to}/current && #{command}'"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement