capistrano-interactive 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +0 -2
- data/capistrano-interactive.gemspec +2 -2
- data/lib/capistrano/interactive/task.cap +6 -0
- data/lib/capistrano/interactive/version.rb +4 -1
- data/lib/capistrano/interactive.rb +2 -4
- metadata +7 -8
- data/lib/capistrano/interactive/backend_hook.rb +0 -36
- data/lib/capistrano/interactive/command.rb +0 -70
- data/lib/capistrano/interactive/dsl.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 883996c87061d05bc2199b5220de202381b8c02c
|
4
|
+
data.tar.gz: 1e59d44910cf0e15b0fae28c939a6fecda0fb2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c9945665b9604c15f8e1bd4101942c865174cc82d060a6a73d5b7e26ffecebd1896d80f1f441699dbd7d8a671a937c561768e11f11336f7dce085ac3263a55f
|
7
|
+
data.tar.gz: 22ee85b3deb1d1747554acd6e99aa0a1974150ce34592e6eb3452e8819f802b69083fe77c3ba23507a2f8b8ca44237fb24906438d26cd0b1cbea942be7cbd453
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'capistrano',
|
23
|
-
spec.add_dependency 'sshkit',
|
22
|
+
spec.add_dependency 'capistrano', '>= 3.1.0', '< 4.0.0'
|
23
|
+
spec.add_dependency 'sshkit-interact', '~> 0.1.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require '
|
2
|
-
require 'capistrano/interactive/backend_hook'
|
1
|
+
require 'sshkit/interact'
|
3
2
|
|
4
|
-
|
5
|
-
include Capistrano::Interactive::DSL
|
3
|
+
load File.expand_path('../task.cap', __FILE__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -31,19 +31,19 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 4.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: sshkit
|
34
|
+
name: sshkit-interact
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 1.
|
39
|
+
version: 0.1.0
|
40
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: 1.
|
46
|
+
version: 0.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,7 @@ extensions: []
|
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
82
|
- ".gitignore"
|
83
|
+
- CHANGELOG.md
|
83
84
|
- Gemfile
|
84
85
|
- LICENSE.txt
|
85
86
|
- README.md
|
@@ -88,9 +89,7 @@ files:
|
|
88
89
|
- bin/setup
|
89
90
|
- capistrano-interactive.gemspec
|
90
91
|
- lib/capistrano/interactive.rb
|
91
|
-
- lib/capistrano/interactive/
|
92
|
-
- lib/capistrano/interactive/command.rb
|
93
|
-
- lib/capistrano/interactive/dsl.rb
|
92
|
+
- lib/capistrano/interactive/task.cap
|
94
93
|
- lib/capistrano/interactive/version.rb
|
95
94
|
homepage: https://github.com/ydkn/capistrano-interactive
|
96
95
|
licenses:
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Capistrano
|
2
|
-
module Interactive
|
3
|
-
module BackendHook
|
4
|
-
def self.included(base)
|
5
|
-
base.class_eval do
|
6
|
-
alias_method :non_interactive_execute, :execute
|
7
|
-
def execute(*args)
|
8
|
-
if BackendHook.intercept_command?
|
9
|
-
BackendHook.last_command = command(*args)
|
10
|
-
else
|
11
|
-
non_interactive_execute(*args)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.intercept_command!
|
18
|
-
@intercept_command = true
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.intercept_command?
|
22
|
-
!!@intercept_command
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.last_command
|
26
|
-
@last_command
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def self.last_command=(cmd)
|
32
|
-
@last_command = cmd
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module Capistrano
|
2
|
-
module Interactive
|
3
|
-
class Command
|
4
|
-
def initialize(host, command)
|
5
|
-
@host = host
|
6
|
-
@command = command
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_cmd
|
10
|
-
[
|
11
|
-
:ssh,
|
12
|
-
*ssh_cmd_args,
|
13
|
-
@host.hostname,
|
14
|
-
%Q{'$SHELL -l -c "#{@command.to_command}"'}
|
15
|
-
].join(' ')
|
16
|
-
end
|
17
|
-
|
18
|
-
def execute
|
19
|
-
exec(to_cmd)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def ssh_option(attr_name)
|
25
|
-
(@host.netssh_options || {})[attr_name] || (@host.respond_to?(attr_name) ? @host.send(attr_name) : nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
def host_name
|
29
|
-
ssh_option(:host_name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def port
|
33
|
-
ssh_option(:port)
|
34
|
-
end
|
35
|
-
|
36
|
-
def user
|
37
|
-
ssh_option(:user)
|
38
|
-
end
|
39
|
-
|
40
|
-
def forward_agent?
|
41
|
-
!!ssh_option(:forward_agent)
|
42
|
-
end
|
43
|
-
|
44
|
-
def proxy_command
|
45
|
-
ssh_option(:proxy) ? ssh_option(:proxy).command_line_template : nil
|
46
|
-
end
|
47
|
-
|
48
|
-
def keys
|
49
|
-
Array(ssh_option(:keys))
|
50
|
-
end
|
51
|
-
|
52
|
-
def ssh_cmd_args
|
53
|
-
args = []
|
54
|
-
|
55
|
-
args << '-t'
|
56
|
-
args << '-A' if forward_agent?
|
57
|
-
args << "-p #{port}" if port
|
58
|
-
args << "-l #{user}"
|
59
|
-
args << %Q{-o "ProxyCommand #{proxy_command}"} if proxy_command
|
60
|
-
args << %Q{-o "HostName #{host_name}"} if host_name
|
61
|
-
|
62
|
-
keys.each do |key|
|
63
|
-
args << "-i #{key}"
|
64
|
-
end
|
65
|
-
|
66
|
-
args
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'capistrano/interactive/command'
|
2
|
-
|
3
|
-
module Capistrano
|
4
|
-
module Interactive
|
5
|
-
module DSL
|
6
|
-
def interact(*args)
|
7
|
-
Capistrano::Interactive::BackendHook.intercept_command!
|
8
|
-
execute(*args)
|
9
|
-
Capistrano::Interactive::Command.new(host, Capistrano::Interactive::BackendHook.last_command).execute
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|