使您的Rails版本保持最新的最好方法是什么?

时间:2021-11-04 20:10:01

The application I'm working on was started with Rails 3.0.6, I believe 3.0.7 is available and 3.1 is just around the corner.

我正在开发的应用程序是从Rails 3.0.6开始的,我相信3.0.7是可用的,3.1就在眼前。

I realise 3.1 will likely have some breaking changes, requiring a proper read through of release notes etc, before attempting to update the project.

我意识到3.1可能会有一些突破性的变化,在尝试更新项目之前,需要适当地阅读发行说明等。

My question though, is what is considered best practice for the x.x.x updates and the x.x updates? Should they be treated differently? Barring breaking changes, is it best to create a brand new project each time and drop in the changed files?

我的问题是,x。x的最佳实践是什么。x更新和x。x更新?他们应该被区别对待吗?除了打破更改之外,是否最好每次都创建一个全新的项目并删除已更改的文件?

Rich

丰富的

2 个解决方案

#1


3  

The best way is always to specify your Rails and other Gem Versions within your Gemfile.

最好的方法总是在Gemfile中指定您的Rails和其他Gem版本。

gem 'rails', '3.0.7'

When a new version is released you simply bump the version, bundle and run your test suite. Following the change log will allow you to assess if any changes will be required. Rails is very good at providing Deprecation warning for your code segments so you should know about a change before it happens. Hope this helps, all the best.

当一个新版本发布时,您只需将版本、捆绑包和运行您的测试套件。在更改日志之后,您可以评估是否需要进行任何更改。Rails非常擅长为代码段提供弃用警告,因此您应该在更改发生之前就知道它。希望这能有所帮助。

#2


1  

I have a bit of a mixed opinion on this.

我对此有不同的看法。

On one hand, you want to be pragmatic about your upgrades and assess whether taking the time to upgrade your version of Rails will bring about any benefits for you. Sometimes this is obvious--speed improvements to slow parts of your app, improved pipelines or workflows, etc. might bring obvious gains, and you can easily justify taking the time to upgrade the app. Sometimes, it's not so obvious, and there's certainly a great number of production apps, some very well known, still running 2.3 and Ruby 1.8.7.

一方面,您希望在升级时更加务实,并评估花时间升级Rails版本是否会给您带来任何好处。有时这是显而易见的,速度慢的部分应用程序的改进,提高了管道或工作流,等可能会带来明显的收益,你可以很容易地证明花时间升级应用。有时候,它不是那么明显,当然还有大量的生产应用,一些非常知名,仍在运行2.3和Ruby 1.8.7。

On the other hand, Rails is a fast-moving project, and I personally wouldn't want to sit around on a very old version. The longer you wait to upgrade, the more work you'll likely have to do to modify your app accordingly.

另一方面,Rails是一个瞬息万变的项目,我个人不希望坐在一个非常旧的版本上。您等待升级的时间越长,您可能需要做更多的工作来相应地修改应用程序。

If you feel like it's time to upgrade, or that upgrading is a good idea, my advice to you is create a new branch in your version control system and test and profile the new version. That way, you and the rest of your team can continue working on the app in the old branches as normal, and you can get a good idea of how much work it'll take to upgrade Rails. Then, if everything goes horribly wrong, you can just delete the new branch and move on your merry way.

如果您觉得是时候升级了,或者升级是个好主意,我建议您在您的版本控制系统中创建一个新的分支,并对新版本进行测试和配置。这样,您和您的团队的其他成员就可以像往常一样在旧的分支中继续开发这个应用程序,并且您可以很好地了解要升级Rails需要做多少工作。然后,如果一切都很糟糕,你可以删除新的分支,然后继续你的快乐之路。

TL;DR

博士TL;

  • Be pragmatic about your upgrades--assess if the upgrade will bring any real, measurable benefit to your app or your team
  • 对你的升级要务实——评估升级是否会给你的应用或团队带来真正的、可衡量的好处
  • Always test and profile new versions of Rails (or any other dependency!)
  • 始终测试和分析Rails的新版本(或任何其他依赖项!)

#1


3  

The best way is always to specify your Rails and other Gem Versions within your Gemfile.

最好的方法总是在Gemfile中指定您的Rails和其他Gem版本。

gem 'rails', '3.0.7'

When a new version is released you simply bump the version, bundle and run your test suite. Following the change log will allow you to assess if any changes will be required. Rails is very good at providing Deprecation warning for your code segments so you should know about a change before it happens. Hope this helps, all the best.

当一个新版本发布时,您只需将版本、捆绑包和运行您的测试套件。在更改日志之后,您可以评估是否需要进行任何更改。Rails非常擅长为代码段提供弃用警告,因此您应该在更改发生之前就知道它。希望这能有所帮助。

#2


1  

I have a bit of a mixed opinion on this.

我对此有不同的看法。

On one hand, you want to be pragmatic about your upgrades and assess whether taking the time to upgrade your version of Rails will bring about any benefits for you. Sometimes this is obvious--speed improvements to slow parts of your app, improved pipelines or workflows, etc. might bring obvious gains, and you can easily justify taking the time to upgrade the app. Sometimes, it's not so obvious, and there's certainly a great number of production apps, some very well known, still running 2.3 and Ruby 1.8.7.

一方面,您希望在升级时更加务实,并评估花时间升级Rails版本是否会给您带来任何好处。有时这是显而易见的,速度慢的部分应用程序的改进,提高了管道或工作流,等可能会带来明显的收益,你可以很容易地证明花时间升级应用。有时候,它不是那么明显,当然还有大量的生产应用,一些非常知名,仍在运行2.3和Ruby 1.8.7。

On the other hand, Rails is a fast-moving project, and I personally wouldn't want to sit around on a very old version. The longer you wait to upgrade, the more work you'll likely have to do to modify your app accordingly.

另一方面,Rails是一个瞬息万变的项目,我个人不希望坐在一个非常旧的版本上。您等待升级的时间越长,您可能需要做更多的工作来相应地修改应用程序。

If you feel like it's time to upgrade, or that upgrading is a good idea, my advice to you is create a new branch in your version control system and test and profile the new version. That way, you and the rest of your team can continue working on the app in the old branches as normal, and you can get a good idea of how much work it'll take to upgrade Rails. Then, if everything goes horribly wrong, you can just delete the new branch and move on your merry way.

如果您觉得是时候升级了,或者升级是个好主意,我建议您在您的版本控制系统中创建一个新的分支,并对新版本进行测试和配置。这样,您和您的团队的其他成员就可以像往常一样在旧的分支中继续开发这个应用程序,并且您可以很好地了解要升级Rails需要做多少工作。然后,如果一切都很糟糕,你可以删除新的分支,然后继续你的快乐之路。

TL;DR

博士TL;

  • Be pragmatic about your upgrades--assess if the upgrade will bring any real, measurable benefit to your app or your team
  • 对你的升级要务实——评估升级是否会给你的应用或团队带来真正的、可衡量的好处
  • Always test and profile new versions of Rails (or any other dependency!)
  • 始终测试和分析Rails的新版本(或任何其他依赖项!)