From a13cd403823030ecd6c1f9a6231ed74790bdda79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 3 Dec 2024 00:38:13 +0100 Subject: [PATCH 01/11] Update gems --- Gemfile.lock | 161 ++++++++++++++++++++++++++------------------------- 1 file changed, 82 insertions(+), 79 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a2c1c74..1c7f6fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,29 +12,29 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + actioncable (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailbox (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) mail (>= 2.8.0) - actionmailer (7.2.1.1) - actionpack (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailer (7.2.2) + actionpack (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activesupport (= 7.2.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1.1) - actionview (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionpack (7.2.2) + actionview (= 7.2.2) + activesupport (= 7.2.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -43,36 +43,37 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1.1) - actionpack (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actiontext (7.2.2) + actionpack (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1.1) - activesupport (= 7.2.1.1) + actionview (7.2.2) + activesupport (= 7.2.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.1) - activesupport (= 7.2.1.1) + activejob (7.2.2) + activesupport (= 7.2.2) globalid (>= 0.3.6) - activemodel (7.2.1.1) - activesupport (= 7.2.1.1) - activerecord (7.2.1.1) - activemodel (= 7.2.1.1) - activesupport (= 7.2.1.1) + activemodel (7.2.2) + activesupport (= 7.2.2) + activerecord (7.2.2) + activemodel (= 7.2.2) + activesupport (= 7.2.2) timeout (>= 0.4.0) - activestorage (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activesupport (= 7.2.1.1) + activestorage (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activesupport (= 7.2.2) marcel (~> 1.0) - activesupport (7.2.1.1) + activesupport (7.2.2) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -84,6 +85,7 @@ GEM tzinfo (~> 2.0, >= 2.0.5) ast (2.4.2) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) builder (3.3.0) coderay (1.1.3) @@ -91,7 +93,7 @@ GEM concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - date (3.3.4) + date (3.4.1) docile (1.4.1) drb (2.2.1) erubi (1.13.0) @@ -103,9 +105,9 @@ GEM irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.7.2) + json (2.8.2) language_server-protocol (3.17.0.3) - logger (1.6.1) + logger (1.6.2) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -118,9 +120,9 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.1) + minitest (5.25.2) mysql2 (0.5.6) - net-imap (0.4.16) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) @@ -129,7 +131,7 @@ GEM timeout net-smtp (0.5.0) net-protocol - nio4r (2.7.3) + nio4r (2.7.4) nokogiri (1.16.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -142,14 +144,15 @@ GEM nokogiri (1.16.8-x86_64-linux) racc (~> 1.4) parallel (1.26.3) - parser (3.3.5.0) + parser (3.3.6.0) ast (~> 2.4.1) racc - pg (1.5.8) - pry (0.14.2) + pg (1.5.9) + pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (5.2.1) + date stringio racc (1.8.1) rack (3.1.8) @@ -157,23 +160,22 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (7.2.1.1) - actioncable (= 7.2.1.1) - actionmailbox (= 7.2.1.1) - actionmailer (= 7.2.1.1) - actionpack (= 7.2.1.1) - actiontext (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activemodel (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + rails (7.2.2) + actioncable (= 7.2.2) + actionmailbox (= 7.2.2) + actionmailer (= 7.2.2) + actionpack (= 7.2.2) + actiontext (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activemodel (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) bundler (>= 1.15.0) - railties (= 7.2.1.1) + railties (= 7.2.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -181,9 +183,9 @@ 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) - railties (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + railties (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -191,32 +193,32 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.8.1) psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) redis-client (0.22.2) connection_pool - regexp_parser (2.9.2) - reline (0.5.10) + regexp_parser (2.9.3) + reline (0.5.12) io-console (~> 0.5) - rubocop (1.66.1) + rubocop (1.69.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + rubocop-ast (>= 1.36.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.36.2) parser (>= 3.3.1.0) rubocop-minitest (0.36.0) rubocop (>= 1.61, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - securerandom (0.3.1) + securerandom (0.4.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -225,18 +227,19 @@ GEM simplecov-review (0.3.0) simplecov (>= 0.21.2, < 0.23) simplecov_json_formatter (0.1.4) - stringio (3.1.1) + stringio (3.1.2) thor (1.3.2) - timeout (0.4.1) + timeout (0.4.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.6.0) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) useragent (0.16.10) - webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.1) PLATFORMS linux @@ -255,4 +258,4 @@ DEPENDENCIES simplecov-review BUNDLED WITH - 2.4.21 + 2.5.23 From b9454a90768fd330ca3af796fe23705ee7282237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 3 Dec 2024 00:38:30 +0100 Subject: [PATCH 02/11] Update Ruby versions to the newest for supported branches --- .github/workflows/reviewdog.yml | 4 ++-- .github/workflows/verify.yml | 4 ++-- .ruby-version | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index fa93eef..cc31854 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.5 + ruby-version: 3.3.6 - name: rubocop uses: reviewdog/action-rubocop@v2 with: @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.5 + ruby-version: 3.3.6 - name: reek uses: reviewdog/action-reek@v1 with: diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 064c679..beeea56 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -14,7 +14,7 @@ jobs: matrix: os: [ubuntu-latest] # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' - ruby: ["3.2.5", "3.3.5", truffleruby] + ruby: ["3.2.6", "3.3.6", truffleruby] db: ["mariadb", "mysql", "pg"] runs-on: ${{ matrix.os }} services: @@ -78,7 +78,7 @@ jobs: bin/test - name: Upload coverage - if: ${{ matrix.db == 'pg' && matrix.ruby == '3.2.5' }} + if: ${{ matrix.db == 'pg' && matrix.ruby == '3.2.6' }} uses: actions/upload-artifact@v4 with: name: review.txt diff --git a/.ruby-version b/.ruby-version index fa7adc7..9c25013 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.5 +3.3.6 From 77c9590fe38196dc65e795789f08282a7e1c24a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 3 Dec 2024 00:41:26 +0100 Subject: [PATCH 03/11] Add support for RoR v8 --- Gemfile.lock | 113 +++++++++++++++++++++++---------------------- deploy_pin.gemspec | 2 +- 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c7f6fe..e4de38f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,73 +5,72 @@ PATH colorize (~> 1.1) connection_pool (~> 2.2) parallel (~> 1.23) - rails (~> 7.0) + rails (>= 7.0, < 9.0) redis (> 4.0) ruby-progressbar (~> 1.13) GEM remote: https://rubygems.org/ specs: - actioncable (7.2.2) - actionpack (= 7.2.2) - activesupport (= 7.2.2) + actioncable (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2) - actionpack (= 7.2.2) - activejob (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + actionmailbox (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) mail (>= 2.8.0) - actionmailer (7.2.2) - actionpack (= 7.2.2) - actionview (= 7.2.2) - activejob (= 7.2.2) - activesupport (= 7.2.2) + actionmailer (8.0.0) + actionpack (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activesupport (= 8.0.0) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2) - actionview (= 7.2.2) - activesupport (= 7.2.2) + actionpack (8.0.0) + actionview (= 8.0.0) + activesupport (= 8.0.0) 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) - actionpack (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + actiontext (8.0.0) + actionpack (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2) - activesupport (= 7.2.2) + actionview (8.0.0) + activesupport (= 8.0.0) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2) - activesupport (= 7.2.2) + activejob (8.0.0) + activesupport (= 8.0.0) globalid (>= 0.3.6) - activemodel (7.2.2) - activesupport (= 7.2.2) - activerecord (7.2.2) - activemodel (= 7.2.2) - activesupport (= 7.2.2) + activemodel (8.0.0) + activesupport (= 8.0.0) + activerecord (8.0.0) + activemodel (= 8.0.0) + activesupport (= 8.0.0) timeout (>= 0.4.0) - activestorage (7.2.2) - actionpack (= 7.2.2) - activejob (= 7.2.2) - activerecord (= 7.2.2) - activesupport (= 7.2.2) + activestorage (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activesupport (= 8.0.0) marcel (~> 1.0) - activesupport (7.2.2) + activesupport (8.0.0) base64 benchmark (>= 0.3) bigdecimal @@ -83,6 +82,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) ast (2.4.2) base64 (0.2.0) benchmark (0.4.0) @@ -162,20 +162,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (7.2.2) - actioncable (= 7.2.2) - actionmailbox (= 7.2.2) - actionmailer (= 7.2.2) - actionpack (= 7.2.2) - actiontext (= 7.2.2) - actionview (= 7.2.2) - activejob (= 7.2.2) - activemodel (= 7.2.2) - activerecord (= 7.2.2) - activestorage (= 7.2.2) - activesupport (= 7.2.2) + rails (8.0.0) + actioncable (= 8.0.0) + actionmailbox (= 8.0.0) + actionmailer (= 8.0.0) + actionpack (= 8.0.0) + actiontext (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activemodel (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) bundler (>= 1.15.0) - railties (= 7.2.2) + railties (= 8.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -183,9 +183,9 @@ 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) - railties (7.2.2) - actionpack (= 7.2.2) - activesupport (= 7.2.2) + railties (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -235,6 +235,7 @@ 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.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) diff --git a/deploy_pin.gemspec b/deploy_pin.gemspec index 4b9f907..51fdbd3 100644 --- a/deploy_pin.gemspec +++ b/deploy_pin.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'colorize', '~> 1.1' spec.add_dependency 'connection_pool', '~> 2.2' spec.add_dependency 'parallel', '~> 1.23' - spec.add_dependency 'rails', '~> 7.0' + spec.add_dependency 'rails', '>= 7.0', '< 9.0' spec.add_dependency 'redis', '> 4.0' spec.add_dependency 'ruby-progressbar', '~> 1.13' From f721357fdd282dda39927040e0b831f70a5c478a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 3 Dec 2024 00:42:10 +0100 Subject: [PATCH 04/11] Update autogenerated config for the newer RuboCop version --- .rubocop_todo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7f008b9..a713283 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-10-17 14:41:35 UTC using RuboCop version 1.66.1. +# on 2024-12-31 14:12:18 UTC using RuboCop version 1.69.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -23,7 +23,7 @@ Lint/Void: Metrics/AbcSize: Max: 20 -# Offense count: 2 +# Offense count: 1 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. # AllowedMethods: refine Metrics/BlockLength: @@ -85,7 +85,7 @@ Style/MixinUsage: # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Max: 121 From 03b45ff1917ce481f3033bc18663276f077dc328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 3 Dec 2024 01:00:51 +0100 Subject: [PATCH 05/11] Use proper migration version based on used RoR release --- lib/generators/deploy_pin/install/install_generator.rb | 4 ++++ .../deploy_pin/install/templates/create_deploy_pins.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/generators/deploy_pin/install/install_generator.rb b/lib/generators/deploy_pin/install/install_generator.rb index 16404a9..7a547b0 100644 --- a/lib/generators/deploy_pin/install/install_generator.rb +++ b/lib/generators/deploy_pin/install/install_generator.rb @@ -19,5 +19,9 @@ def copy_migrations def copy_initializer template 'deploy_pin.rb', 'config/initializers/deploy_pin.rb' end + + def migration_version + "[#{ActiveRecord::Migration.current_version}]" + end end end diff --git a/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb b/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb index 5dc0377..2bfa90b 100644 --- a/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb +++ b/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateDeployPins < ActiveRecord::Migration[7.0] +class CreateDeployPins < ActiveRecord::Migration<%= migration_version %> def change create_table :deploy_pins do |t| t.string :uuid From d0d4b29c6f57a11ee0041ea8d19eddd9fcc6d130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 31 Dec 2024 14:03:24 +0000 Subject: [PATCH 06/11] Exclude RoR templates from Rubocop config - they're not interpolated by Rubocop anyway --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 12 ++---------- .../deploy_pin/install/install_generator.rb | 8 ++++++-- .../install/templates/create_deploy_pins.rb | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a3d61f6..1015a4e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,8 @@ inherit_from: .rubocop_todo.yml require: rubocop-minitest AllCops: + Exclude: + - lib/generators/deploy_pin/**/templates/**/*.rb NewCops: disable TargetRubyVersion: 3.1 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a713283..b9c2cb9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-12-31 14:12:18 UTC using RuboCop version 1.69.0. +# on 2024-12-31 14:12:31 UTC using RuboCop version 1.69.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -23,12 +23,6 @@ Lint/Void: Metrics/AbcSize: Max: 20 -# Offense count: 1 -# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. -# AllowedMethods: refine -Metrics/BlockLength: - Max: 29 - # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: @@ -57,7 +51,7 @@ Security/Eval: Exclude: - 'lib/deploy_pin/task.rb' -# Offense count: 13 +# Offense count: 11 # Configuration parameters: AllowedConstants. Style/Documentation: Exclude: @@ -73,9 +67,7 @@ Style/Documentation: - 'lib/deploy_pin/task.rb' - 'lib/deploy_pin/task_criteria.rb' - 'lib/generators/deploy_pin/install/install_generator.rb' - - 'lib/generators/deploy_pin/install/templates/create_deploy_pins.rb' - 'lib/generators/deploy_pin/task/task_generator.rb' - - 'lib/generators/deploy_pin/upgrade/templates/upgrade_deploy_pins.rb' # Offense count: 2 Style/MixinUsage: diff --git a/lib/generators/deploy_pin/install/install_generator.rb b/lib/generators/deploy_pin/install/install_generator.rb index 7a547b0..add92bc 100644 --- a/lib/generators/deploy_pin/install/install_generator.rb +++ b/lib/generators/deploy_pin/install/install_generator.rb @@ -20,8 +20,12 @@ def copy_initializer template 'deploy_pin.rb', 'config/initializers/deploy_pin.rb' end - def migration_version - "[#{ActiveRecord::Migration.current_version}]" + def activerecord_migration_class + if ::ActiveRecord::Migration.respond_to?(:current_version) + "ActiveRecord::Migration[#{::ActiveRecord::Migration.current_version}]" + else + 'ActiveRecord::Migration' + end end end end diff --git a/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb b/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb index 2bfa90b..6004414 100644 --- a/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb +++ b/lib/generators/deploy_pin/install/templates/create_deploy_pins.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateDeployPins < ActiveRecord::Migration<%= migration_version %> +class CreateDeployPins < <%= activerecord_migration_class %> def change create_table :deploy_pins do |t| t.string :uuid From 5f08fc147a8718c233c75386a20cfd1a2063d2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 31 Dec 2024 14:07:38 +0000 Subject: [PATCH 07/11] Update gems once again --- Gemfile.lock | 164 +++++++++++++++++++++++++-------------------------- 1 file changed, 81 insertions(+), 83 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e4de38f..d3fd044 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,29 +12,29 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (8.0.0) - actionpack (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activesupport (= 8.0.0) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0) - actionview (= 8.0.0) - activesupport (= 8.0.0) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -42,35 +42,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0) - actionpack (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0) - activesupport (= 8.0.0) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0) - activesupport (= 8.0.0) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (8.0.0) - activesupport (= 8.0.0) - activerecord (8.0.0) - activemodel (= 8.0.0) - activesupport (= 8.0.0) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activestorage (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activesupport (= 8.0.0) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (8.0.0) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -86,7 +86,7 @@ GEM ast (2.4.2) base64 (0.2.0) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) builder (3.3.0) coderay (1.1.3) colorize (1.1.0) @@ -96,18 +96,18 @@ GEM date (3.4.1) docile (1.4.1) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) globalid (1.2.1) activesupport (>= 6.1) i18n (1.14.6) concurrent-ruby (~> 1.0) - io-console (0.7.2) - irb (1.14.1) + io-console (0.8.0) + irb (1.14.3) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.8.2) + json (2.9.1) language_server-protocol (3.17.0.3) - logger (1.6.2) + logger (1.6.4) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -120,9 +120,9 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.2) + minitest (5.25.4) mysql2 (0.5.6) - net-imap (0.5.1) + net-imap (0.5.4) date net-protocol net-pop (0.1.2) @@ -132,60 +132,58 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.16.8) + nokogiri (1.18.1) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.8-aarch64-linux) + nokogiri (1.18.1-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.8-arm-linux) + nokogiri (1.18.1-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.8-x86-linux) - racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.18.1-x86_64-linux-gnu) racc (~> 1.4) parallel (1.26.3) parser (3.3.6.0) ast (~> 2.4.1) racc pg (1.5.9) - pry (0.15.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.1) + psych (5.2.2) date stringio racc (1.8.1) rack (3.1.8) rack-session (2.0.0) rack (>= 3.0.0) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.0) - actioncable (= 8.0.0) - actionmailbox (= 8.0.0) - actionmailer (= 8.0.0) - actionpack (= 8.0.0) - actiontext (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activemodel (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 8.0.0) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.1) + rails-html-sanitizer (1.6.2) 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) - railties (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -193,32 +191,32 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.8.1) + rdoc (6.10.0) psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.23.0) connection_pool - regexp_parser (2.9.3) - reline (0.5.12) + regexp_parser (2.10.0) + reline (0.6.0) io-console (~> 0.5) - rubocop (1.69.0) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.36.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.36.2) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) rubocop-minitest (0.36.0) rubocop (>= 1.61, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - securerandom (0.4.0) + securerandom (0.4.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -229,14 +227,14 @@ GEM simplecov_json_formatter (0.1.4) stringio (3.1.2) thor (1.3.2) - timeout (0.4.2) + timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.2) + unicode-display_width (3.1.3) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) uri (1.0.2) - useragent (0.16.10) + useragent (0.16.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) From 9895120b77b8c4983838b582e20be1b3cf2c0a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 31 Dec 2024 14:49:08 +0000 Subject: [PATCH 08/11] Exclude templates from reek config as well --- .reek.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.reek.yml b/.reek.yml index 1d23d22..5269b60 100644 --- a/.reek.yml +++ b/.reek.yml @@ -10,3 +10,6 @@ directories: "test": UtilityFunction: enabled: false + +exclude_paths: + - lib/generators/deploy_pin/**/templates/**/*.rb From c583abb3182c30d48d1218bfbb60c252defd0bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 31 Dec 2024 14:58:51 +0000 Subject: [PATCH 09/11] Add an info about the potential way of running tests locally --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index c4b4b14..70e4a9c 100644 --- a/README.md +++ b/README.md @@ -241,5 +241,34 @@ bundle exec rake deploy_pin:run[rollback] - # enters "pending state" ## Contributing Contribution directions go here. +### Running Tests Locally + +To ensure your changes meet the required standards and pass all tests before submitting a pull request, you can simulate the GitHub Actions workflow locally using the [`act`](https://github.com/nektos/act) tool. + +#### Prerequisites + +1. **Install `act`** + Follow the installation guide provided in the official [`act` documentation](https://nektosact.com/installation/index.html). + +2. **Docker** + Ensure Docker is installed and running on your machine. + +#### Running the Workflow + +Use the following command to simulate the workflow locally: + +```bash +act pull_request --secret-file .env --container-architecture linux/amd64 -W .github/workflows -j rspec +``` + +This command does the following: +- `pull_request`: Runs the pull_request workflow defined in your .github/workflows directory. +- `--secret-file .env`: Uses the .env file provided in the repository to load environment variables. +- `--container-architecture linux/amd64`: Ensures compatibility with GitHub Actions runners. +- `-W .github/workflows`: Specifies the directory containing the workflow files. +- `-j rspec`: Runs the `rspec` job defined in the workflow. + +For more details on customizing this command, refer to the [act documentation](https://nektosact.com/). + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). From feb917093cad40e1d77a211d32aea03d7f3fe8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Tue, 7 Jan 2025 14:41:30 +0100 Subject: [PATCH 10/11] Update Gemfile.lock --- Gemfile.lock | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d3fd044..1b0bb61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,7 +91,7 @@ GEM coderay (1.1.3) colorize (1.1.0) concurrent-ruby (1.3.4) - connection_pool (2.4.1) + connection_pool (2.5.0) crass (1.0.6) date (3.4.1) docile (1.4.1) @@ -107,8 +107,8 @@ GEM reline (>= 0.4.2) json (2.9.1) language_server-protocol (3.17.0.3) - logger (1.6.4) - loofah (2.23.1) + logger (1.6.5) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -122,7 +122,7 @@ GEM mini_portile2 (2.8.8) minitest (5.25.4) mysql2 (0.5.6) - net-imap (0.5.4) + net-imap (0.5.5) date net-protocol net-pop (0.1.2) @@ -154,7 +154,8 @@ GEM stringio racc (1.8.1) rack (3.1.8) - rack-session (2.0.0) + rack-session (2.1.0) + base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) @@ -195,12 +196,12 @@ GEM psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -230,12 +231,13 @@ GEM timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.3) + unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) uri (1.0.2) useragent (0.16.11) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.7.1) From 50ee897237c2b923249fa61f18ed3f69999ba92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Sun, 19 Jan 2025 16:22:37 +0100 Subject: [PATCH 11/11] Update Ruby and other dependencies as a new version has been releases --- .github/workflows/reviewdog.yml | 4 ++-- .github/workflows/verify.yml | 2 +- .ruby-version | 2 +- Gemfile.lock | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index cc31854..08775ce 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.6 + ruby-version: 3.3.7 - name: rubocop uses: reviewdog/action-rubocop@v2 with: @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.6 + ruby-version: 3.3.7 - name: reek uses: reviewdog/action-reek@v1 with: diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index beeea56..3d7539b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -14,7 +14,7 @@ jobs: matrix: os: [ubuntu-latest] # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' - ruby: ["3.2.6", "3.3.6", truffleruby] + ruby: ["3.2.6", "3.3.7", truffleruby] db: ["mariadb", "mysql", "pg"] runs-on: ${{ matrix.os }} services: diff --git a/.ruby-version b/.ruby-version index 9c25013..86fb650 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.6 +3.3.7 diff --git a/Gemfile.lock b/Gemfile.lock index 1b0bb61..474502c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,7 +90,7 @@ GEM builder (3.3.0) coderay (1.1.3) colorize (1.1.0) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.5.0) crass (1.0.6) date (3.4.1) @@ -142,14 +142,14 @@ GEM nokogiri (1.18.1-x86_64-linux-gnu) racc (~> 1.4) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.0) ast (~> 2.4.1) racc pg (1.5.9) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.2) + psych (5.2.3) date stringio racc (1.8.1) @@ -192,11 +192,11 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.10.0) + rdoc (6.11.0) psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.1) + redis-client (0.23.2) connection_pool regexp_parser (2.10.0) reline (0.6.0)