parallel 0.5.1 → 0.5.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.
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
- source 'http://rubygems.org'
1
+ source :rubygems
2
2
 
3
- gem 'rake'
4
- gem 'rspec', '~>2'
5
- gem 'jeweler'
3
+ group :dev do
4
+ gem 'rake'
5
+ gem 'rspec', '~>2'
6
+ gem 'jeweler'
7
+ end
data/Rakefile CHANGED
@@ -17,4 +17,4 @@ begin
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
19
19
  puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
20
- end
20
+ end
data/Readme.md CHANGED
@@ -1,4 +1,4 @@
1
- Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations).
1
+ Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations).<br/>
2
2
  Best suited for map-reduce or e.g. parallel downloads/uploads.
3
3
 
4
4
  Install
@@ -52,7 +52,9 @@ Authors
52
52
  - [mikezter](http://github.com/mikezter)
53
53
  - [Jeremy Durham](http://www.jeremydurham.com)
54
54
  - [Nick Gauthier](http://www.ngauthier.com)
55
+ - [Andrew Bowerman](http://andrewbowerman.com)
56
+ - [Byron Bowerman](http://me.bm5k.com/)
55
57
 
56
- [Michael Grosser](http://grosser.it)
57
- grosser.michael@gmail.com
58
- Hereby placed under public domain, do what you want, just do not hold me accountable...
58
+ [Michael Grosser](http://grosser.it)<br/>
59
+ michael@grosser.it<br/>
60
+ Hereby placed under public domain, do what you want, just do not hold me accountable...
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -64,7 +64,7 @@ class Parallel
64
64
  when /darwin9/
65
65
  `hwprefs cpu_count`.to_i
66
66
  when /darwin10/
67
- `hwprefs thread_count`.to_i
67
+ (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
68
68
  when /linux/
69
69
  `cat /proc/cpuinfo | grep processor | wc -l`.to_i
70
70
  when /freebsd/
@@ -74,6 +74,10 @@ class Parallel
74
74
 
75
75
  private
76
76
 
77
+ def self.hwprefs_available?
78
+ `which hwprefs` != ''
79
+ end
80
+
77
81
  def self.work_in_threads(items, options, &block)
78
82
  results = []
79
83
  current = -1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-11-05}
12
+ s.date = %q{2011-02-15}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.files = [
15
15
  "Gemfile",
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.homepage = %q{http://github.com/grosser/parallel}
47
47
  s.rdoc_options = ["--charset=UTF-8"]
48
48
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.7}
49
+ s.rubygems_version = %q{1.4.2}
50
50
  s.summary = %q{Run any kind of code in parallel processes}
51
51
  s.test_files = [
52
52
  "spec/spec_helper.rb",
@@ -75,7 +75,6 @@ Gem::Specification.new do |s|
75
75
  ]
76
76
 
77
77
  if s.respond_to? :specification_version then
78
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
79
78
  s.specification_version = 3
80
79
 
81
80
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -1,6 +1,20 @@
1
1
  require File.expand_path('spec/spec_helper')
2
2
 
3
3
  describe Parallel do
4
+
5
+ describe :processor_count do
6
+ it "returns a number" do
7
+ (1..999).should include(Parallel.processor_count)
8
+ end
9
+
10
+ if RUBY_PLATFORM =~ /darwin10/
11
+ it 'works if hwprefs in not available' do
12
+ Parallel.should_receive(:hwprefs_available?).and_return false
13
+ (1..999).should include(Parallel.processor_count)
14
+ end
15
+ end
16
+ end
17
+
4
18
  describe :in_processes do
5
19
  def cpus
6
20
  Parallel.processor_count
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-05 00:00:00 +01:00
18
+ date: 2011-02-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project:
91
- rubygems_version: 1.3.7
91
+ rubygems_version: 1.4.2
92
92
  signing_key:
93
93
  specification_version: 3
94
94
  summary: Run any kind of code in parallel processes