Class: Rails::Generator::GemSource
- Defined in:
- lib/rails_generator/lookup.rb
Overview
GemSource 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.
-
#initialize ⇒ GemSource
constructor
A new instance of GemSource.
Methods inherited from Source
Constructor Details
#initialize ⇒ GemSource
Returns a new instance of GemSource.
193 194 195 |
# File 'lib/rails_generator/lookup.rb', line 193 def initialize super :RubyGems end |
Instance Method Details
#each ⇒ Object
Yield latest versions of generator gems.
198 199 200 201 202 203 204 205 206 |
# File 'lib/rails_generator/lookup.rb', line 198 def each Gem::cache.search(/_generator$/).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 |