Skip to content

Instantly share code, notes, and snippets.

@kathyonu
Last active April 13, 2023 17:51
Show Gist options
  • Save kathyonu/9f9fbb3f49ffcf1fed580b2b06683313 to your computer and use it in GitHub Desktop.
Save kathyonu/9f9fbb3f49ffcf1fed580b2b06683313 to your computer and use it in GitHub Desktop.

Commands to keep my app healthy, Brew, rbenv, Ruby and Rails gems-wise.

Open new Terminal

brew update

brew doctor

Get a view of what your terminal knows:

rbenv versions

rbenv version

rbenv global

rbenv local

rbenv shell

gem update --system

gem update rake

gem update bundler

gem update rubygems-bundler

gem outdated

If required, run:

gem update

Now we install Ruby:

$ rbenv install 2.7.7

Open the Gemfile, change ruby to the new version installed.

Open the .ruby-version file and change to new ruby version.

Rubocop gem users, open the .rubocop.yml file, change AllCops: TargetRubyVersion: 3.0

$ bundle platform --ruby

$ rbenv rehash

$ rbenv global 2.7.7

$ rbenv local 2.7.7

$ rbenv shell 2.7.7

$ gem install bundler

$ git checkout -b rails6161to617

We are now in the new branch

open /.ruby-version and add only this: 2.7.7 and one blank line below it.

open Gemfile, change Ruby version to new version installed.

change Rails version to new version, save and close, then run

$ gem install rails -v 6.1.7

$ bundle platform --ruby

$ rbenv rehash

$ rails -v
6.1.7

Verify correct location:

$ which gem /Users/YourName/.rbenv/shims/gem

Perfect.

$ which rails
rails: aliased to _rails_command

$ which _rails_command
_rails_command () {
if [ -e "bin/stubs/rails" ]
then
bin/stubs/rails $@
elif [ -e "bin/rails" ]
then
bin/rails $@
elif [ -e "script/rails" ]
then
ruby script/rails $@
elif [ -e "script/server" ]
then
ruby script/$@
else
command rails $@
fi
}

$ bundle

$ bundle update rails

$ rails app:update

$ bundle install

$ bundle outdated

$ bundle exec gem --version # => 3.1.6

$ bundle exec rake --version # => rake, version 13.0.6

$ bundle exec bundler --version # => Bundler version 2.3.26

CAUTION :

With $ bundle update, run this with caution.

$ bundle update

and immediately run tests.
chances are, you will have work to do.
better option is to update each individual gem,
after studying any changes made to the gem.

$ ruby -v
ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [x86_64-darwin21]

$ rails -v 6.1.7

$ rails s

$ bundle exec rspec

Welcome to the your working versions of Ruby on Rails.
Your Rails app's health brought to you by

Address of The Rails Applications Health Codes Gist using RVM is :
https://gist.github.com/kathyonu/c9ef8190e50422bc0edc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment