Class: Gem::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/templates/application/common/merb_thor/gem_ext.rb

Instance Method Summary collapse

Instance Method Details

#recursive_dependencies(from, index = Gem.source_index) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/generators/templates/application/common/merb_thor/gem_ext.rb', line 111

def recursive_dependencies(from, index = Gem.source_index)
  specs = self.runtime_dependencies.map do |dep|
    spec = index.search(dep).last
    unless spec
      from_name = from.is_a?(::Gem::Specification) ? from.full_name : from.to_s
      wider_net = index.find_name(dep.name).last
      ThorUI.error "Needed #{dep} for #{from_name}, but could not find it"
      ThorUI.error "Found #{wider_net.full_name}" if wider_net
      ::Thor::Tasks::Merb::Gem.rollback_trans
    end
    spec
  end
  specs + specs.map {|s| s.recursive_dependencies(self, index)}.flatten.uniq
end