gem-dependent 0.1.4 → 0.1.5

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
@@ -10,6 +10,8 @@ The first run can take looooong, but after the caches are filled, its pretty fas
10
10
  --source URL Query this source (e.g. http://rubygems.org)
11
11
  --no-progress Do not show progress
12
12
  --fetch-limit N Fetch specs for max N gems (for fast debugging)
13
+ --parallel N Make N requests in parallel
14
+
13
15
 
14
16
  Output
15
17
  ======
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gem-dependent}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
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{2010-11-06}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.files = [
15
15
  "Gemfile",
@@ -4,16 +4,20 @@ class Gem::Commands::DependentCommand < Gem::Command
4
4
  def initialize
5
5
  super 'dependent', 'Show which gems depend on a gem', :progress => true
6
6
 
7
- add_option('--source URL', 'Query these sources (e.g. http://gemcutter.org)') do |remote, _|
8
- options[:source] = remote.to_s.split(',')
7
+ add_option('--source URL', 'Query these sources (e.g. http://gemcutter.org)') do |n, _|
8
+ options[:source] = n.to_s.split(',')
9
9
  end
10
10
 
11
11
  add_option('--no-progress', 'Do not show progress') do
12
12
  options[:progress] = false
13
13
  end
14
14
 
15
- add_option('--fetch-limit N', Integer, 'Fetch specs for max N gems (for fast debugging)') do |limit, _|
16
- options[:fetch_limit] = limit
15
+ add_option('--fetch-limit N', Integer, 'Fetch specs for max N gems (for fast debugging)') do |n, _|
16
+ options[:fetch_limit] = n
17
+ end
18
+
19
+ add_option('--parallel N', Integer, 'Make N requests in parallel') do |n, _|
20
+ options[:parallel] = n
17
21
  end
18
22
  end
19
23
 
@@ -22,7 +22,7 @@ module Gem
22
22
  puts "Downloading specs for #{specs_and_sources.size} gems"
23
23
  end
24
24
 
25
- gems_and_dependencies = fetch_all_dependencies(specs_and_sources) do
25
+ gems_and_dependencies = fetch_all_dependencies(specs_and_sources, options) do
26
26
  print_dot if options[:progress]
27
27
  end
28
28
  print "\n" if options[:progress]
@@ -32,8 +32,9 @@ module Gem
32
32
 
33
33
  private
34
34
 
35
- def self.fetch_all_dependencies(specs_and_sources)
36
- Parallel.map(specs_and_sources, :in_processes => 15) do |spec, source|
35
+ def self.fetch_all_dependencies(specs_and_sources, options)
36
+ parallel = (options[:parallel] || 15)
37
+ Parallel.map(specs_and_sources, :in_processes => parallel) do |spec, source|
37
38
  yield if block_given?
38
39
  name = spec.first
39
40
  dependencies = fetch_dependencies(spec, source)
@@ -1,5 +1,6 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
2
- require 'lib/rubygems/dependent' # normal require does not work once gem is installed, wtf...
1
+ # normal require does not work once gem is installed, because its loaded via rubygems
2
+ $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
3
+ require 'lib/rubygems/dependent'
3
4
 
4
5
  describe Gem::Dependent do
5
6
  before do
@@ -50,7 +51,13 @@ describe Gem::Dependent do
50
51
  Gem::Dependent.find('hoe', :source => source)
51
52
  end
52
53
 
54
+ it "obeys parallel option" do
55
+ stub_source
56
+ Parallel.should_receive(:map).with(anything, :in_processes => 3).and_return []
57
+ Gem::Dependent.find('hoe', :parallel => 3)
58
+ end
59
+
53
60
  it "has a VERSION" do
54
61
  Gem::Dependent::VERSION.should =~ /^\d+\.\d+\.\d+$/
55
62
  end
56
- end
63
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-dependent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
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: 2010-11-06 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21