Class: Rails::Generator::GemGeneratorSource
- Inherits:
-
AbstractGemSource
- Object
- Source
- AbstractGemSource
- Rails::Generator::GemGeneratorSource
- Defined in:
- lib/rails_generator/lookup.rb
Overview
GemGeneratorSource hits the mines to quarry for generators. The latest versions of gems named *_generator are selected.
Instance Attribute Summary
Attributes inherited from Source
Instance Method Summary collapse
-
#each ⇒ Object
Yield latest versions of generator gems.
Methods inherited from AbstractGemSource
Methods inherited from Source
Constructor Details
This class inherits a constructor from Rails::Generator::AbstractGemSource
Instance Method Details
#each ⇒ Object
Yield latest versions of generator gems.
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/rails_generator/lookup.rb', line 210 def each dependency = Gem::Dependency.new(/_generator$/, Gem::Requirement.default) Gem::cache.search(dependency).inject({}) { |latest, gem| hem = latest[gem.name] latest[gem.name] = gem if hem.nil? or gem.version > hem.version latest }.values.each { |gem| yield Spec.new(gem.name.sub(/_generator$/, ''), gem.full_gem_path, label) } end |