如何将一个大的宝石转换为独立的Rails应用程序 [英] How to convert a large gem to standalone rails app

查看:85
本文介绍了如何将一个大的宝石转换为独立的Rails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个社交网络,并且一直在使用gem community_engine,但一直在执行我需要的大量自定义功能时遇到问题。我认为这会让我更容易覆盖和添加方法,并帮助我更好地理解和学习代码,因为我将能够实际看到它的所有实际操作。



到目前为止,我尝试下载了源代码,添加了缺省的bin目录和配置文件,以及所有gem依赖项。



我还需要做些什么才能使应用程序正常工作?我意识到可能还有很多,并且可能不容易解释,但至少有什么文档可以帮助我理解如何将gem转换为Rails应用程序?



继承community_engine回购: https://github.com/bborn/ communityengine



因为这个想法可能会引起一些批评,我会补充说我最初构建的应用程序没有任何巨大的插件接受设计,但是我耗尽时间来完成这项工作。



我尝试过的更多内容:



将文件移动到新的Rails应用程序,得到服务器运行,但遇到了许多看似随机的错误,修复了一些,但更多只是似乎弹出,我无法弄清楚:



我也看了看在 http://guides.rubyonrails.org/plugins.html 上,但这颗宝石似乎变成了beyo

解决方案

我建议您克隆gem,并开始将文件从gem复制到新的Rails应用程序中。

引擎gem可能与Rails应用程序具有相似的结构,因此您应该能够将文件从相应的文件夹移动到Rails根文件夹中的相同文件夹。



您可能需要将gem文件移出模块,更改命名空间等。查看要包含的文件的相关文件夹可能包括app / config / db / ,Gemfile或gemspec文件中的任何gem依赖项,以及spec /或test /。



除此之外,我认为你的问题没有银弹答案,你只需要解决问题,直到你有这个问题,并且可能会问后续的问题,如果你遇到了一个障碍,你没有超越。


I'm building a social network and have been using the gem community_engine but have been having trouble implementing the large amount of customization that I need for my app. I figure this will make it easier for me to override and add methods, as well as help me to better understand and learn from the code since I will be able to actually see all of it in action.

So far in my attempt I downloaded the source code, added the default bin directory and config files that were missing, as well ass all the gem dependencies.

What else do I need to do to get the app to work? I realize that there may still be a lot and that it might not be easy to explain, but at the very least is there any sort of documentation out there that might help me understand how to convert the gem to a Rails application?

Heres the community_engine repo: https://github.com/bborn/communityengine

Because this idea may draw some criticism, I'll add that I was originally building the app without any huge plugins accept for devise however I'm running out of time to finish this.

More stuff I've tried:

Moving files to a new rails app, got server to run but encountered many seemingly random errors, fixed a few but more just seem to pop up that I cant figure out:

I also took a look at http://guides.rubyonrails.org/plugins.html but this gem seems to go beyond that.

解决方案

I would suggest that you clone the gem and begin copying files from the gem into your a new Rails application.

The engine gem probably has a similar structure to a Rails application, so you should be able to move the files from the corresponding folder to the same folder in your Rails root folder.

You may need to move gem files out of modules, change namespaces etc. Relevant folders to look at files you'll want to include might include app/ config/ db/, any gem dependencies in Gemfile or the gemspec file, as well as spec/ or test/.

Beyond that I think there's no silver bullet answer to your question, you're just going to have to work through problems until you have this up and running, and perhaps ask subsequent questions if you hit on an obstacle that you don't get beyond.

这篇关于如何将一个大的宝石转换为独立的Rails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆