diff --git a/CHANGELOG.md b/CHANGELOG.md index ecb8e4a..103548d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Unreleased ### Feature -- Allow to set capistrano role to select server for remote console #33 +- allow to set capistrano role to select server for remote console (#33) +- allow to set shell used on server (#31) ## 2.2.1 (2017-09-04) ### Feature diff --git a/README.md b/README.md index 154522f..9d66a06 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,12 @@ set :console_user, nil # explicitly disable switching user through sudo set :console_role, :app # start remote console on primary server for this role ``` +### Shell + +```ruby +set :console_shell, '/bin/bash' # select shell to be used on server in case you experience problems (see #31) +``` + ## Contributing diff --git a/capistrano-rails-console.gemspec b/capistrano-rails-console.gemspec index 19ca091..ed51416 100644 --- a/capistrano-rails-console.gemspec +++ b/capistrano-rails-console.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'capistrano', '>= 3.5.0', '< 4.0.0' - spec.add_dependency 'sshkit-interactive', '~> 0.2.0' + spec.add_dependency 'sshkit-interactive', '~> 0.3.0' spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' diff --git a/lib/capistrano/rails/console/tasks.cap b/lib/capistrano/rails/console/tasks.cap index f8bfa99..f15cc28 100644 --- a/lib/capistrano/rails/console/tasks.cap +++ b/lib/capistrano/rails/console/tasks.cap @@ -7,9 +7,10 @@ namespace :load do end # Default values - set :console_env, -> { fetch(:rails_env, fetch(:stage, 'production')) } - set :console_user, -> { fetch(:app_user, nil) } - set :console_role, :app + set :console_env, -> { fetch(:rails_env, fetch(:stage, 'production')) } + set :console_user, -> { fetch(:app_user, nil) } + set :console_role, :app + set :console_shell, nil end end @@ -19,7 +20,7 @@ namespace :rails do args = [] args << '--sandbox' if ENV.key?('sandbox') || ENV.key?('s') - run_interactively primary(fetch(:console_role)) do + run_interactively primary(fetch(:console_role)), shell: fetch(:console_shell) do within current_path do as user: fetch(:console_user) do execute(:rails, :console, fetch(:console_env), *args) @@ -30,7 +31,7 @@ namespace :rails do desc 'Interact with a remote rails dbconsole' task :dbconsole do - run_interactively primary(fetch(:console_role)) do + run_interactively primary(fetch(:console_role)), shell: fetch(:console_shell) do within current_path do as user: fetch(:console_user) do execute(:rails, :dbconsole, '-p', '-e', fetch(:console_env))