lib/rubygems/dependent.rb in gem-dependent-0.2.4 vs lib/rubygems/dependent.rb in gem-dependent-0.2.5
- old
+ new
@@ -21,11 +21,11 @@
gems_and_dependencies = fetch_all_dependencies(specs_and_sources, options) do
print_dot if options[:progress]
end
$stderr.print "\n" if options[:progress]
- select_dependent(gems_and_dependencies, gem)
+ select_dependent(gems_and_dependencies, gem, options)
end
private
def self.fetch_all_dependencies(specs_and_sources, options={})
@@ -54,12 +54,13 @@
$stderr.puts e unless options[:all_versions]
[]
end
end
- def self.select_dependent(gems_and_dependencies, gem)
+ def self.select_dependent(gems_and_dependencies, gem, options={})
+ accepted_types = (options[:type] || [:development, :runtime])
gems_and_dependencies.map do |name, version, dependencies|
- matching_dependencies = dependencies.select{|d| d.name == gem } rescue []
+ matching_dependencies = dependencies.select{|d| d.name == gem && accepted_types.include?(d.type) } rescue []
next if matching_dependencies.empty?
[name, version, matching_dependencies]
end.compact
end