简体   繁体   中英

Ruby on Rails generators with new gemified plugin?

I'm attempting to create a new Rails 3 plugin gem which wraps around devise/devise_ldap_authenticatable for reusable drop in internal LDAP support.

I create the new plugin gem with:

rails plugin new <gem_name>

I then add the devise/devise_ldap_authenticatable gems to the .gemspec file and run bundle

In the devise instructions it says to generate the required files using its generators:

rails generate devise:install 
rails generate devise MODEL

However, in the directory where the plugin is generated I don't seem to be able to run rails generate . Most gem plugin tutorials instruct you to just create the files manually. Am I better off starting a new rails project, following the instructions in the temp project, then copying the files over to the plugin manually? Is there something that I'm missing? Can I run the generator script from the dummy instance? What is the standard practice in this use case?

In the end, I opted to forgo wrapping devise_ldap_authenticatable due to its relative simplicity.

The answer that I would go with in the future is to just to move files from a throwaway project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM