rake-remote_task 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/lib/rake/remote_task.rb +5 -1
- data/test/test_rake_remote_task.rb +36 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76f04d16354fd0bdfccbf7aff579040f6c5f2feb
|
4
|
+
data.tar.gz: e4f9ac41686827279b5947e3236213a1da827bf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bb3675dcc68469e99874523382e4a2e21ac7ce2d6c242ef41b4e05218858966d6aba1365631adf1c9ac3b788766636b1afe5819e0aa19efb5723bddd8e703b3
|
7
|
+
data.tar.gz: 9df138b82600285c4df4b89212e8d0eba7a00ea090b25e51d8cd9abc28099e8a41d2aa5b96c8041f90466ed20a5ee2a26478152eebcb9c838964fb2df3033565
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/rake/remote_task.rb
CHANGED
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
class Rake::RemoteTask < Rake::Task
|
47
47
|
|
48
|
-
VERSION = "2.
|
48
|
+
VERSION = "2.4.0"
|
49
49
|
|
50
50
|
@@current_roles = []
|
51
51
|
|
@@ -172,6 +172,8 @@ class Rake::RemoteTask < Rake::Task
|
|
172
172
|
#
|
173
173
|
# If +command_prefix+ has been filled up with one or several commands, they
|
174
174
|
# will be run on target_host before +command+.
|
175
|
+
#
|
176
|
+
# Yields input channel, :out or :err, and data.
|
175
177
|
|
176
178
|
def run command
|
177
179
|
commands = []
|
@@ -224,6 +226,8 @@ class Rake::RemoteTask < Rake::Task
|
|
224
226
|
$stderr.write "\n"
|
225
227
|
end
|
226
228
|
|
229
|
+
yield inn, stream == out ? :out : :err, data if block_given?
|
230
|
+
|
227
231
|
result << data
|
228
232
|
end
|
229
233
|
end
|
@@ -45,7 +45,7 @@ class TestRakeRemoteTask < Rake::TestCase
|
|
45
45
|
set :can_set_nil, nil
|
46
46
|
set :lies_are, false
|
47
47
|
|
48
|
-
|
48
|
+
assert_nil task.send(:can_set_nil)
|
49
49
|
|
50
50
|
assert_equal false, task.send(:lies_are)
|
51
51
|
assert_equal false, Rake::RemoteTask.fetch(:lies_are)
|
@@ -248,6 +248,41 @@ class TestRakeRemoteTask < Rake::TestCase
|
|
248
248
|
assert_equal "Password:\n", err
|
249
249
|
end
|
250
250
|
|
251
|
+
def test_run_with_block
|
252
|
+
util_setup_task
|
253
|
+
@task.output << "file1\nfile2\n"
|
254
|
+
@task.error << 'Enter Password:'
|
255
|
+
@task.target_host = "app.example.com"
|
256
|
+
result = nil
|
257
|
+
|
258
|
+
out, err = capture_io do
|
259
|
+
result = @task.run("./command/with/input") do |input, stream, data|
|
260
|
+
if stream == :out and data == "file1\nfile2\n"
|
261
|
+
input << "myinput\n"
|
262
|
+
elsif stream == :err and data == "Enter Password:"
|
263
|
+
input << "mysecret\n"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
commands = @task.commands
|
269
|
+
|
270
|
+
assert_equal 1, commands.size, 'not enough commands'
|
271
|
+
assert_equal ['ssh', 'app.example.com', './command/with/input'],
|
272
|
+
commands.first
|
273
|
+
|
274
|
+
assert_equal "myinput\nmysecret\n", @task.input.string
|
275
|
+
|
276
|
+
# WARN: Technically incorrect, the password line should be
|
277
|
+
# first... this is an artifact of changes to the IO code in run
|
278
|
+
# and the fact that we have a very simplistic (non-blocking)
|
279
|
+
# testing model.
|
280
|
+
assert_equal "file1\nfile2\nEnter Password:", result
|
281
|
+
|
282
|
+
assert_equal "file1\nfile2\n", out
|
283
|
+
assert_equal "Enter Password:", err
|
284
|
+
end
|
285
|
+
|
251
286
|
def test_sudo
|
252
287
|
util_setup_task
|
253
288
|
@task.target_host = "app.example.com"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-remote_task
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
|
32
32
|
NLq5jm1fq6Y9Uolu3RJbmycf
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|