How devise include their generators like devise:install without the creation of lib/generator inside the rails project?
I mean, what is the magic here? Is the require_paths = ["lib"] who does the trick including the generators?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
in the gem, there is a ‘generator’ folder structure that rails looks for
In
devise.gemspec, thelibdir is added to the require path:This means that once you add devise to your
Gemfile, rails now has access to it’s generators because they follow the structure and naming conventions rails expects.Here is the install generator for your reference. If you were to rename that file to
installer_generator.rband change the class name toInstallerGenerator, the devise install command would then becomerails g devise:installerinstead ofrails g devise:installHopefully this helps clear things up.