rspec-system 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rspec-system/helpers.rb +0 -7
- data/lib/rspec-system/node_set/vagrant.rb +22 -22
- data/rspec-system.gemspec +1 -1
- metadata +2 -2
data/lib/rspec-system/helpers.rb
CHANGED
@@ -116,14 +116,7 @@ module RSpecSystem::Helpers
|
|
116
116
|
raise "Cannot use system_run with no :command option"
|
117
117
|
end
|
118
118
|
|
119
|
-
log.info("system_run #{options[:c]} on #{options[:n].name} executed")
|
120
119
|
result = ns.run(options)
|
121
|
-
log.info("system_run results:\n" +
|
122
|
-
"-----------------------\n" +
|
123
|
-
"exit_code: #{result[:exit_code]}\n" +
|
124
|
-
"stdout:\n #{result[:stdout]}\n" +
|
125
|
-
"stderr:\n #{result[:stderr]}\n" +
|
126
|
-
"-----------------------\n")
|
127
120
|
|
128
121
|
if block_given?
|
129
122
|
yield(result)
|
@@ -62,13 +62,15 @@ module RSpecSystem
|
|
62
62
|
# @param opts [Hash] options
|
63
63
|
# @return [Hash] a hash containing :exit_code, :stdout and :stderr
|
64
64
|
def run(opts)
|
65
|
-
#log.debug("[Vagrant#run] called with #{opts.inspect}")
|
66
|
-
|
67
65
|
dest = opts[:n].name
|
68
66
|
cmd = opts[:c]
|
69
67
|
|
70
68
|
ssh_channels = RSpec.configuration.ssh_channels
|
71
|
-
|
69
|
+
puts "-----------------"
|
70
|
+
puts "#{dest}$ #{cmd}"
|
71
|
+
result = ssh_exec!(ssh_channels[dest], "cd /tmp && sudo sh -c '#{cmd}'")
|
72
|
+
puts "-----------------"
|
73
|
+
result
|
72
74
|
end
|
73
75
|
|
74
76
|
# Transfer files to a host in the NodeSet.
|
@@ -85,14 +87,13 @@ module RSpecSystem
|
|
85
87
|
source = opts[:sp]
|
86
88
|
dest_path = opts[:dp]
|
87
89
|
|
88
|
-
log.info("[Vagrant#rcp] Transferring files from #{source} to #{dest}:#{dest_path}")
|
89
|
-
|
90
90
|
# Grab a remote path for temp transfer
|
91
91
|
tmpdest = tmppath
|
92
92
|
|
93
93
|
# Do the copy and print out results for debugging
|
94
94
|
cmd = "scp -r -F '#{ssh_config}' '#{source}' #{dest}:#{tmpdest}"
|
95
|
-
|
95
|
+
puts "------------------"
|
96
|
+
puts "localhost$ #{cmd}"
|
96
97
|
r = systemu cmd
|
97
98
|
|
98
99
|
result = {
|
@@ -101,21 +102,12 @@ module RSpecSystem
|
|
101
102
|
:stderr => r[2]
|
102
103
|
}
|
103
104
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
"stdout:\n #{result[:stdout]}\n" +
|
108
|
-
"stderr:\n #{result[:stderr]}\n" +
|
109
|
-
"-----------------------\n")
|
105
|
+
print "#{result[:stdout]}"
|
106
|
+
print "#{result[:stderr]}"
|
107
|
+
puts "Exit code: #{result[:exit_code]}"
|
110
108
|
|
111
109
|
# Now we move the file into their final destination
|
112
110
|
result = run(:n => opts[:d], :c => "mv #{tmpdest} #{dest_path}")
|
113
|
-
log.info("move results:\n" +
|
114
|
-
"-----------------------\n" +
|
115
|
-
"exit_code: #{result[:exit_code]}\n" +
|
116
|
-
"stdout:\n #{result[:stdout]}\n" +
|
117
|
-
"stderr:\n #{result[:stderr]}\n" +
|
118
|
-
"-----------------------\n")
|
119
111
|
if result[:exit_code] == 0
|
120
112
|
return true
|
121
113
|
else
|
@@ -235,19 +227,27 @@ module RSpecSystem
|
|
235
227
|
abort "FAILED: couldn't execute command (ssh.channel.exec)"
|
236
228
|
end
|
237
229
|
channel.on_data do |ch,data|
|
238
|
-
|
230
|
+
d = data
|
231
|
+
print d
|
232
|
+
r[:stdout]+=d
|
239
233
|
end
|
240
234
|
|
241
235
|
channel.on_extended_data do |ch,type,data|
|
242
|
-
|
236
|
+
d = data
|
237
|
+
print d
|
238
|
+
r[:stderr]+=d
|
243
239
|
end
|
244
240
|
|
245
241
|
channel.on_request("exit-status") do |ch,data|
|
246
|
-
|
242
|
+
c = data.read_long
|
243
|
+
puts "Exit code: #{c}"
|
244
|
+
r[:exit_code] = c
|
247
245
|
end
|
248
246
|
|
249
247
|
channel.on_request("exit-signal") do |ch, data|
|
250
|
-
|
248
|
+
s = data.read_string
|
249
|
+
puts "Exit signal: #{s}"
|
250
|
+
r[:exit_signal] = s
|
251
251
|
end
|
252
252
|
end
|
253
253
|
end
|
data/rspec-system.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|