2016-08-06 13:15:47 -04:00
|
|
|
require "rails/generators"
|
2011-04-10 12:52:42 -04:00
|
|
|
|
2014-11-09 21:41:49 -05:00
|
|
|
#if no argument/-h/--help is passed to rails generate command, then
|
|
|
|
#it generates the help associated.
|
2012-08-05 18:27:56 -04:00
|
|
|
if [nil, "-h", "--help"].include?(ARGV.first)
|
2016-08-06 13:15:47 -04:00
|
|
|
Rails::Generators.help "generate"
|
2009-07-02 05:08:07 -04:00
|
|
|
exit
|
|
|
|
end
|
|
|
|
|
|
|
|
name = ARGV.shift
|
2011-05-26 11:59:00 -04:00
|
|
|
|
2011-05-27 07:25:35 -04:00
|
|
|
root = defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root
|
2012-10-14 06:03:39 -04:00
|
|
|
Rails::Generators.invoke name, ARGV, behavior: :invoke, destination_root: root
|