thor-ssh 0.1.3 → 0.1.4
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.
- data/lib/thor-ssh/actions.rb +4 -10
- data/lib/thor-ssh/remote_server.rb +6 -3
- data/lib/thor-ssh/version.rb +1 -1
- data/spec/actions_spec.rb +2 -2
- metadata +7 -1
data/lib/thor-ssh/actions.rb
CHANGED
@@ -42,17 +42,11 @@ module ThorSsh
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# Similar to run, but silent and always executes on the remote server
|
45
|
-
def exec(command)
|
46
|
-
return destination_server.run(command)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Similar to run, but silent and always executes on the remote server
|
50
|
-
# Also returns the stderr, exit_code, and exit_signal seperate
|
51
|
-
def exec_with_codes(command)
|
52
|
-
return destination_server.run_with_codes(command)
|
45
|
+
def exec(command, with_codes=false)
|
46
|
+
return destination_server.run(command, with_codes)
|
53
47
|
end
|
54
48
|
|
55
|
-
def run(command, config={})
|
49
|
+
def run(command, with_codes=false, config={})
|
56
50
|
return unless behavior == :invoke
|
57
51
|
|
58
52
|
destination = relative_to_original_destination_root(destination_root, false)
|
@@ -67,7 +61,7 @@ module ThorSsh
|
|
67
61
|
|
68
62
|
unless options[:pretend]
|
69
63
|
# config[:capture] ? `#{command}` : system("#{command}")
|
70
|
-
return exec(command)
|
64
|
+
return exec(command, with_codes)
|
71
65
|
end
|
72
66
|
end
|
73
67
|
|
@@ -20,7 +20,6 @@ module ThorSsh
|
|
20
20
|
abort "FAILED: couldn't execute command (connection.channel.exec)"
|
21
21
|
end
|
22
22
|
channel.on_data do |ch,data|
|
23
|
-
puts data
|
24
23
|
stdout_data += data
|
25
24
|
end
|
26
25
|
|
@@ -43,8 +42,12 @@ module ThorSsh
|
|
43
42
|
return stdout_data, stderr_data, exit_code, exit_signal
|
44
43
|
end
|
45
44
|
|
46
|
-
def run(command)
|
47
|
-
|
45
|
+
def run(command, with_codes=false)
|
46
|
+
if with_codes
|
47
|
+
return run_with_codes(command)
|
48
|
+
else
|
49
|
+
return connection.exec!(command)
|
50
|
+
end
|
48
51
|
end
|
49
52
|
|
50
53
|
end
|
data/lib/thor-ssh/version.rb
CHANGED
data/spec/actions_spec.rb
CHANGED
@@ -99,10 +99,10 @@ describe ThorSsh do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should run exec with an exit code" do
|
102
|
-
stdout, stderr, exit_code, exit_signal = @thor_test.
|
102
|
+
stdout, stderr, exit_code, exit_signal = @thor_test.exec('false', true)
|
103
103
|
exit_code.should == 1
|
104
104
|
|
105
|
-
stdout, stderr, exit_code, exit_signal = @thor_test.
|
105
|
+
stdout, stderr, exit_code, exit_signal = @thor_test.exec('true', true)
|
106
106
|
exit_code.should == 0
|
107
107
|
end
|
108
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thor-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -169,12 +169,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- - ! '>='
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
hash: -4561132812708336947
|
172
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
176
|
none: false
|
174
177
|
requirements:
|
175
178
|
- - ! '>='
|
176
179
|
- !ruby/object:Gem::Version
|
177
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: -4561132812708336947
|
178
184
|
requirements: []
|
179
185
|
rubyforge_project:
|
180
186
|
rubygems_version: 1.8.22
|