weave 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/README.md +12 -0
  2. data/lib/weave.rb +10 -17
  3. data/lib/weave/version.rb +1 -1
  4. data/weave.gemspec +4 -2
  5. metadata +23 -7
data/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  Simple parallel ssh.
4
4
 
5
+ ## Install
6
+
7
+ Put `weave` in your Gemfile or install directly:
8
+
9
+ $ gem install weave
10
+
11
+ ## Documentation
12
+
13
+ [Method docs here](http://rubydoc.info/github/cespare/weave/master/frames). Usage docs coming soon. See the
14
+ examples (in `examples/`) to get started.
15
+
16
+
5
17
  ## Implemented features
6
18
 
7
19
  * Connection caching
@@ -1,21 +1,11 @@
1
1
  require "net/ssh"
2
2
  require "thread"
3
- require "singleton"
4
3
 
5
4
  module Weave
6
5
  DEFAULT_THREAD_POOL_SIZE = 10
7
6
 
8
7
  # @private
9
- COLORS = {
10
- red: 1,
11
- green: 2,
12
- yellow: 3,
13
- blue: 4,
14
- magenta: 5,
15
- cyan: 6,
16
- white: 7,
17
- default: 8
18
- }
8
+ COLORS = { :red => 1, :green => 2 }
19
9
 
20
10
  # Create a connection pool for an array of hosts. Each host must have a user specified (e.g.,
21
11
  # root@example.com). If a block is given, then the options are passed through to the underlying
@@ -34,7 +24,10 @@ module Weave
34
24
  end
35
25
 
36
26
  # @private
37
- def self.color_string(string, color) "\e[01;#{COLORS[color]+30}m#{string}\e[m" end
27
+ def self.color_string(string, color)
28
+ return string unless STDOUT.isatty
29
+ "\e[01;#{COLORS[color]+30}m#{string}\e[m"
30
+ end
38
31
 
39
32
  # Spread work, identified by a key, across multiple threads.
40
33
  # @private
@@ -94,8 +87,8 @@ module Weave
94
87
  end
95
88
 
96
89
  # @private
97
- class NilMutex
98
- include Singleton
90
+ module NilMutex
91
+ extend self
99
92
  def synchronize() yield end
100
93
  end
101
94
 
@@ -110,7 +103,7 @@ module Weave
110
103
  def initialize(host_string)
111
104
  @user, @host = self.class.user_and_host(host_string)
112
105
  @connection = nil
113
- @mutex = NilMutex.instance
106
+ @mutex = NilMutex
114
107
  end
115
108
 
116
109
  # Run a command on this connection. This will open a connection if it's not already connected. The way the
@@ -157,9 +150,9 @@ module Weave
157
150
 
158
151
  # @private
159
152
  def self_eval(mutex = nil, &block)
160
- @mutex = mutex || NilMutex.instance
153
+ @mutex = mutex || NilMutex
161
154
  instance_eval &block
162
- @mutex = NilMutex.instance
155
+ @mutex = NilMutex
163
156
  end
164
157
 
165
158
  # Disconnect, if connected.
@@ -1,3 +1,3 @@
1
1
  module Weave
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["cespare@gmail.com"]
7
7
  gem.description = %q{Simple parallel ssh.}
8
8
  gem.summary = %q{Simple parallel ssh.}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/cespare/weave"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -15,8 +15,10 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Weave::VERSION
17
17
 
18
+ gem.add_dependency "net-ssh", ">= 2.2.0"
19
+
18
20
  # For running integration tests.
19
- gem.add_development_dependency "vagrant"
21
+ gem.add_development_dependency "vagrant", "~> 1.0.5"
20
22
  gem.add_development_dependency "scope"
21
23
  gem.add_development_dependency "rake"
22
24
  # For generating the docs
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: vagrant
15
+ name: net-ssh
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
21
+ version: 2.2.0
22
+ type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 2.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: vagrant
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.5
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.5
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: scope
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +128,7 @@ files:
112
128
  - test/integrations/sanity_test.rb
113
129
  - test/test_helper.rb
114
130
  - weave.gemspec
115
- homepage: ''
131
+ homepage: https://github.com/cespare/weave
116
132
  licenses: []
117
133
  post_install_message:
118
134
  rdoc_options: []