mirror of
https://gitlab.com/ydkn/capistrano-rails-console.git
synced 2023-02-13 20:54:14 -05:00
switch to sshkit-interactive
This commit is contained in:
parent
9fa55b0262
commit
b9eae8c8dc
7 changed files with 28 additions and 11 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Changed
|
### Changed
|
||||||
- switched connection part to _capistrano-interactive_
|
- switched connection part to _sshkit-interactive_
|
||||||
|
- allow setting rails environment separately deployment environment
|
||||||
|
- allow setting user to run rails console separately from ssh user
|
||||||
|
|
||||||
## 1.0.2 (2015-12-06)
|
## 1.0.2 (2015-12-06)
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
14
README.md
14
README.md
|
@ -43,6 +43,20 @@ You can also start a sandbox session:
|
||||||
|
|
||||||
$ cap production rails:console sandbox=1
|
$ cap production rails:console sandbox=1
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
### Rails environment
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
set :console_env, :production
|
||||||
|
```
|
||||||
|
|
||||||
|
### User
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
set :console_user, :appuser
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,9 @@ Gem::Specification.new do |spec|
|
||||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||||
spec.require_paths = ['lib']
|
spec.require_paths = ['lib']
|
||||||
|
|
||||||
spec.add_dependency 'capistrano', '>= 3.1.0', '< 4.0.0'
|
spec.add_dependency 'capistrano', '>= 3.5.0', '< 4.0.0'
|
||||||
spec.add_dependency 'capistrano-interactive', '~> 0.2.0'
|
spec.add_dependency 'sshkit-interactive', '~> 0.2.0'
|
||||||
|
|
||||||
spec.add_dependency 'sshkit', '>= 1.4'
|
|
||||||
|
|
||||||
spec.add_development_dependency 'bundler'
|
spec.add_development_dependency 'bundler'
|
||||||
spec.add_development_dependency 'rake'
|
spec.add_development_dependency 'rake'
|
||||||
spec.add_development_dependency 'yard'
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
require 'capistrano/rails/console'
|
|
@ -1,3 +1,3 @@
|
||||||
require 'capistrano/interactive'
|
require 'sshkit/interactive'
|
||||||
|
|
||||||
load File.expand_path('../tasks/remote.cap', __FILE__)
|
load File.expand_path('../tasks/remote.cap', __FILE__)
|
||||||
|
|
|
@ -4,7 +4,8 @@ namespace :load do
|
||||||
set :rvm_map_bins, fetch(:rvm_map_bins, []).push(:rails)
|
set :rvm_map_bins, fetch(:rvm_map_bins, []).push(:rails)
|
||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
set :console_env, -> { fetch(:rails_env, fetch(:stage, 'production')) }
|
set :console_env, -> { fetch(:rails_env, fetch(:stage, 'production')) }
|
||||||
|
set :console_user, -> { fetch(:app_user, nil) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -14,9 +15,11 @@ namespace :rails do
|
||||||
args = []
|
args = []
|
||||||
args << '--sandbox' if ENV.key?('sandbox') || ENV.key?('s')
|
args << '--sandbox' if ENV.key?('sandbox') || ENV.key?('s')
|
||||||
|
|
||||||
on primary(:app) do
|
run_interactively primary(:app) do
|
||||||
within current_path do
|
within current_path do
|
||||||
interact(:rails, :console, fetch(:console_env), *args)
|
as user: fetch(:console_user) do
|
||||||
|
execute(:rails, :console, fetch(:console_env), *args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Capistrano
|
||||||
# Console
|
# Console
|
||||||
module Console
|
module Console
|
||||||
# Gem version
|
# Gem version
|
||||||
VERSION = '1.1.0'
|
VERSION = '2.0.0'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue