Updating Old Projects Checklist
Root files
Ensure
.ruby-versionexists in the root folderAdd default_whitelist.yml to root folder
Add .gitpod.yml to the root folder
Ensure
Procfileexists and looks like thisUngitignore
/db/*.sqlite3and/db/*.sqlite3-journalRemove
circle.ymlfile from the root folder if it exists.
bin folder
Replace
bin/setupwith thisEnsure
system! "gem install bundler" system! "gem update bundler"is before
system! "bundle install"inbin/setup.Ensure
bin/whitelistexists and looks like thisEnsure
bin/serverexists and looks like this
Initializers
Add a file nicer_errors.rb to
config/initializersReplace the out-of-the-box backtrack_silencers.rb with this
Add a file delegation_monkey_patch.rb to
config/initializersAdd a file active_record_relation_patch.rb to
config/initializersAdd a file attribute-methods-patch.rb to
config/initializersAdd a file fetch_store_patch.rb to
config/initializersEnsure
open_uri.rbinconfig/initializerslooks like thisIf
initializers/new_framework_defaults.rbis present, remove it. Make sure that updating the app to a new Rails version did not break any behavior in the app.
In application.rb
Add the following line,
config.action_controller.default_protect_from_forgery = false, after theload_defaults.Add the following line,
config.active_record.belongs_to_required_by_default = false, after theload_defaults.Add the following line,
config.autoload_paths += %W(#{config.root}/app/vendor_models), after theload_defaults.Add the following line,
config.autoload_paths += Dir["#{config.root}/app/vendor_models/**/"], after theload_defaults.
Gems
Include Ruby version in
GemfileRemove
gem "console_ip_whitelist", github: "firstdraft/console_ip_whitelist"to the development and test groupsMove
sqlite3gem to development and test groupsAdd
gem "tty-spinner"to development groupEnsure
gem "annotate", '< 3.0.0'is present, if not add to theGemfileand install it withrails g annotate:installEnsure
gem 'activeadmin', '2.2.0'andgem 'devise'are using the RubyGems version instead of the GitHub.Add
gem "better_errors"andgem "binding_of_caller"to the development and test groupsRemove
gem "draft_log", github: "firstdraft/draft_log"if it's present andbundle.Ensure that
gem "web_git", github: "firstdraft/web_gitis included. Start the server and ensure that navigating to/gitworks.Ensure all projects are ready to deploy to Heroku:
General
git rm whitelist.ymlif presentEnsure
whitelist.ymlis gitignoredEnsure
dev_toolsis removed fromapp/views/layouts/application.html.erbRemove
cloud9_plugins.shif present, and remove its line fromgitignoreEnsure there is no tzinfo-data warning message when executing
railscommands. If there is run:Ensure
db:seedsis doingAdminUser.createand notAdminUser.create!If
vendor/app/models/doesn't exist create itEnsure
admin_user.rbis not in theapp/models/folder and is instead invendor/app/models/Ensure any use of Hash#[] changes to Hash#fetch in existing code
Ensure that in
development.rbthe lines starting withpath = Rails.root.join('whitelist.yml')and ending withconfig.action_mailer.default_url_options = { host: "localhost", port: 3000 }(non-inclusive) is replaced with:Make sure the project setup steps in README are modern
bundle updatewith the same minor Rails versionMake sure templates are explicitly rendered with the folder name, e.g.
render("photo_templates/show.html.erb")Make sure tests are all isolated in their own describe block that contains the action path, e.g "/coffee_beans" instead of "coffee beans index"
Make sure all tests that have only_path: true get replaced with ignore_query: true
Get rid of
//= require_tree. in application.jsGet rid of
*= require_tree. in application.cssEnsure that all targets have a rake task that runs every hour or so to reset the dev:prime data (since students fill it with garbage)
Open the project in Gitpod, ensure that
bin/setupcompletes, navigate to/git,/adminand ensure you can login. Ensure you can runrails gradewithout errors.
Last updated