capistrano-rails-console 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28df9dd56e64741c6c5fbf00e96e0657ec1ee9dc
4
- data.tar.gz: b0f6f288d6a2e6cc3a3c4ab89ca469721d572ebb
3
+ metadata.gz: bd5df65487ade200f469b97095907831ec9ce960
4
+ data.tar.gz: 1389b6f30993c23c59ba439e95bbe633c708845d
5
5
  SHA512:
6
- metadata.gz: fe29712b0796ee81a00c1ae34302de5eb892430a52ca36eb7663a72adbc8a0c78cf80d110e4c0daf645b0073155ebd010f26187e2911674d1e67f7cd02ed3bf0
7
- data.tar.gz: a8819ba78eb4d1b7c82a58a413f4e0fd5a8cf5c08e0e686458cfef5079c72c3e59752bce77258b0dbf8aace13ee71da64b5c8907535c66e7185c13a0e03aa146
6
+ metadata.gz: 06c86499b33afc6e11bc4085f3a4666b5a913632a9a5a530b94155ce12bfc3b86430765cf2498966147fceef6d2f260d8ec5da7777432fc50617bce855174d57
7
+ data.tar.gz: 0464abcce5528d84e45d475dfacb575029f90218d415293ca888e2bf6cf7efda899968cdaf087d751bb4a7a7a263bb0e52f27c08fb866fcfbec16119ac5f4d4a
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.0.0 (2016-09-16)
4
+ ### Changed
5
+ - switched connection part to _sshkit-interactive_
6
+ - allow setting rails environment separately deployment environment
7
+ - allow setting user to run rails console separately from ssh user
8
+
3
9
  ## 1.0.2 (2015-12-06)
4
10
  ### Fixed
5
11
  - works with sshkit 1.8
data/README.md CHANGED
@@ -43,6 +43,20 @@ You can also start a sandbox session:
43
43
 
44
44
  $ cap production rails:console sandbox=1
45
45
 
46
+ ## Options
47
+
48
+ ### Rails environment
49
+
50
+ ```ruby
51
+ set :console_env, :production
52
+ ```
53
+
54
+ ### User
55
+
56
+ ```ruby
57
+ set :console_user, :appuser
58
+ ```
59
+
46
60
 
47
61
  ## Contributing
48
62
 
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'capistrano', '>= 3.1.0', '< 4.0.0'
21
+ spec.add_dependency 'capistrano', '>= 3.5.0', '< 4.0.0'
22
+ spec.add_dependency 'sshkit-interactive', '~> 0.2.0'
22
23
 
23
24
  spec.add_development_dependency 'bundler'
24
25
  spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'yard'
26
26
  end
@@ -0,0 +1 @@
1
+ require 'capistrano/rails/console'
@@ -1 +1,3 @@
1
+ require 'sshkit/interactive'
2
+
1
3
  load File.expand_path('../tasks/remote.cap', __FILE__)
@@ -1,54 +1,26 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
- # add rails to rvm_map_bins
3
+ # Add rails to rvm_map_bins
4
4
  set :rvm_map_bins, fetch(:rvm_map_bins, []).push(:rails)
5
+
6
+ # Default values
7
+ set :console_env, -> { fetch(:rails_env, fetch(:stage, 'production')) }
8
+ set :console_user, -> { fetch(:app_user, nil) }
5
9
  end
6
10
  end
7
11
 
8
12
  namespace :rails do
9
13
  desc 'Interact with a remote rails console'
10
14
  task :console do
11
- on primary :app do |host|
12
- test(:true) # initialize ssh_options on host
13
-
14
- ssh_cmd_args = []
15
- rails_console_args = []
16
-
17
- if host.ssh_options && host.ssh_options[:proxy]
18
- template = host.ssh_options[:proxy].command_line_template
19
- ssh_cmd_args << "-o ProxyCommand=\"#{template}\""
20
- end
21
-
22
- if host.ssh_options && host.ssh_options[:host_name]
23
- ssh_cmd_args << "-o HostName=\"#{host.ssh_options[:host_name]}\""
24
- end
25
-
26
- rails_console_args << '--sandbox' if ENV.key?('sandbox') || ENV.key?('s')
27
-
28
- rails_env = fetch(:rails_env, fetch(:stage, 'production'))
29
-
30
- port = host.port || (host.ssh_options || {})[:port]
31
- ssh_cmd_args << "-p #{port}" if port
32
-
33
- ssh_user = if host.ssh_options && host.ssh_options[:user]
34
- host.ssh_options[:user]
35
- else
36
- host.user
37
- end
38
- ssh_cmd_args << [ssh_user, host.hostname].compact.join('@')
39
-
40
- if host.ssh_options && host.ssh_options[:keys] && host.ssh_options[:keys].length > 0
41
- identity = host.ssh_options[:keys][0]
42
- ssh_cmd_args << "-i #{identity}"
15
+ args = []
16
+ args << '--sandbox' if ENV.key?('sandbox') || ENV.key?('s')
17
+
18
+ run_interactively primary(:app) do
19
+ within current_path do
20
+ as user: fetch(:console_user) do
21
+ execute(:rails, :console, fetch(:console_env), *args)
22
+ end
43
23
  end
44
-
45
- cmd = SSHKit::Command.new(:rails, :console, rails_env, *rails_console_args, host: host)
46
-
47
- ssh_cmd = %Q(ssh #{ssh_cmd_args.join(' ')} -t '$SHELL -l -c "cd #{current_path} && (#{cmd.environment_string} #{cmd})"')
48
-
49
- debug("Running #{ssh_cmd} on #{host.hostname}")
50
-
51
- exec(ssh_cmd)
52
24
  end
53
25
  end
54
26
  end
@@ -4,8 +4,8 @@ module Capistrano
4
4
  module Rails
5
5
  # Console
6
6
  module Console
7
- # gem version
8
- VERSION = '1.0.2'
7
+ # Gem version
8
+ VERSION = '2.0.0'
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-rails-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-06 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
19
+ version: 3.5.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 4.0.0
@@ -26,26 +26,26 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.1.0
29
+ version: 3.5.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.0.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: bundler
34
+ name: sshkit-interactive
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :development
39
+ version: 0.2.0
40
+ type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: 0.2.0
47
47
  - !ruby/object:Gem::Dependency
48
- name: rake
48
+ name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
@@ -59,7 +59,7 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
- name: yard
62
+ name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
@@ -111,9 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 2.4.8
114
+ rubygems_version: 2.5.1
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Remote rails console for capistrano
118
118
  test_files: []
119
- has_rdoc: