I'm about to start working on porting a company's old rails ap from 2.3/1.87 to the most recent version of rails. Should I wait for rails 4, or should I just to 3.2?
我即将开始将公司旧的rails ap从2.3 / 1.87移植到最新版本的rails。我应该等铁路4,还是我应该等到3.2?
We're going to take the opportunity to make sure there is full test coverage, and there will probably be some rewriting involved as well. The first goal is to make sure all current functionality is operational.
我们将借此机会确保有完整的测试覆盖率,并且可能还会涉及一些重写。第一个目标是确保所有当前功能都可以运行。
We want as much of the current codebase as-is to work under the most recent version of rails. We will rewrite any parts that don't.
我们希望尽可能多的当前代码库在最新版本的rails下工作。我们将重写任何没有的部分。
2 个解决方案
#1
18
I would consider the following two choices:
我会考虑以下两种选择:
A) Re-write the app.
In this case I would do it in rails 3.2.10 Don't wait until 4 as it has to be released, shaken down, bugs found, etc. With rails it's almost never good to wait as it has such a rapid release cycle with major changes. Something I've learned the hard way over the last couple of years.
A)重写应用程序。在这种情况下,我会在rails 3.2.10中进行操作。不要等到4,因为它必须被释放,摇晃,发现错误等。对于rails来说,几乎永远不会等待,因为它具有如此快速的释放周期主要变化。在过去的几年里,我学到了很多东西。
B) Upgrade it incrementally.
I would also not wait until 4 comes, go to 3.2.10 now. Start by updating the 2.3 app to rails 3.0 This will probably not actually be that hard. There are a few format changes and active record changes but most are fairly straight-forward and documented well by others. Take careful note of deprecation warnings as these are often introduced in rails versions x.0 and then actually removed in x.1 (so in this case that means 3.0 and 3.1)
B)逐步升级。我也不会等到4,现在转到3.2.10。首先将2.3应用程序更新为rails 3.0这可能实际上并不那么难。有一些格式更改和活动记录更改,但大多数是相当直接的,并由其他人很好地记录。请仔细注意弃用警告,因为这些警告经常在rails x.0中引入,然后在x.1中实际删除(所以在这种情况下意味着3.0和3.1)
Once this is complete and you've kicked the tires around and made sure everything works, then move on to upgrading to rails 3.1 This is actually a pretty big upgrade as it introduces the asset pipeline. You'll need to read up on that and follow the advice. Don't 'cop out' by not using it for production. Basically it does two key things: minifies js code and compiles all js and css code into 1 file (each). This help speeds up web pages and reduce server requests for all the individual assets.
一旦完成并且你已经开始行动并确保一切正常,然后继续升级到rails 3.1这实际上是一个非常大的升级,因为它引入了资产管道。您需要阅读并遵循建议。不要将它用于生产,以此来“消除”。基本上它做了两件事:缩小js代码并将所有js和css代码编译成1个文件(每个)。这有助于加速网页并减少对所有单个资产的服务器请求。
Next upgrade ruby from 1.8.7 to 1.9.3 This should be relatively painless but as with all the steps check the app carefully and obviously if you have automated regression tests they should be run (same for each step outlined here).
接下来将ruby从1.8.7升级到1.9.3这应该是相对无痛的,但是与所有步骤一样仔细检查应用程序,显然如果你有自动回归测试它们应该运行(对于这里概述的每个步骤都相同)。
Finally upgrade rails from 3.1 to 3.2.11 which includes a security fix.
最后将rails从3.1升级到3.2.11,其中包括安全修复程序。
Which choice you make will depends on a great number of other factors, both technical and non-technical, including:
您做出的选择取决于许多其他因素,包括技术因素和非技术因素,包括:
- developer bandwidth
- 开发者带宽
- developer experience
- 开发经验
- budget
- 预算
- timeline
- 时间线
- quality of code
- 代码质量
- size of codebase
- 代码库的大小
- number of users of the apps (thus impact any isssues will have).
- 应用程序的用户数量(从而影响任何问题)。
- availablity of customer support to field calls about issues.
- 客户支持可用于现场调用问题。
Useful Resources:
有用的资源:
- https://github.com/rails/rails_upgrade (2.3 -> 3.0)
- https://github.com/rails/rails_upgrade(2.3 - > 3.0)
- http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
- http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
- http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
- http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
- http://railscasts.com/episodes/282-upgrading-to-rails-3-1
- http://railscasts.com/episodes/282-upgrading-to-rails-3-1
- http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin
- http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin
- http://guides.rubyonrails.org/3_2_release_notes.html
- http://guides.rubyonrails.org/3_2_release_notes.html
#2
4
I think you need to update to 3.x at first, and after some time (when 4.1 or something like will be released) you will update your app to the latest Rails version.
我认为您需要首先更新到3.x,并在一段时间后(当4.1或类似的东西发布时),您将更新您的应用程序到最新的Rails版本。
I strongly recommend to create a huge work on making tests for the current codebase (if it is not done yet). When you get updated to Rails 3 you will get a good base of bugs which you need to fix before production.
我强烈建议为当前代码库进行测试(如果还没有完成)。当您更新到Rails 3时,您将获得在生产之前需要修复的错误基础。
And there are lot of tutorials (video and text) about how to update 2.x to 3.x Rails apps.
还有很多关于如何更新2.x到3.x Rails应用程序的教程(视频和文本)。
My recommendation: update your current app to 3.2 and wait until 4.x branch will come to stable and you can use it in production mode (it will take about 4-8 months from release of 4.0)
我的建议:将您当前的应用程序更新为3.2并等到4.x分支将稳定,您可以在生产模式下使用它(从4.0版本开始需要大约4-8个月)
#1
18
I would consider the following two choices:
我会考虑以下两种选择:
A) Re-write the app.
In this case I would do it in rails 3.2.10 Don't wait until 4 as it has to be released, shaken down, bugs found, etc. With rails it's almost never good to wait as it has such a rapid release cycle with major changes. Something I've learned the hard way over the last couple of years.
A)重写应用程序。在这种情况下,我会在rails 3.2.10中进行操作。不要等到4,因为它必须被释放,摇晃,发现错误等。对于rails来说,几乎永远不会等待,因为它具有如此快速的释放周期主要变化。在过去的几年里,我学到了很多东西。
B) Upgrade it incrementally.
I would also not wait until 4 comes, go to 3.2.10 now. Start by updating the 2.3 app to rails 3.0 This will probably not actually be that hard. There are a few format changes and active record changes but most are fairly straight-forward and documented well by others. Take careful note of deprecation warnings as these are often introduced in rails versions x.0 and then actually removed in x.1 (so in this case that means 3.0 and 3.1)
B)逐步升级。我也不会等到4,现在转到3.2.10。首先将2.3应用程序更新为rails 3.0这可能实际上并不那么难。有一些格式更改和活动记录更改,但大多数是相当直接的,并由其他人很好地记录。请仔细注意弃用警告,因为这些警告经常在rails x.0中引入,然后在x.1中实际删除(所以在这种情况下意味着3.0和3.1)
Once this is complete and you've kicked the tires around and made sure everything works, then move on to upgrading to rails 3.1 This is actually a pretty big upgrade as it introduces the asset pipeline. You'll need to read up on that and follow the advice. Don't 'cop out' by not using it for production. Basically it does two key things: minifies js code and compiles all js and css code into 1 file (each). This help speeds up web pages and reduce server requests for all the individual assets.
一旦完成并且你已经开始行动并确保一切正常,然后继续升级到rails 3.1这实际上是一个非常大的升级,因为它引入了资产管道。您需要阅读并遵循建议。不要将它用于生产,以此来“消除”。基本上它做了两件事:缩小js代码并将所有js和css代码编译成1个文件(每个)。这有助于加速网页并减少对所有单个资产的服务器请求。
Next upgrade ruby from 1.8.7 to 1.9.3 This should be relatively painless but as with all the steps check the app carefully and obviously if you have automated regression tests they should be run (same for each step outlined here).
接下来将ruby从1.8.7升级到1.9.3这应该是相对无痛的,但是与所有步骤一样仔细检查应用程序,显然如果你有自动回归测试它们应该运行(对于这里概述的每个步骤都相同)。
Finally upgrade rails from 3.1 to 3.2.11 which includes a security fix.
最后将rails从3.1升级到3.2.11,其中包括安全修复程序。
Which choice you make will depends on a great number of other factors, both technical and non-technical, including:
您做出的选择取决于许多其他因素,包括技术因素和非技术因素,包括:
- developer bandwidth
- 开发者带宽
- developer experience
- 开发经验
- budget
- 预算
- timeline
- 时间线
- quality of code
- 代码质量
- size of codebase
- 代码库的大小
- number of users of the apps (thus impact any isssues will have).
- 应用程序的用户数量(从而影响任何问题)。
- availablity of customer support to field calls about issues.
- 客户支持可用于现场调用问题。
Useful Resources:
有用的资源:
- https://github.com/rails/rails_upgrade (2.3 -> 3.0)
- https://github.com/rails/rails_upgrade(2.3 - > 3.0)
- http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
- http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
- http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
- http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
- http://railscasts.com/episodes/282-upgrading-to-rails-3-1
- http://railscasts.com/episodes/282-upgrading-to-rails-3-1
- http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin
- http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin
- http://guides.rubyonrails.org/3_2_release_notes.html
- http://guides.rubyonrails.org/3_2_release_notes.html
#2
4
I think you need to update to 3.x at first, and after some time (when 4.1 or something like will be released) you will update your app to the latest Rails version.
我认为您需要首先更新到3.x,并在一段时间后(当4.1或类似的东西发布时),您将更新您的应用程序到最新的Rails版本。
I strongly recommend to create a huge work on making tests for the current codebase (if it is not done yet). When you get updated to Rails 3 you will get a good base of bugs which you need to fix before production.
我强烈建议为当前代码库进行测试(如果还没有完成)。当您更新到Rails 3时,您将获得在生产之前需要修复的错误基础。
And there are lot of tutorials (video and text) about how to update 2.x to 3.x Rails apps.
还有很多关于如何更新2.x到3.x Rails应用程序的教程(视频和文本)。
My recommendation: update your current app to 3.2 and wait until 4.x branch will come to stable and you can use it in production mode (it will take about 4-8 months from release of 4.0)
我的建议:将您当前的应用程序更新为3.2并等到4.x分支将稳定,您可以在生产模式下使用它(从4.0版本开始需要大约4-8个月)