Skip to content

Commit

Permalink
Merge pull request #59 from JuzerShakir/upgrade-rails-8.0
Browse files Browse the repository at this point in the history
Upgrade rails from `7.2.2.1` to `8.0.0.1`
  • Loading branch information
JuzerShakir authored Dec 12, 2024
2 parents aed4635 + 66362e5 commit 251a0f5
Show file tree
Hide file tree
Showing 19 changed files with 406 additions and 314 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ jobs:
bundle install --jobs 4 --retry 3
- name: Scan for common Rails security vulnerabilities using static analysis
run: bundle exec brakeman
run: bin/brakeman

- name: Find linting errors
run: bundle exec erblint -l
run: bundle exec erb_lint --lint-all

- name: Find rubocop errors
run: bin/rubocop

- name: Precompile assets
run: bundle exec rails assets:precompile
run: bin/rails assets:precompile

- name: Running Tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: |
bundle exec rails db:create
bundle exec rails db:migrate
bin/rails db:create
bin/rails db:migrate
bundle exec rspec
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "~> 3.3.6"

gem "rails", "~> 7.2.2"
gem "rails", "~> 8.0.0"

gem "active_record_union"
gem "active_record_union", github: "brianhempel/active_record_union", branch: "master"
gem "bcrypt", "~> 3.1.20"
gem "bootsnap", require: false
gem "cancancan", "~> 3.6.1"
Expand All @@ -21,7 +21,7 @@ gem "prawn", "~> 2.5.0"
gem "prawn-table", "~> 0.2.2"
gem "propshaft"
gem "puma", "~> 6.5.0"
gem "rails-i18n", "~> 7.0.8"
gem "rails-i18n"
gem "ransack", "~> 4.2.1"
gem "redis", "~> 5.3.0"
gem "rolify", "~> 6.0.1"
Expand All @@ -30,7 +30,7 @@ gem "stimulus-rails"
gem "turbo-rails", "~> 2.0.11"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
gem "validates_email_format_of", "~> 1.8.2"
gem "validates_timeliness", "~> 7.0.0"
gem "validates_timeliness", "~> 8.0.0.beta1"

group :development, :test do
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
Expand Down
137 changes: 72 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,68 +1,73 @@
GIT
remote: https://github.com/brianhempel/active_record_union.git
revision: 8ebe558709aabe039abd24e3e7dd4d4354a6de88
branch: master
specs:
active_record_union (1.3.0)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
actioncable (8.0.0.1)
actionpack (= 8.0.0.1)
activesupport (= 8.0.0.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
actionmailbox (8.0.0.1)
actionpack (= 8.0.0.1)
activejob (= 8.0.0.1)
activerecord (= 8.0.0.1)
activestorage (= 8.0.0.1)
activesupport (= 8.0.0.1)
mail (>= 2.8.0)
actionmailer (7.2.2.1)
actionpack (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activesupport (= 7.2.2.1)
actionmailer (8.0.0.1)
actionpack (= 8.0.0.1)
actionview (= 8.0.0.1)
activejob (= 8.0.0.1)
activesupport (= 8.0.0.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.2.1)
actionview (= 7.2.2.1)
activesupport (= 7.2.2.1)
actionpack (8.0.0.1)
actionview (= 8.0.0.1)
activesupport (= 8.0.0.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.2.1)
actionpack (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
actiontext (8.0.0.1)
actionpack (= 8.0.0.1)
activerecord (= 8.0.0.1)
activestorage (= 8.0.0.1)
activesupport (= 8.0.0.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.2.1)
activesupport (= 7.2.2.1)
actionview (8.0.0.1)
activesupport (= 8.0.0.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (7.2.2.1)
activesupport (= 7.2.2.1)
activejob (8.0.0.1)
activesupport (= 8.0.0.1)
globalid (>= 0.3.6)
activemodel (7.2.2.1)
activesupport (= 7.2.2.1)
activerecord (7.2.2.1)
activemodel (= 7.2.2.1)
activesupport (= 7.2.2.1)
activemodel (8.0.0.1)
activesupport (= 8.0.0.1)
activerecord (8.0.0.1)
activemodel (= 8.0.0.1)
activesupport (= 8.0.0.1)
timeout (>= 0.4.0)
activestorage (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activesupport (= 7.2.2.1)
activestorage (8.0.0.1)
actionpack (= 8.0.0.1)
activejob (= 8.0.0.1)
activerecord (= 8.0.0.1)
activesupport (= 8.0.0.1)
marcel (~> 1.0)
activesupport (7.2.2.1)
activesupport (8.0.0.1)
base64
benchmark (>= 0.3)
bigdecimal
Expand All @@ -74,6 +79,7 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
Expand Down Expand Up @@ -213,20 +219,20 @@ GEM
rack (>= 1.0.0)
rackup (2.2.1)
rack (>= 3)
rails (7.2.2.1)
actioncable (= 7.2.2.1)
actionmailbox (= 7.2.2.1)
actionmailer (= 7.2.2.1)
actionpack (= 7.2.2.1)
actiontext (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activemodel (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
rails (8.0.0.1)
actioncable (= 8.0.0.1)
actionmailbox (= 8.0.0.1)
actionmailer (= 8.0.0.1)
actionpack (= 8.0.0.1)
actiontext (= 8.0.0.1)
actionview (= 8.0.0.1)
activejob (= 8.0.0.1)
activemodel (= 8.0.0.1)
activerecord (= 8.0.0.1)
activestorage (= 8.0.0.1)
activesupport (= 8.0.0.1)
bundler (>= 1.15.0)
railties (= 7.2.2.1)
railties (= 8.0.0.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -238,12 +244,12 @@ GEM
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-i18n (7.0.10)
rails-i18n (8.0.1)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
railties (>= 8.0.0, < 9)
railties (8.0.0.1)
actionpack (= 8.0.0.1)
activesupport (= 8.0.0.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -370,12 +376,13 @@ GEM
unicode-display_width (3.1.2)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
useragent (0.16.11)
validates_email_format_of (1.8.2)
i18n (>= 0.8.0)
simpleidn
validates_timeliness (7.0.0)
activemodel (>= 7.0.0, < 8)
validates_timeliness (8.0.0.beta1)
activemodel (>= 8.0.0, < 9)
timeliness (>= 0.3.10, < 1)
web-console (4.2.1)
actionview (>= 6.0.0)
Expand All @@ -394,7 +401,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
active_record_union
active_record_union!
bcrypt (~> 3.1.20)
bootsnap
brakeman
Expand All @@ -417,9 +424,9 @@ DEPENDENCIES
propshaft
puma (~> 6.5.0)
rack_session_access
rails (~> 7.2.2)
rails (~> 8.0.0)
rails-controller-testing (~> 1.0.5)
rails-i18n (~> 7.0.8)
rails-i18n
ransack (~> 4.2.1)
redis (~> 5.3.0)
rolify (~> 6.0.1)
Expand All @@ -442,7 +449,7 @@ DEPENDENCIES
turbo-rails (~> 2.0.11)
tzinfo-data
validates_email_format_of (~> 1.8.2)
validates_timeliness (~> 7.0.0)
validates_timeliness (~> 8.0.0.beta1)
web-console

RUBY VERSION
Expand Down
16 changes: 14 additions & 2 deletions app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
// ? Using the 7-1 pattern for a manageable CSS
// More info here: https://openclassrooms.com/en/courses/5625786-produce-maintainable-css-with-sass/5723581-use-the-7-1-pattern-for-a-manageable-codebase
/*
* This is a manifest file that'll be compiled into app/assets/builds/application.css.
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
* depending on specificity.
*
* Consider organizing styles into separate files for maintainability.
*/

/*
? Using the 7-1 pattern for a manageable CSS
More info here: https://openclassrooms.com/en/courses/5625786-produce-maintainable-css-with-sass/5723581-use-the-7-1-pattern-for-a-manageable-codebase
*/
// ! IMPORTANT - load these files before any other css files
@import "abstracts/themes";
@import "abstracts/variables";
Expand Down
8 changes: 6 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
<title><%= content_for :title || "FMB" %></title>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= yield :head %>

<link rel="manifest" href="/manifest.json">
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>

<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">

<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
<%= favicon_link_tag asset_path("favicon.ico") %>
</head>
Expand Down
7 changes: 7 additions & 0 deletions bin/brakeman
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"

ARGV.unshift("--ensure-latest")

load Gem.bin_path("brakeman", "brakeman")
10 changes: 2 additions & 8 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
#!/usr/bin/env sh

if ! gem list foreman -i --silent; then
echo "Installing foreman..."
gem install foreman
fi

exec foreman start -f Procfile.dev "$@"
#!/usr/bin/env ruby
exec "./bin/rails", "server", *ARGV
17 changes: 7 additions & 10 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
require "fileutils"

APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "fmb"

def system!(*)
system(*, exception: true)
def system!(*args)
system(*args, exception: true)
end

FileUtils.chdir APP_ROOT do
Expand All @@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

# puts "\n== Copying sample files =="
Expand All @@ -28,10 +26,9 @@ FileUtils.chdir APP_ROOT do
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"

puts "\n== Restarting application server =="
system! "bin/rails restart"

# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
unless ARGV.include?("--skip-server")
puts "\n== Starting development server =="
$stdout.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
end
end
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
module Fmb
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2
config.load_defaults 8.0

config.time_zone = "Asia/Kolkata"
config.i18n.available_locales = [:en]
Expand Down
Loading

0 comments on commit 251a0f5

Please sign in to comment.