photocopier 0.0.5 → 0.0.6

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- photocopier (0.0.4)
4
+ photocopier (0.0.5)
5
5
  activesupport
6
6
  escape
7
7
  i18n
@@ -12,18 +12,18 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (3.2.9)
15
+ activesupport (3.2.12)
16
16
  i18n (~> 0.6)
17
17
  multi_json (~> 1.0)
18
18
  diff-lcs (1.1.3)
19
19
  escape (0.0.4)
20
- i18n (0.6.1)
21
- multi_json (1.4.0)
22
- net-scp (1.0.4)
23
- net-ssh (>= 1.99.1)
24
- net-ssh (2.6.2)
25
- net-ssh-gateway (1.1.0)
26
- net-ssh (>= 1.99.1)
20
+ i18n (0.6.4)
21
+ multi_json (1.7.0)
22
+ net-scp (1.1.0)
23
+ net-ssh (>= 2.6.5)
24
+ net-ssh (2.6.6)
25
+ net-ssh-gateway (1.2.0)
26
+ net-ssh (>= 2.6.5)
27
27
  rspec (2.11.0)
28
28
  rspec-core (~> 2.11.0)
29
29
  rspec-expectations (~> 2.11.0)
data/README.md CHANGED
@@ -48,8 +48,8 @@ ssh.get_directory('remote_dir', './local_dir')
48
48
  # and viceversa
49
49
  ssh.put_directory('./local_dir', 'remote_dir')
50
50
 
51
- # execs a command and waits for the result, returns output and exit code
52
- ssh.exec!('pwd') # => [ "/home/128423/users/.home\n", 0 ]
51
+ # execs a command and waits for the result, returns stdout, stderr and exit code
52
+ ssh.exec!('pwd') # => [ "/home/128423/users/.home\n", "", 0 ]
53
53
  ```
54
54
  The very same commands are valid for the `Photocopier::FTP` adapter.
55
55
 
@@ -51,15 +51,24 @@ module Photocopier
51
51
  end
52
52
 
53
53
  def exec!(cmd)
54
- result = ""
54
+ stdout = ""
55
+ stderr = ""
55
56
  exit_code = nil
56
- session.exec!(cmd) do |ch, type, data|
57
- result << data
58
- ch.on_request("exit-status") do |ch, data|
59
- exit_code = data.read_long
57
+ session.open_channel do |channel|
58
+ channel.exec(cmd) do |ch, success|
59
+ channel.on_data do |ch, data|
60
+ stdout << data
61
+ end
62
+ channel.on_extended_data do |ch, type, data|
63
+ stderr << data
64
+ end
65
+ channel.on_request("exit-status") do |ch, data|
66
+ exit_code = data.read_long
67
+ end
60
68
  end
61
69
  end
62
- [ result, exit_code ]
70
+ session.loop
71
+ [ stdout, stderr, exit_code ]
63
72
  end
64
73
 
65
74
  private
@@ -1,3 +1,3 @@
1
1
  module Photocopier
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photocopier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: