简体   繁体   中英

How to convert existing rails application to gem

I have a rails application that is kind of similar to the active_admin gem. I want to make this existing application into a gem.

I know that you can generate a gem with:

bundler gem gem_name_here

This command creates an empty gem. Which is fine I suppose, I just don't know where to put all my code.

You're ostensibly supposed to put all of your code in the /lib directory. However, my application has an assets pipeline and an app directory with all my models, controllers, and views. I don't know where to place all of these directories in the gem. Any thoughts or ideas?

If you need me to share any code, I'll gladly share it.

You're describing a rails engine. Engine is a miniature rails application that can be used inside other rails app. For more details see official rails guide

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