1
0
Fork 0
mirror of https://gitlab.com/ydkn/capistrano-rails-console.git synced 2023-02-13 20:54:14 -05:00

* add rails to rvm_bin_maps

* cleanup
This commit is contained in:
Florian Schwab 2014-12-18 23:13:53 +01:00
parent 7ff8836943
commit dbe6b8b2a4

View file

@ -1,5 +1,10 @@
def ssh_host(app_server) namespace :load do
[app_server.netssh_options[:user], app_server.hostname].compact.join('@') task :defaults do
# add rails to rvm_map_bins
rvm_map_bins = fetch(:rvm_map_bins) || []
rvm_map_bins << :rails
set :rvm_map_bins, rvm_map_bins
end
end end
namespace :rails do namespace :rails do
@ -7,9 +12,12 @@ namespace :rails do
desc "Interact with a remote rails console" desc "Interact with a remote rails console"
task console: ['deploy:set_rails_env'] do task console: ['deploy:set_rails_env'] do
on primary :app do |host| on primary :app do |host|
ssh_cmd = "ssh #{ssh_host(host)}@#{host.hostname} -p #{host.port || 22}" user_host = [host.user, host.hostname].compact.join('@')
cmd = SSHKit::Command.new(:rails, "console #{fetch :rails_env}") ssh_cmd = "ssh #{user_host} -p #{host.port || 22}"
cmd = SSHKit::Command.new(:rails, "console #{fetch :rails_env}", host: host)
SSHKit.config.output << cmd SSHKit.config.output << cmd
exec %Q(#{ssh_cmd} -t "cd #{current_path} && (#{cmd.environment_string} #{cmd})") exec %Q(#{ssh_cmd} -t "cd #{current_path} && (#{cmd.environment_string} #{cmd})")
end end
end end