سؤال

I have a previous project that was coded using Ruby 1.8.6 on Rails 2.0.0. I would like to configure this with a new database, on a new server, with updated framework- what is the best way to go about dealing with an application this old while making integrations of my own? Would I need to refactor, and if so how do I go about refactoring?

هل كانت مفيدة؟

المحلول

Pretty vintage setup you got there!

It really depends very much on the size of the app and the test coverage.. You always have to evaluate what is more sensible or time consume... e.g. to write new tests in some old library, or to do testing manually... to migrate or to rewrite, etc. But here are some good practices:

  1. Migrate step by step on your development environment
  2. Isolate every framework, ruby, gem change if possible, and test whole app afterwards
  3. If you don't have any tests you will have to do the testing manually which is fragile to say the least... or in some cases you can write new tests (but that is time-consuming)
  4. Once you have the app running and fully tested on your development environment, you can deploy/migrate to the new server

I hope this helps to some extent.

نصائح أخرى

I created a checklist for how to upgrade old Rails apps: http://www.rails-upgrade-checklist.com/, and also gave a talk at RailsConf 2013 on how to upgrade long lived Rails apps: http://www.youtube.com/watch?v=97fpzfRGTcs

In addition, I'm doing a (paid) course on this very subject: http://www.upgradingrails.com/

This is a long hard road: depending on various conditions of your app, it may very well be easier to start over. Watch the talk where I discuss rewrite vs refactor.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top