This blog post is taking a deeper look at phase 2 of upgrading a large Ruby on Rails up in smallish steps. The next phase is basically updating the config and booting the application in both versions. This is hopefully a small enough piece that can be merged into the main branch relatively quickly or at least give enough information on what needs to be refactored.
The following is what the details of phase 2 of the upgrade process could look like.
Phase 2: Config working on both versions
Goal: Have the application loading on both versions with updated config. One merged any new changes will have to make sure the app boots in both versions.
What: Adding the changes of bundle exec rake config:update
or bundle exec rake app:update
(The command will differ depending on your rails version)
Steps:
- Create a “Spike/Boot Rails in next version” story and plan according to your process
- Once you start on the story: Create a branch for it
- Update the config
- `BUNDLE_GEMFILE=Gemfile-next rails config:update` (depending on Rails version)
- merge the changes between the original files and the new ones
- staging.rb (any not standard environment) will have to be done manually
- You might have to add `if Rails.version` around some config.
- eg: if Rails.version > “4”
- Attempt to Boot the application in all the environments
- eg RAILS_ENV=test bundle exec rails runner “puts User.first”
- Attempt to resolve any minor issues immediately
- Create new refactor stories as required
- If you created new refactor stories
- Merge as much as you can into the main branch
- mark the main story as attempted/done/finish/etc
- plan the new refactor stories according to your process
- once new stories are done, start from Step 1 again
- Add the changes to version control
- Get building and checking of app boot on CI (ie Something like `bundle exec rails runner “puts User.first”` running on CI)
- Share with the team that any changes need to boot in both versions
- Merge the branch into master
And that is it.