我有一位客户想要将他们在一个领域取得成功的 Rails 应用程序应用到另一个类似的领域。该应用程序的这个新实例将开始非常相似:所有相同的功能,不同的徽标和颜色。但是,如果新网站成功,它将不可避免地需要进行重大自定义,而这些自定义不应应用于原始网站。同时,如果修复了错误并对一个应用程序进行了改进,那么两个应用程序应该能够共享这些改进。
谁能建议解决此问题的策略或资源?如何避免应用到这两个应用程序的更改花费更长的时间来测试和实施?
是的,我知道答案涉及 SCM、插件、gems 和 Rails 引擎。这些工具将会并且正在被使用。但我想知道何时以及如何使用这些工具来解决这个问题。
也欢迎提供链接。
不同
这个问题与: 多个网站在同一代码库上运行?
在我的问题中,我没有运行具有不同设置的完全相同的应用程序。
如何在多个代码库之间同步更改?问类似的问题,但我特别询问 Rails 应用程序。
I have a client that wants to take their Rails app that has been successful in one niche and apply it to another similar niche. This new instance of the app is going to start out very similar: all the same functionality, different logo and colors. However, if the new site is successful it will inevitably need significant customizations that shouldn't be applied to the original site. At the same time, if bugs are fixed and improvements are made to one app, then both apps should be able to share those improvements.
Can anyone suggest strategies or resources that address this issue? How do I keep changes that apply to both apps from taking significantly longer to test and implement?
Yes, I know the answer involves SCM, plugins, gems, and Rails engines. These tools will and are being used. but I want to know when and how to use these tools towards solving this problem.
Links are also welcome.
This question is not the same as:
Multiple websites running on same codebase?
In my question, I'm not running the exact same app with different settings.
How do you sync changes between multiple codebases? I'm asking a similar question, but I'm specifically asking about Rails apps.
发布评论
评论(4)
我们目前使用的设置与您所描述的非常相似。
我们开始为客户开发一个较大的 Rails 应用程序(销售、库存管理、产品目录等)。完成后,又出现了一些对几乎相同功能的新请求。
然而,原来的应用程序必须继续维护,添加新功能,纠正错误等等。
扩展的需要保持大部分功能,但改变外观和外观。
我们所做的是遵循一系列步骤:
什么去哪儿?很大程度上取决于您的代码。根据经验,不涉及领域语言的功能将由插件(或 gems,如果它不太依赖于 Rails)提供
现在,我们如何应对核心基础的变化。我们从模板存储库开始。我们修复或定义修复或更改应该在哪里,然后在此处或在其相应的 gem/插件上进行更改。正确测试后,我们将其部署到我们的 GitHub 帐户。
最后,我们合并/变基该模板存储库中的其他项目,获取新的更新。
听起来有点复杂,但这只是为了设置。目前的工作流程非常简单易行,其优点是可以与多个开发人员合作,而不会出现更大的问题。
We currently work with a setup quite similar with what you are describing.
We started developing a somewhat big Rails app (sales, stock management, product catalogue, etc) for a client. After finishing it, there came several new requests for almost identical functionality.
The original app, however, had to keep being maintained, adding new features, correcting bugs and whatnot.
The extended ones needed to maintain most functionality, but change appearance and looks.
What we did was follow a series of steps:
What goes where? Depends greatly on your code. As a rule of thumb, functionality that doesn't deal with the domain language goes to plugins (or gems if it doesn't depends too much on Rails)
Now, how do we deal with changes to the core base. We start with our template repository. We fix or define where the fix or change should be and either change it there or on it's corresponding gem/plugin. After properly testing it, we deploy it to our GitHub account.
Finally, we merge/rebase the other projects from that template repository, getting the new updates.
Sounds a bit complicated, but it was only for the setup. The current workflow is quite simple and easy, with the given advantage of working with several developers without bigger issues.
只需最少地接触主站点,就可以在扩展模板和更改样式的同时使用其中的 Ruby 代码。我在 Django 中进行了广泛的研究,布局看起来像:
你可以尝试在 Rails 中做类似的事情:
假设跨站点的功能是相同的,但它们只是有不同的布局和样式,那么将没有或很少有模型和控制器代码。如果您希望向特定站点添加更多功能,只需将代码粘贴到所需的站点文件夹下即可。
Django 还有 站点 和 能够在一个特定项目文件夹和应用程序文件夹中查找模板。您可以尝试复制这些功能并将它们转移到 Rails 中,以实现从一个代码库运行多个站点。
我知道您正在寻找 Rails 解决方案,但您仍然可以查看它在 Django 中的实现方式,并将一些有用的功能复制到另一端。如果我喜欢 Rails 的某个特定功能,我会将其移植到 Django/Python。
With minimal touching of the main site, it might be possible to use the Ruby code from it while extending the templates and changing the styles. I have worked on that extensively in Django and the layout can look like:
You could try do something similar in Rails:
Assuming the functionalities are identical across sites but they just have different layout and styles, there will be none or very little model and controller code. Should you wish to add more functionality to specific sites, just stick the code under the desired site folder.
Django also have the concept of Sites and the ability to look for templates in one specific project folder and an app folder. You could try to copy those features and bring them over to Rails to achieve running multiple site from one codebase.
I recognize that you are looking for a Rails solution but you can still checkout how it's done in Django and copy some of the useful features to the other side. If I like a Rails specific feature, I'll port it other to Django/Python.
我们公司也在做类似的事情。除了目前涉及多个环境(生产、测试、开发)。我们使用 SVN 作为 SCM 来保持代码的完整性,并让我们复制当前的稳定环境并创建应用程序的单独版本(并可能更改徽标或某些功能等内容)。我强烈建议使用 Apache/Nginx 和 Phusion 的 Passenger 运行环境。这让我们可以在相同/相似的代码库上单独运行所有这些应用程序。就是这样。我们必须使用数据库,一个生产一个开发,以将我们的实时数据分开,但您可以通过这种方式轻松地将两个应用程序实例连接到同一个数据库。到目前为止,它对我们来说效果非常好,能够在不关闭主生产服务器的情况下开发、测试和部署多个 Web 应用程序。
We're doing something similar at my company. Except its currently involving multiple environments (production, test, development). We're using SVN as our SCM to keep our code straight and lets us duplicate the current stable environment and create separate versions of an application (and potentially changing things like the logos or certain functionality). I highly highly recommend running the environment with Apache/Nginx and Phusion's Passenger. This is letting us run all of these applications separately, on the same/similar codebase(s). And that's it. We have to DBs, one Production and one Development to keep our live data separate, but you can easily connect two app instances to the same db this way. Its worked out really well for us so far in being able to develop, test and deploy multiple web applcations without taking down the primary production server.
我知道使用 Git 子模块 可以实现这一点
I know this could be possible using Git Submodules