Last active
May 23, 2022 23:32
-
-
Save loso-nd/0f60fd61f14f8695640b3b167fb59eed to your computer and use it in GitHub Desktop.
Upgrade Ruby and Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Step 1: ./bin/setup | |
| - Running this command to see where were are at with the application | |
| Step 2: | |
| - In the project within the Gemfile change the following: | |
| gem 'rails', '4.2.5' => '4.2.8' | |
| ruby "2.2.0" => "2.5.0" | |
| - In .ruby-version change current ruby listed as "2.2.0" => "2.5.0" | |
| - Replace the following: | |
| #source 'https://rails-assets.org' do | |
| to the following: | |
| source 'http://insecure.rails-assets.org' do | |
| - In terminal run => bundle update | |
| Step 3: | |
| - In terminal run => gem install bundler:2.0.0.pre.3 | |
| - In Gemfile replace => gem 'bundler', '>= 1.8.4' with gem 'bundler', '>= 2.0.0.pre.3' | |
| - In terminal run => bundle _2.0.0.pre.3_ update ( this should Install all necessary gems and - Bundle Updated!) | |
| => ./bin/setup | |
| Step 5 | |
| * Since I am running on a mac with M1 chip, the configuration for 'pg' will be missing and/or configurations will be | |
| setup up differently. Therefore I will be using the postgres application. | |
| - Download the Postgres app from https://postgresapp.com/ | |
| - Ensure that the app is up and started by selecting the start button. The postgres app should be able to automatically | |
| pick up the current application you are attempting to run. | |
| - In Gemfile replace => gem 'pg' => gem 'pg', '0.18.0' | |
| - In terminal run => gem install pg -v 0.18.0 | |
| - Change pg in Gemfile.lock | |
| => ./bin/setup | |
| => rails s | |
| Potential Errors: | |
| - Sprockets::FileNotFound - couldn't find file 'jasny-bootstrap' with type 'application/javascript' | |
| Fix: | |
| * Remove group "assets" from Gemfile. It is obsolete in Rails 4. Rails 4.0 removed the assets group from Gemfile. | |
| You'd need to remove that line from your Gemfile when upgrading. You can remove them or comment it out | |
| Example... | |
| # source 'https://rails-assets.org' do | |
| # gem 'rails-assets-bootstrap' | |
| # gem 'rails-assets-jasny-bootstrap' | |
| # gem 'rails-assets-handlebars' | |
| # gem 'rails-assets-datatables' | |
| # gem 'rails-assets-datatables-fixedcolumns' | |
| # gem 'rails-assets-typeahead.js' | |
| # end | |
| Potential Errors: | |
| - Sprockets::FileNotFound - couldn't find file 'bootstrap' with type 'application/javascript' | |
| Fix: | |
| Follow the instructions on the here: https://github.com/twbs/bootstrap-sass#a-ruby-on-rails | |
| - In app/assets/javascripts/application.js remove the folllowing: | |
| //= require bootstrap => replace with //= require bootstrap-sprockets | |
| //= require jasny-bootstrap | |
| //= require handlebars | |
| //= require typeahead.js | |
| //= require datatables | |
| //= require datatables-fixedcolumns | |
| Potential Errors: | |
| - Sprockets::Rails::Helper::AssetNotPrecompiled - chartkick.js: | |
| app/views/layouts/application.html.haml:5:in `_app_views_layouts_application_html_haml___4589049011907545223_2182452720' | |
| Fix | |
| - In app/views/ayouts/appication.html.haml remove 'chartkick' from | |
| = javascript_include_tag "//www.google.com/jsapi", "chartkick" | |
| = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'true' | |
| = javascript_include_tag 'application', 'data-turbolinks-track' => true | |
| - In terminal run => gem cleanup | |
| rails s | |
| This will load the application and get it running. | |
| Run the Google OAuth from the email sent by liam | |
| ---- 0 ----- | |
| Ruby 2.5.0 | Rails 4.2.8 > 5.2.0 | |
| STEP 1: | |
| fastruby/ next_rails : https://github.com/fastruby/next_rails | |
| - Follow the steps: Installing Next Rails: | |
| This is a toolkit to upgrade your next Rails application. It will help you set up dual booting, | |
| track deprecation warnings, and get a report on outdated dependencies for any Rails application. | |
| - RailsDiff (https://railsdiff.org/4.2.8/5.2.0) | |
| RailsDiff is about what you'd have to change about your app's configuration when upgrading Rails versions, | |
| not about what Rails has changed internally. Manually added new files | |
| STEP 2: | |
| - Be sure to have Postgres App running in background | |
| - In Terminal run => bundle install | |
| Errors -- Errors | |
| Bundler found conflicting requirements for the Ruby version: | |
| In Gemfile: | |
| Ruby (~> 2.5.0.0) | |
| capybara (>= 2.15, < 4.0) was resolved to 3.35.3, which depends on | |
| nokogiri (~> 1.8) was resolved to 1.13.6, which depends on | |
| Ruby (>= 2.6.0) | |
| Fix | |
| - In Gemfile add => gem 'bundler', '~> 2.3', '>= 2.0.0.pre3' | |
| - In Terminal run => rm Gemfile.lock | |
| comment out the specified versions for the following: | |
| - gem 'redis'#, '~> 4.0' | |
| - gem 'friendly_id'#, '~> 5.0.0' | |
| - gem 'listen' #, '>= 3.0.5', '< 3.2' | |
| - gem 'capybara' #, '>= 2.15', '< 4.0' | |
| comment out the following entirely: | |
| - # gem 'bootstrap_form' | |
| - # gem 'ransack' | |
| - # gem 'rdiscount', require: 'tilt/rdiscount' | |
| - # gem 'guard' | |
| - # gem 'guard-minitest' | |
| - # gem 'binding_of_caller' | |
| - # gem 'quiet_assets' | |
| - # gem 'pry-rails' | |
| remove the following | |
| - quiet_assests | |
| - # gem 'puma' ( in group: productions do...) | |
| - In terminal run => bundle install | |
| STEP 3: | |
| - In terminal run => bundle fund | |
| gem install cancancan | |
| bundle install | |
| Potentional Errors: | |
| - Could not find puma-3.12.6, coffee-rails-4.2.2, refile-0.3.0, rest-client-1.7.3 in any of the sources | |
| Fix: | |
| - In Gemfile => channge puma, coffe-rails to the verions suggested above | |
| update gem 'rails', '~> 5.2.8' ( rails updated on its on via bundle install) | |
| Rails Diff: https://railsdiff.org/5.2.0/5.2.8 | |
| bundle install | |
| gem install refile | |
| gem install simple_form | |
| gem cleanup | |
| ** Some errors occur and resovled to 5.2.1.rc1 | |
| - Update Gemfile according to : https://railsdiff.org/5.2.0/5.2.1.rc1 | |
| ---- 0 ----- | |
| Continue Upgrading: Ruby 2.7.0 & Rails 6.0.0 | |
| STEP 1: | |
| - In terminal run => bundle update rails | |
| gem cleanup | |
| STEP 2: | |
| - In Gemfile update the ruby and rails to the following: | |
| ruby 2.6.0 | |
| rails 6.0.0 | |
| * change the ruby verions in the .ruby-version file | |
| STEP 3: | |
| - Update the files from Rails Diff (https://railsdiff.org/5.2.8/6.0.0) | |
| - In Gemfile be sure to have the following gems included: | |
| gem "refile", require: "refile/rails" | |
| gem 'simple_form' | |
| gem "refile-mini_magick" | |
| - In terminal run => rm Gemfile.lock | |
| gem install activemodel -v 6.1.0.rc1 --pre | |
| bundle_report compatibility --rails-version=6.0.0 | |
| gem install refile -v 0.6.0 | |
| bundle install | |
| gem cleanup | |
| /* Errors: | |
| Bundler found conflicting requirements for the Ruby version: | |
| In Gemfile: | |
| capybara (>= 2.15) was resolved to 3.37.1, which depends on | |
| Ruby (>= 2.7.0) | |
| Current Ruby version: | |
| Ruby (= 2.6.0) | |
| */ | |
| In Gemfile and .ruby-version update the ruby version to 2.7.0 | |
| Rails Diff: https://railsdiff.org/6.0.0/6.0.5 | |
| In Gemfile.lock change refile(0.3.0) > refile (0.6.0) | |
| gem install bundler:2.3.13 | |
| gem install refile -v 0.6.0 | |
| gem install rest-client -v 1.8.0 | |
| bundle install | |
| Fix: | |
| gem install coffee-rails | |
| gem 'coffee-rails', '~> 5.0' (*installs railties, actionview, actionpack, activesupport) | |
| bundle update | |
| /* | |
| Errors: | |
| Bundler could not find compatible versions for gem "activemodel": | |
| In Gemfile: | |
| rails (= 6.1.0) was resolved to 6.1.0, which depends on | |
| activemodel (= 6.1.0) | |
| web-console (~> 2.0) was resolved to 2.0.0, which depends on | |
| activemodel (~> 4.0) | |
| */ | |
| gem install web-console | |
| gem 'web-console', '~> 4.2' (* includes activemodel) | |
| bundle update | |
| /* | |
| Errors: | |
| Bundler could not find compatible versions for gem "rails": | |
| In Gemfile: | |
| rails (= 6.1.0) | |
| jquery-rails was resolved to 0.1.2, which depends on | |
| rails (~> 3.0.0.rc) | |
| Bundler could not find compatible versions for gem "railties": | |
| In Gemfile: | |
| rails (= 6.1.0) was resolved to 6.1.0, which depends on | |
| railties (= 6.1.0) | |
| sass-rails (~> 5.0) was resolved to 5.0.4, which depends on | |
| railties (< 5.0, >= 4.0.0) | |
| */ | |
| Fix: | |
| gem install sass-rails | |
| gem 'sass-rails', '~> 6.0' | |
| gem install jquery-rails | |
| gem 'jquery-rails', '~> 4.4' | |
| bundle update | |
| /* | |
| Bundler could not find compatible versions for gem "rails": | |
| In Gemfile: | |
| rails (= 6.1.0) | |
| quiet_assets was resolved to 1.0.0, which depends on | |
| rails (~> 3.1) | |
| */ | |
| Fix | |
| - https://projects.theforeman.org/issues/18500 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment