Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. namespace :rails do
  2. desc "Open the rails console"
  3. task :console do
  4. on roles(:app) do
  5. rails_env = fetch(:rails_env, 'production')
  6. execute_interactively "$HOME/.rbenv/bin/rbenv exec bundle exec rails console #{rails_env}"
  7. end
  8. end
  9.  
  10. desc "Open the rails dbconsole"
  11. task :dbconsole do
  12. on roles(:app) do
  13. rails_env = fetch(:rails_env, 'production')
  14. execute_interactively "$HOME/.rbenv/bin/rbenv exec bundle exec rails dbconsole #{rails_env}"
  15. end
  16. end
  17.  
  18. def execute_interactively(command)
  19. user = fetch(:user)
  20. port = fetch(:port) || 22
  21. exec "ssh -l #{user} #{host} -p #{port} -t 'cd #{deploy_to}/current && #{command}'"
  22. end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement