Module: RubiGen::Lookup::ClassMethods

Defined in:
lib/sprout/generator/base_mixins.rb

Overview

Instance Method Summary collapse

Instance Method Details

#use_sprout_sources!(sprout_name, project_path = nil) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/sprout/generator/base_mixins.rb', line 160

def use_sprout_sources!(sprout_name, project_path=nil)
  reset_sources

  # Project-specific generator paths
  if project_path
    sources << PathSource.new(:project, "#{project_path}/generators")
    sources << PathSource.new(:script, "#{project_path}/script/generators")
    sources << PathSource.new(:vendor, "#{project_path}/vendor/generators")
  end

  # System-wide generator paths
  system_path = "#{Sprout::Sprout.sprout_cache}/generators/#{sprout_name}"
  if(File.exists?(system_path))
    sources << PathSource.new(:system, system_path)
  end

  # Gem generators will collect all
  # rubygems that end with -bundle or -generators
  if(Object.const_defined?(:Gem))
    sources << GemGeneratorSource.new(sprout_name)
    sources << GemPathSource.new(sprout_name)
  end
end