Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.3.8) is shown here.
use_component_sources!()
public
Use component generators (model, controller, etc).
- Rails application. If RAILS_ROOT is defined we
know we’re generating in the context of a Rails application, so search RAILS_ROOT/generators.
- Look in plugins, either for generators/ or rails_generators/ directories
within each plugin
- User home directory. Search ~/.rails/generators.
- RubyGems. Search for gems named *_generator, and look for generators within
any RubyGem’s /rails_generators/<generator_name>_generator.rb
file.
- Builtins. Model, controller, mailer, scaffold, and so on.
# File railties/lib/rails_generator/lookup.rb, line 104
def use_component_sources!
reset_sources
if defined? ::RAILS_ROOT
sources << PathSource.new(:lib, "#{::RAILS_ROOT}/lib/generators")
sources << PathSource.new(:vendor, "#{::RAILS_ROOT}/vendor/generators")
Rails.configuration.plugin_paths.each do |path|
relative_path = Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT))
sources << PathSource.new("plugins (#{relative_path})""plugins (#{relative_path})", "#{path}/*/**/{,rails_}generators")
end
end
sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators")
if Object.const_defined?(:Gem)
sources << GemGeneratorSource.new
sources << GemPathSource.new
end
sources << PathSource.new(:builtin, "#{File.dirname(__FILE__)}/generators/components")
end