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.
189 190 191 |
# File 'lib/rails_generator/lookup.rb', line 189 def initialize super :RubyGems end |
Instance Method Details
#each ⇒ Object
Yield latest versions of generator gems.
194 195 196 197 198 199 200 201 202 |
# File 'lib/rails_generator/lookup.rb', line 194 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 |