[英]How to upgrade big Ruby on Rails project from Rails version 4.2.2 to 6.0.2.2?
I have a huge rails web application with wide user base which runs on Rails 4.2.2 and Ruby 2.2.2 as of now.我有一个巨大的 Rails web 应用程序,它拥有广泛的用户群,目前在 Rails 4.2.2 和 Ruby 2.2.2 上运行。 I simply want to upgrade the whole application to the latest version of Ruby ie 2.5.0 and Rails 6.0.2.2.我只是想将整个应用程序升级到最新版本的 Ruby 即 2.5.0 和 Rails 6.0.2.2。 The reason for upgrade being I want to integrate a completely separate React.js frontend and a separate Rails backend.升级的原因是我想集成一个完全独立的 React.js 前端和一个独立的 Rails 后端。 Other reasons for upgradation being deprecating older version of gems and rails.升级的其他原因是弃用旧版本的 gems 和 rails。 I have tried researching a lot for this.我为此尝试了很多研究。 I have also tried the: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html guides.我也尝试过: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html指南。 But everything out there is so vague and haphazard.但是外面的一切都是那么模糊和随意。 I havent found any clear cut method until now following which I can upgrade my rails application smoothly.到目前为止,我还没有找到任何明确的方法,然后我可以顺利升级我的 rails 应用程序。 Please help.请帮忙。
What i would recommend you to do is to upgrade to Rails 5.xx first and than to 6.xx you can use those guides and follow step by step:我建议您首先升级到 Rails 5.xx,然后升级到 6.xx,您可以使用这些指南并逐步进行操作:
https://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-4-2-to-5-0.html https://selleo.com/blog/how-to-upgrade-to-rails-6 https://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-4-2-to-5-0.html https://selleo.com/blog/how-to-upgrade-to -rails-6
I would recommend a progressive update for both Ruby and Rails.我建议对 Ruby 和 Rails 进行渐进式更新。 I would for example start by updating Ruby from 2.2.2 to 2.3, using the Release notes as guide of what things have changed: https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released Once that work (which would be easy to check if you have high test coverage), I would continue with Ruby 2.4 and so on.例如,我将从将 Ruby 从 2.2.2 更新到 2.3 开始,使用发行说明作为更改内容的指南: https://www.ruby-lang.org/en/news/2015/12/25/ruby -2-3-0-released一旦工作(这很容易检查你是否有高测试覆盖率),我将继续使用 Ruby 2.4 等等。 Ruby minor releases (for example 2.2.2 to 2.2.3) shouldn't include breakable changes, so you can just go from 2.2.2 to 2.3, 2.4, 2.5... Ruby 次要版本(例如 2.2.2 到 2.2.3)不应包含可破坏的更改,因此您可以仅将 go 从 2.2.2 到 2.3、2.4、2.5...
Also, note that the last version Ruby is 2.7.1 and not 2.5.0.另请注意,最后一个版本 Ruby 是 2.7.1 而不是 2.5.0。 Another good reason to update your Ruby version is that it is not maintained any more and it does not receives security fixes.更新 Ruby 版本的另一个很好的理由是它不再维护,也没有收到安全修复程序。 2.5.8 is in security maintenance phase, which means that it won't be maintained anymore soon. 2.5.8 处于安全维护阶段,这意味着它将不再维护。 You may want to update to at least Ruby 2.6.您可能希望至少更新到 Ruby 2.6。
Regarding Rails, you can find the release notes here: https://guides.rubyonrails.org/5_0_release_notes.html (just change the number in url to get the information of a different release).关于 Rails,您可以在此处找到发行说明: https://guides.rubyonrails.org/5_0_release_notes.html (只需将 Z572D4E421E5E6B29BC11D815EA8 中的数字更改为不同版本的信息)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.