# This will try to load any command in the load path to show in help.
def lookup!
$LOAD_PATH.each do |base|
Dir[File.join(base, *file_lookup_paths)].each do |path|
path = path.sub("#{base}/", "")
require path
rescue Exception
# No problem
end
end
end
def lookup_paths # :doc:
@lookup_paths ||= %w( rails/commands commands )
end
def file_lookup_paths # :doc:
@file_lookup_paths ||= [ "{#{lookup_paths.join(',')}}", "**", "*_command.rb" ]
end
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/3d028cb9-128d-44f2-9880-21fdc6151ba9%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/CAM%3DYcdike7D%2BrMR-tUKvZwU4Op3RGn6sAa%2BaQibic2NxSoru3w%40mail.gmail.com.
That’s really a good feature, if you do that, we can write Rails command instead of Rake task.
BTW. {project_root}/lib/commands is a good place, because it has {project_root}/lib/tasks there and do the similar job.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-core/CAG_6CsPrsaOshfz38-qTMhnY14Lc8doUg0VUP6TOQdWeNmPWHQ%40mail.gmail.com.