rake-remote_task 2.3.1 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81fc5d41e6cb0acdcb42a4192aa37ea1eac7beb5
4
- data.tar.gz: f6e8d8ecb671f8715ad46e8fb2274b6edc835821
3
+ metadata.gz: 76f04d16354fd0bdfccbf7aff579040f6c5f2feb
4
+ data.tar.gz: e4f9ac41686827279b5947e3236213a1da827bf4
5
5
  SHA512:
6
- metadata.gz: 31fd46533b666e7649e77b6993574dbdf006c4d3710afce544629d4523bb490bf28cca403bd584df9f3b380f097751fa54ea4949b1df5be2a472f38e02f56d83
7
- data.tar.gz: 0bd41871eff9f9d17440069a482b35c34353810ccd91fe15a27ae9d3e063a044d2bce49c4546b77eb2d4443c77113a60b383410ae5bb0513ad590e3951b8fafb
6
+ metadata.gz: 7bb3675dcc68469e99874523382e4a2e21ac7ce2d6c242ef41b4e05218858966d6aba1365631adf1c9ac3b788766636b1afe5819e0aa19efb5723bddd8e703b3
7
+ data.tar.gz: 9df138b82600285c4df4b89212e8d0eba7a00ea090b25e51d8cd9abc28099e8a41d2aa5b96c8041f90466ed20a5ee2a26478152eebcb9c838964fb2df3033565
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 2.4.0 / 2016-08-01
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Add optional yield to run. (bhenderson)
6
+
1
7
  === 2.3.1 / 2016-05-16
2
8
 
3
9
  * 1 bug fix:
@@ -45,7 +45,7 @@ end
45
45
 
46
46
  class Rake::RemoteTask < Rake::Task
47
47
 
48
- VERSION = "2.3.1"
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
- assert_equal nil, task.send(:can_set_nil)
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.3.1
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-05-16 00:00:00.000000000 Z
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