octosh 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -60,7 +60,7 @@ There are a few special commands however (IN PROGRESS)…
60
60
 
61
61
  * `put PATH` -- Upload file at PATH to the CWD on the remote hosts
62
62
  * `get FILE` -- Download FILE to the CWD on the local machine. Files will be stored in the format "FILENAME-HOST.EXT"
63
- * `exit` -- Cleanly close the conneciton to all servers and quit OSH
63
+ * `exit` -- Cleanly close the conneciton to all servers and quit OSH
64
64
 
65
65
 
66
66
 
@@ -139,7 +139,10 @@ module Octosh
139
139
  end
140
140
 
141
141
  Parallel.each(workers, :in_threads => workers.length) do |worker|
142
- puts "#{worker.host} -- #{worker.exec(bash)}"
142
+ #puts "#{worker.host} -- #{}"
143
+ worker.exec(bash) do |output|
144
+ puts "#{worker.host} -- #{output}"
145
+ end
143
146
  end
144
147
  end
145
148
 
@@ -161,7 +164,9 @@ module Octosh
161
164
  end
162
165
 
163
166
  Parallel.each(workers, :in_threads => workers.length) do |worker|
164
- puts "#{worker.host} -- #{worker.exec_script(script)}"
167
+ worker.exec_script(script) do |output|
168
+ puts "#{worker.host} -- #{output}"
169
+ end
165
170
  end
166
171
 
167
172
  end
@@ -66,8 +66,9 @@ module Octosh
66
66
  end
67
67
  preprocess_command(command || "")
68
68
  Parallel.each(@workers, :in_threads => @workers.length) do |worker|
69
- output = worker.exec(command) || ""
70
- print output.colorize(worker.options[:color].to_sym)
69
+ output = worker.exec(command) do |output|
70
+ print output.colorize(worker.options[:color].to_sym)
71
+ end
71
72
  end
72
73
  end
73
74
  end
@@ -1,3 +1,3 @@
1
1
  module Octosh
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -56,7 +56,11 @@ module Octosh
56
56
  raise "Error executing #{command}" unless success
57
57
 
58
58
  ch.on_data do |c, data|
59
- return data.to_s
59
+ if block_given?
60
+ yield data.to_s
61
+ else
62
+ puts data.to_s
63
+ end
60
64
  end
61
65
 
62
66
  ch.on_extended_data do |c, type, data|
@@ -91,7 +95,13 @@ module Octosh
91
95
  tmp_script_name = "octosh-#{Pathname.new(script_path).basename.to_s}-#{UUID.new.generate}"
92
96
  self.put(script_path, "/tmp/#{tmp_script_name}")
93
97
  self.exec("chmod +x /tmp/#{tmp_script_name}")
94
- return self.exec("/tmp/#{tmp_script_name}")
98
+ self.exec("/tmp/#{tmp_script_name}") do |output|
99
+ if block_given?
100
+ yield output
101
+ else
102
+ puts output
103
+ end
104
+ end
95
105
  end
96
106
  end
97
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octosh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2012-11-20 00:00:00.000000000 Z
12
+ date: 2012-11-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Octosh
15
15
  email:
@@ -50,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  segments:
52
52
  - 0
53
- hash: 3656941387445534681
53
+ hash: 3777177180090302537
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements: