supply_drop 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -87,3 +87,4 @@ If you write anything complicated, write a test for it. Test that your changes w
87
87
  * Paul Gross [pgr0ss](https://github.com/pgr0ss "github")
88
88
  * Drew Olson [drewolson](https://github.com/drewolson "github")
89
89
  * Dave Pirotte [dpirotte](https://github.com/dpirotte "github")
90
+ * Dan Manges [dan-manges](https://github.com/dan-manges "github") (one soda's worth)
@@ -1,9 +1,17 @@
1
1
  module SupplyDrop
2
2
  module AsyncEnumerable
3
3
  def each(&block)
4
- self.map do |item|
5
- Thread.new { block.call(item) }
6
- end.each(&:join)
4
+ threads = []
5
+ super do |item|
6
+ threads << Thread.new { block.call(item) }
7
+ end
8
+ threads.each(&:join)
9
+ end
10
+
11
+ def map(&block)
12
+ super do |item|
13
+ Thread.new { Thread.current[:output] = block.call(item) }
14
+ end.map(&:join).map { |t| t[:output] }
7
15
  end
8
16
  end
9
17
  end
@@ -2,7 +2,9 @@ module SupplyDrop
2
2
  module Util
3
3
  def self.optionally_async(collection, async)
4
4
  if async
5
- collection.extend SupplyDrop::AsyncEnumerable
5
+ async_collection = collection.clone
6
+ async_collection.extend SupplyDrop::AsyncEnumerable
7
+ async_collection
6
8
  else
7
9
  collection
8
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supply_drop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
4
+ hash: 5
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Pitluga
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-28 00:00:00 Z
18
+ date: 2012-01-16 00:00:00 -06:00
19
+ default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description: See http://github.com/pitluga/supply_drop
@@ -1865,6 +1866,7 @@ files:
1865
1866
  - examples/vendored-puppet/vendor/puppet-2.7.8/test/util/storage.rb
1866
1867
  - examples/vendored-puppet/vendor/puppet-2.7.8/test/util/subclass_loader.rb
1867
1868
  - examples/vendored-puppet/vendor/puppet-2.7.8/test/util/utiltest.rb
1869
+ has_rdoc: true
1868
1870
  homepage: http://github.com/pitluga/supply_drop
1869
1871
  licenses: []
1870
1872
 
@@ -1894,9 +1896,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1894
1896
  requirements: []
1895
1897
 
1896
1898
  rubyforge_project:
1897
- rubygems_version: 1.8.10
1899
+ rubygems_version: 1.3.7
1898
1900
  signing_key:
1899
1901
  specification_version: 3
1900
- summary: Serverless puppet with capistrano
1902
+ summary: Masterless puppet with capistrano
1901
1903
  test_files: []
1902
1904