From 1942276970c6bdab93703c62dc3ab60a32eaf79e Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Sun, 1 Mar 2026 16:58:44 -0600 Subject: [PATCH 1/4] Rework to be a proper Rails plugin # Conflicts: # Gemfile.lock # example_rails7/Gemfile.lock # example_rails8/Gemfile.lock # lib/rolemodel/version.rb --- .gitignore | 2 ++ Gemfile | 2 +- Gemfile.lock | 2 +- README.md | 6 ++--- bin/bump_version | 6 ++--- bin/console | 2 +- bin/recreate_current_example | 2 +- bin/recreate_legacy_example | 2 +- example_rails7/Gemfile | 2 +- example_rails7/Gemfile.lock | 2 +- example_rails8/Gemfile | 2 +- example_rails8/Gemfile.lock | 2 +- lib/generators/rolemodel.rb | 25 ------------------- lib/generators/rolemodel/base_generator.rb | 14 +++++++++++ lib/rolemodel-rails.rb | 7 ++++++ lib/rolemodel/engine.rb | 9 +++++++ lib/{rolemodel_rails => rolemodel}/version.rb | 0 lib/rolemodel_rails.rb | 6 ----- ...l_rails.gemspec => rolemodel-rails.gemspec | 14 ++++------- .../rolemodel/github_generator_spec.rb | 2 +- spec/rails/setup.rb | 15 +++++++++++ spec/rolemodel_rails_spec.rb | 4 +-- spec/spec_helper.rb | 7 +++++- spec/support/helpers/example_app.rb | 2 +- 24 files changed, 77 insertions(+), 60 deletions(-) delete mode 100644 lib/generators/rolemodel.rb create mode 100644 lib/generators/rolemodel/base_generator.rb create mode 100644 lib/rolemodel-rails.rb create mode 100644 lib/rolemodel/engine.rb rename lib/{rolemodel_rails => rolemodel}/version.rb (100%) delete mode 100644 lib/rolemodel_rails.rb rename rolemodel_rails.gemspec => rolemodel-rails.gemspec (66%) create mode 100644 spec/rails/setup.rb diff --git a/.gitignore b/.gitignore index a41c71cf..8d57097e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ log *.gem .history + +.DS_Store diff --git a/Gemfile b/Gemfile index 6d5406cf..6ee7030d 100644 --- a/Gemfile +++ b/Gemfile @@ -4,5 +4,5 @@ source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } -# Specify your gem's dependencies in rolemodel_rails.gemspec +# Specify your gem's dependencies in rolemodel-rails.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 53876148..674b2f4c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -257,7 +257,7 @@ DEPENDENCIES bundler (~> 4) generator_spec (~> 0.10) rake (~> 13) - rolemodel_rails! + rolemodel-rails! rspec (~> 3) rspec_junit_formatter rubocop diff --git a/README.md b/README.md index 320b5278..6b84a297 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Attempts to solve the pain of: ## Precondition -The rolemodel_rails gem expects to be added to an existing Rails project. Typically those are started with: +The rolemodel-rails gem expects to be added to an existing Rails project. Typically those are started with: ```shell rails new --javascript=webpack --database=postgresql --skip-test @@ -29,7 +29,7 @@ Add this line to your application's Gemfile: ```ruby group :development do - gem 'rolemodel_rails', github: 'RoleModel/rolemodel_rails' + gem 'rolemodel-rails', github: 'RoleModel/rolemodel_rails' end ``` @@ -115,7 +115,7 @@ e.g. bin/new_generator testing/fantasitic_specs 'A Fantastic Testing Framework' ``` -We use the embeded Rails apps (`example_rails*`) to test generators against. They reference the rolemodel_rails gem by local path, +We use the embeded Rails apps (`example_rails*`) to test generators against. They reference the rolemodel-rails gem by local path, so you can navigate into one of them and run your generator for immediate feedback while developing. > [!IMPORTANT] diff --git a/bin/bump_version b/bin/bump_version index 3ba1ca6c..763e80f0 100755 --- a/bin/bump_version +++ b/bin/bump_version @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require 'bundler/setup' -require 'rolemodel_rails/version' +require 'rolemodel/version' require 'rake/file_list' require 'thor' @@ -17,7 +17,7 @@ class VersionBumper < Thor::Group source_root File.expand_path('../', __FILE__) def bump_version - gsub_file 'lib/rolemodel_rails/version.rb', /^ VERSION = .*/, " VERSION = '#{new_version_string}'" + gsub_file 'lib/rolemodel/version.rb', /^ VERSION = .*/, " VERSION = '#{new_version_string}'" end def update_lockfile @@ -25,7 +25,7 @@ class VersionBumper < Thor::Group end def build_gem - run 'gem build rolemodel_rails.gemspec' + run 'gem build rolemodel-rails.gemspec' end def update_current_example_app diff --git a/bin/console b/bin/console index 5a8a729a..b80d562f 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require "bundler/setup" -require "rolemodel_rails" +require "rolemodel-rails" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/bin/recreate_current_example b/bin/recreate_current_example index 6d17a224..6119b884 100755 --- a/bin/recreate_current_example +++ b/bin/recreate_current_example @@ -16,7 +16,7 @@ rails _"$RAILS_VERSION"_ new --skip-keeps --skip-git --skip-jbuilder -j webpack cd example_rails$MAJOR_VERSION_NUMBER -bundle add --group development --path '..' --version '> 0.20' rolemodel_rails +bundle add --group development --path '..' --version '> 0.20' rolemodel-rails bundle install rm config/credentials.yml.enc diff --git a/bin/recreate_legacy_example b/bin/recreate_legacy_example index ce4de8e9..9a0e8399 100755 --- a/bin/recreate_legacy_example +++ b/bin/recreate_legacy_example @@ -15,7 +15,7 @@ rails _"$RAILS_VERSION"_ new --skip-keeps --skip-git --skip-jbuilder -j webpack cd example_rails7 -bundle add --group development --path '..' --version '> 0.20' rolemodel_rails +bundle add --group development --path '..' --version '> 0.20' rolemodel-rails bundle install rm config/credentials.yml.enc diff --git a/example_rails7/Gemfile b/example_rails7/Gemfile index b236aa64..1fbe594d 100644 --- a/example_rails7/Gemfile +++ b/example_rails7/Gemfile @@ -54,4 +54,4 @@ group :test do gem "selenium-webdriver" end -gem "rolemodel_rails", "> 0.20", group: :development, path: ".." +gem "rolemodel-rails", "> 0.20", group: :development, path: ".." diff --git a/example_rails7/Gemfile.lock b/example_rails7/Gemfile.lock index e7a88e93..9c38fb2d 100644 --- a/example_rails7/Gemfile.lock +++ b/example_rails7/Gemfile.lock @@ -333,7 +333,7 @@ DEPENDENCIES pg (~> 1.1) puma (>= 5.0) rails (~> 7.2.2, >= 7.2.2.1) - rolemodel_rails (> 0.20)! + rolemodel-rails (> 0.20)! rubocop-rails-omakase selenium-webdriver sprockets-rails diff --git a/example_rails8/Gemfile b/example_rails8/Gemfile index bf5f8131..a079686b 100644 --- a/example_rails8/Gemfile +++ b/example_rails8/Gemfile @@ -63,4 +63,4 @@ group :test do gem "selenium-webdriver" end -gem "rolemodel_rails", "> 0.20", group: :development, path: ".." +gem "rolemodel-rails", "> 0.20", group: :development, path: ".." diff --git a/example_rails8/Gemfile.lock b/example_rails8/Gemfile.lock index a46542f0..6281b619 100644 --- a/example_rails8/Gemfile.lock +++ b/example_rails8/Gemfile.lock @@ -401,7 +401,7 @@ DEPENDENCIES propshaft puma (>= 5.0) rails (~> 8.1.2) - rolemodel_rails (> 0.20)! + rolemodel-rails (> 0.20)! rubocop-rails-omakase selenium-webdriver solid_cable diff --git a/lib/generators/rolemodel.rb b/lib/generators/rolemodel.rb deleted file mode 100644 index e6bc5754..00000000 --- a/lib/generators/rolemodel.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'rails' -require 'pathname' -require 'rails/generators' -require 'rails/generators/bundle_helper' -require_relative 'rolemodel/replace_content_helper' - -module Rolemodel - RUBY_VERSION = Pathname.pwd.join('.ruby-version').read.strip - NODE_VERSION = Pathname.pwd.join('.node-version').read.strip - - class BaseGenerator < Rails::Generators::Base - include Rails::Generators::BundleHelper - include ReplaceContentHelper - - private - # based on https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb#L713 - def run_bundle - bundle_command("install --quiet", "BUNDLE_IGNORE_MESSAGES" => "1") - end - end - - Dir['lib/generators/rolemodel/**/*.rb'].each do |file| - load file if file.end_with?('_generator.rb') - end -end diff --git a/lib/generators/rolemodel/base_generator.rb b/lib/generators/rolemodel/base_generator.rb new file mode 100644 index 00000000..08898ccb --- /dev/null +++ b/lib/generators/rolemodel/base_generator.rb @@ -0,0 +1,14 @@ +require 'rails/generators/base' +require 'rails/generators/bundle_helper' +require_relative 'replace_content_helper' + +class Rolemodel::BaseGenerator < Rails::Generators::Base + include Rails::Generators::BundleHelper, + Rolemodel::ReplaceContentHelper + + private + # based on https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb#L713 + def run_bundle + bundle_command("install --quiet", "BUNDLE_IGNORE_MESSAGES" => "1") + end +end diff --git a/lib/rolemodel-rails.rb b/lib/rolemodel-rails.rb new file mode 100644 index 00000000..fd394225 --- /dev/null +++ b/lib/rolemodel-rails.rb @@ -0,0 +1,7 @@ +module Rolemodel + NODE_VERSION = '24.12.0' + RUBY_VERSION = '4.0.1' +end + +require 'rolemodel/version' +require 'rolemodel/engine' diff --git a/lib/rolemodel/engine.rb b/lib/rolemodel/engine.rb new file mode 100644 index 00000000..d63f12cf --- /dev/null +++ b/lib/rolemodel/engine.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Rolemodel + class Engine < ::Rails::Engine + generators do + require 'generators/rolemodel/base_generator' + end + end +end diff --git a/lib/rolemodel_rails/version.rb b/lib/rolemodel/version.rb similarity index 100% rename from lib/rolemodel_rails/version.rb rename to lib/rolemodel/version.rb diff --git a/lib/rolemodel_rails.rb b/lib/rolemodel_rails.rb deleted file mode 100644 index 31feaac3..00000000 --- a/lib/rolemodel_rails.rb +++ /dev/null @@ -1,6 +0,0 @@ -require "rolemodel_rails/version" -require "generators/rolemodel" - -module RolemodelRails - # Your code goes here... -end diff --git a/rolemodel_rails.gemspec b/rolemodel-rails.gemspec similarity index 66% rename from rolemodel_rails.gemspec rename to rolemodel-rails.gemspec index d2703617..f47e93a4 100644 --- a/rolemodel_rails.gemspec +++ b/rolemodel-rails.gemspec @@ -1,17 +1,13 @@ -# frozen_string_literal: true - -lib = File.expand_path('lib', __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'rolemodel_rails/version' +require_relative 'lib/rolemodel/version' Gem::Specification.new do |spec| - spec.name = 'rolemodel_rails' - spec.version = RolemodelRails::VERSION + spec.name = 'rolemodel-rails' + spec.version = Rolemodel::VERSION spec.authors = ['RoleModel Software Inc'] spec.email = ['it-support@rolemodelsoftware.com'] - spec.summary = 'Rails generators for RoleModel Software project setup.' - spec.description = 'A collection of Rails generators to set up a Rails project with the recommended configuration for RoleModel Software projects.' + spec.summary = 'The RoleModel Way of building Rails apps.' + spec.description = 'A collection of executable best practices for common aspects of Rails application development.' spec.homepage = 'https://github.com/RoleModel/rolemodel_rails' spec.license = 'MIT' diff --git a/spec/generators/rolemodel/github_generator_spec.rb b/spec/generators/rolemodel/github_generator_spec.rb index fcc22291..6d2497b0 100644 --- a/spec/generators/rolemodel/github_generator_spec.rb +++ b/spec/generators/rolemodel/github_generator_spec.rb @@ -28,7 +28,7 @@ it 'creates github pull request template' do assert_file '.github/pull_request_template.md' do |content| - expect(content).not_to include('Update version number in `lib/rolemodel_rails/version.rb`') + expect(content).not_to include('Update version number in `lib/rolemodel/version.rb`') end assert_file '.github/instructions/css.instructions.md' diff --git a/spec/rails/setup.rb b/spec/rails/setup.rb new file mode 100644 index 00000000..a37a321e --- /dev/null +++ b/spec/rails/setup.rb @@ -0,0 +1,15 @@ +# Configure Rails Environment +ENV['RAILS_ENV'] = 'test' + +# require_relative '../test/dummy/config/environment' +# ActiveRecord::Migrator.migrations_paths = [ File.expand_path('../test/dummy/db/migrate', __dir__) ] +# ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__) +require 'rails/test_help' + +# Load fixtures from the engine +if ActiveSupport::TestCase.respond_to?(:fixture_paths=) + # ActiveSupport::TestCase.fixture_paths = [ File.expand_path('fixtures', __dir__) ] + # ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths + # ActiveSupport::TestCase.file_fixture_path = File.expand_path('fixtures', __dir__) + '/files' + # ActiveSupport::TestCase.fixtures :all +end diff --git a/spec/rolemodel_rails_spec.rb b/spec/rolemodel_rails_spec.rb index e4c4ed1c..d871527a 100644 --- a/spec/rolemodel_rails_spec.rb +++ b/spec/rolemodel_rails_spec.rb @@ -1,5 +1,5 @@ -RSpec.describe RolemodelRails do +RSpec.describe Rolemodel do it "has a version number" do - expect(RolemodelRails::VERSION).not_to be nil + expect(Rolemodel::VERSION).not_to be nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a6fa1724..bd835d96 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,12 @@ +require 'rails' require 'bundler/setup' require 'generator_spec' +require 'rolemodel-rails' +require_relative 'rails/setup' require_relative 'support/helpers' -require 'generators/rolemodel' + +require 'generators/rolemodel/base_generator' +Dir[File.expand_path('lib/generators/**/*_generator.rb')].each { require it } RSpec.configure do |config| # Enable flags like --only-failures and --next-failure diff --git a/spec/support/helpers/example_app.rb b/spec/support/helpers/example_app.rb index c6c19eab..10f7ab6f 100644 --- a/spec/support/helpers/example_app.rb +++ b/spec/support/helpers/example_app.rb @@ -28,6 +28,6 @@ def clean_test_gemfile gemfile_path = File.join(destination_root, 'Gemfile') gemfile = File.open(gemfile_path) - File.write(gemfile_path, gemfile.grep_v(/rolemodel_rails/).join) + File.write(gemfile_path, gemfile.grep_v(/rolemodel-rails/).join) end end From 5eb7640d7d60843d1984ec88fc4a376b29be00a9 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Sun, 1 Mar 2026 17:26:26 -0600 Subject: [PATCH 2/4] ci --- .github/workflows/ci.yml | 6 +++--- spec/rails/setup.rb | 15 --------------- spec/spec_helper.rb | 1 - 3 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 spec/rails/setup.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9a9b7ea..8a9c7c5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ concurrency: jobs: run_specs: name: Rspec - runs-on: ubuntu-latest + runs-on: blacksmith-4vcpu-ubuntu-2404 timeout-minutes: 10 env: CI: true @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install Ruby and gems uses: ruby/setup-ruby@v1 @@ -31,7 +31,7 @@ jobs: run: bundle exec rspec --format documentation --format RspecJunitFormatter --out tmp/rspec.xml - name: Publish Rspec Test Results - uses: mikepenz/action-junit-report@v4 + uses: mikepenz/action-junit-report@v6 if: success() || failure() with: check_name: Rspec Test Results diff --git a/spec/rails/setup.rb b/spec/rails/setup.rb deleted file mode 100644 index a37a321e..00000000 --- a/spec/rails/setup.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Configure Rails Environment -ENV['RAILS_ENV'] = 'test' - -# require_relative '../test/dummy/config/environment' -# ActiveRecord::Migrator.migrations_paths = [ File.expand_path('../test/dummy/db/migrate', __dir__) ] -# ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__) -require 'rails/test_help' - -# Load fixtures from the engine -if ActiveSupport::TestCase.respond_to?(:fixture_paths=) - # ActiveSupport::TestCase.fixture_paths = [ File.expand_path('fixtures', __dir__) ] - # ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths - # ActiveSupport::TestCase.file_fixture_path = File.expand_path('fixtures', __dir__) + '/files' - # ActiveSupport::TestCase.fixtures :all -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bd835d96..d46b9c83 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,6 @@ require 'bundler/setup' require 'generator_spec' require 'rolemodel-rails' -require_relative 'rails/setup' require_relative 'support/helpers' require 'generators/rolemodel/base_generator' From 0e7cf3f950280b68f287abe60418bee7b122ad12 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 11:40:57 -0500 Subject: [PATCH 3/4] Apply PR review feedback: frozen string literals and file handle fix (#182) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: OutlawAndy <1504753+OutlawAndy@users.noreply.github.com> --- lib/generators/rolemodel/base_generator.rb | 2 ++ lib/rolemodel-rails.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/support/helpers/example_app.rb | 3 +-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/generators/rolemodel/base_generator.rb b/lib/generators/rolemodel/base_generator.rb index 08898ccb..ebfe333d 100644 --- a/lib/generators/rolemodel/base_generator.rb +++ b/lib/generators/rolemodel/base_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails/generators/base' require 'rails/generators/bundle_helper' require_relative 'replace_content_helper' diff --git a/lib/rolemodel-rails.rb b/lib/rolemodel-rails.rb index fd394225..d6ccc1df 100644 --- a/lib/rolemodel-rails.rb +++ b/lib/rolemodel-rails.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Rolemodel NODE_VERSION = '24.12.0' RUBY_VERSION = '4.0.1' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d46b9c83..56d7e19f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails' require 'bundler/setup' require 'generator_spec' diff --git a/spec/support/helpers/example_app.rb b/spec/support/helpers/example_app.rb index 10f7ab6f..99a9dd26 100644 --- a/spec/support/helpers/example_app.rb +++ b/spec/support/helpers/example_app.rb @@ -26,8 +26,7 @@ def cleanup_test_app def clean_test_gemfile gemfile_path = File.join(destination_root, 'Gemfile') - gemfile = File.open(gemfile_path) - File.write(gemfile_path, gemfile.grep_v(/rolemodel-rails/).join) + File.write(gemfile_path, File.readlines(gemfile_path).grep_v(/rolemodel-rails/).join) end end From 73df8e0267c1ac2a4999ae3916d9895736dba5f6 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Wed, 11 Mar 2026 13:11:43 -0500 Subject: [PATCH 4/4] test dummy apps should not use their own Gemfiles --- .github/workflows/ci.yml | 24 +++++-------- Gemfile | 15 ++++++-- Gemfile.lock | 55 +++++++++++++++++++++-------- bin/bump_version | 18 ++-------- bin/rails | 14 ++++++++ example_rails7/Gemfile | 2 -- example_rails7/Gemfile.lock | 13 +------ example_rails7/config/boot.rb | 7 ++-- example_rails8/Gemfile | 2 -- example_rails8/Gemfile.lock | 8 ----- example_rails8/config/boot.rb | 7 ++-- lib/rolemodel/version.rb | 2 +- rolemodel-rails.gemspec | 2 +- spec/support/helpers/example_app.rb | 18 ++++------ 14 files changed, 94 insertions(+), 93 deletions(-) create mode 100755 bin/rails diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a9c7c5b..cac899a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,9 @@ -name: "CI" +name: CI on: push: - branches: ["master"] + branches: [ master ] pull_request: - branches: ["master"] + branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} @@ -19,19 +19,11 @@ jobs: RAILS_ENV: test steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Install Ruby and gems - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Run specs - run: bundle exec rspec --format documentation --format RspecJunitFormatter --out tmp/rspec.xml - - - name: Publish Rspec Test Results - uses: mikepenz/action-junit-report@v6 + - uses: actions/checkout@v6 + - uses: ruby/setup-ruby@v1 + with: { bundler-cache: true } + - run: bundle exec rspec --format documentation --format RspecJunitFormatter --out tmp/rspec.xml + - uses: mikepenz/action-junit-report@v6 if: success() || failure() with: check_name: Rspec Test Results diff --git a/Gemfile b/Gemfile index 6ee7030d..a8b4dd98 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,16 @@ source 'https://rubygems.org' -git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } - -# Specify your gem's dependencies in rolemodel-rails.gemspec +# Specify your gem's dependencies in rolemodel-rails.gemspec. gemspec + +# Gems which are necessary to boot the included test applications, +# but should not be bundled with this gem may be added here. +gem 'pg' +gem 'propshaft' +gem 'puma' +gem 'stimulus-rails' +gem 'turbo-rails' + +# Start debugger with binding.b [https://github.com/ruby/debug] +gem 'debug', '>= 1.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 674b2f4c..7740bdae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rolemodel_rails (0.27.1) + rolemodel-rails (0.27.1) rails (> 7.1) GEM @@ -90,7 +90,10 @@ GEM connection_pool (3.0.2) crass (1.0.6) date (3.5.1) - diff-lcs (1.5.0) + debug (1.11.1) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.6.2) drb (2.2.3) erb (6.0.1) erubi (1.13.1) @@ -137,17 +140,27 @@ GEM nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) + nokogiri (1.19.0-x86_64-linux-gnu) + racc (~> 1.4) parallel (1.27.0) parser (3.3.8.0) ast (~> 2.4.1) racc + pg (1.6.3-arm64-darwin) + pg (1.6.3-x86_64-linux) pp (0.6.3) prettyprint prettyprint (0.2.0) prism (1.9.0) + propshaft (1.3.1) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack psych (5.3.1) date stringio + puma (7.2.0) + nio4r (~> 2.0) racc (1.8.1) rack (3.2.4) rack-session (2.1.1) @@ -196,19 +209,19 @@ GEM regexp_parser (2.10.0) reline (0.6.3) io-console (~> 0.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.1) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.7) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) rubocop (1.78.0) @@ -232,10 +245,15 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) securerandom (0.4.1) + stimulus-rails (1.3.4) + railties (>= 6.0.0) stringio (3.2.0) thor (1.5.0) timeout (0.6.0) tsort (0.2.0) + turbo-rails (2.0.23) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (3.1.4) @@ -250,18 +268,25 @@ GEM zeitwerk (2.7.4) PLATFORMS - ruby + arm64-darwin-25 + x86_64-linux DEPENDENCIES benchmark bundler (~> 4) + debug (>= 1.0.0) generator_spec (~> 0.10) + pg + propshaft + puma rake (~> 13) rolemodel-rails! rspec (~> 3) rspec_junit_formatter rubocop rubocop-rails + stimulus-rails + turbo-rails BUNDLED WITH - 4.0.5 + 4.0.8 diff --git a/bin/bump_version b/bin/bump_version index 763e80f0..f2b30afc 100755 --- a/bin/bump_version +++ b/bin/bump_version @@ -21,21 +21,15 @@ class VersionBumper < Thor::Group end def update_lockfile - run_clean_bundle_install + Bundler.with_original_env do + run "#{Gem.bin_path("bundler", "bundle")} install --quiet" + end end def build_gem run 'gem build rolemodel-rails.gemspec' end - def update_current_example_app - Rake::FileList.new('example_rails*').each do |example_path| - inside(example_path) do - run_clean_bundle_install - end - end - end - def echo_new_version say "New Gem Version is #{set_color(new_version_string, :yellow)}", :green end @@ -61,12 +55,6 @@ class VersionBumper < Thor::Group ) end - def run_clean_bundle_install - Bundler.with_original_env do - run "#{Gem.bin_path("bundler", "bundle")} install --quiet" - end - end - class << self def banner = 'bin/bump_version [--patch|--major|--version VERSION]' def desc = 'Update Gem Version & Sync Example Apps' diff --git a/bin/rails b/bin/rails new file mode 100755 index 00000000..15ef6abc --- /dev/null +++ b/bin/rails @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails gems +# installed from the root of your application. + +ENGINE_ROOT = File.expand_path("..", __dir__) +ENGINE_PATH = File.expand_path("../lib/rolemodel/engine", __dir__) +APP_PATH = File.expand_path("../example_rails8/config/application", __dir__) + +# Set up gems listed in the Gemfile. +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) + +require "rails/all" +require "rails/engine/commands" diff --git a/example_rails7/Gemfile b/example_rails7/Gemfile index 1fbe594d..e1117abc 100644 --- a/example_rails7/Gemfile +++ b/example_rails7/Gemfile @@ -53,5 +53,3 @@ group :test do gem "capybara" gem "selenium-webdriver" end - -gem "rolemodel-rails", "> 0.20", group: :development, path: ".." diff --git a/example_rails7/Gemfile.lock b/example_rails7/Gemfile.lock index 9c38fb2d..2881e990 100644 --- a/example_rails7/Gemfile.lock +++ b/example_rails7/Gemfile.lock @@ -1,9 +1,3 @@ -PATH - remote: .. - specs: - rolemodel_rails (0.27.1) - rails (> 7.1) - GEM remote: https://rubygems.org/ specs: @@ -135,7 +129,6 @@ GEM marcel (1.1.0) matrix (0.4.3) mini_mime (1.1.5) - mini_portile2 (2.8.9) minitest (5.27.0) msgpack (1.8.0) net-imap (0.5.12) @@ -148,9 +141,6 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.18.10) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-musl) @@ -333,7 +323,6 @@ DEPENDENCIES pg (~> 1.1) puma (>= 5.0) rails (~> 7.2.2, >= 7.2.2.1) - rolemodel-rails (> 0.20)! rubocop-rails-omakase selenium-webdriver sprockets-rails @@ -343,4 +332,4 @@ DEPENDENCIES web-console BUNDLED WITH - 4.0.5 + 2.7.2 diff --git a/example_rails7/config/boot.rb b/example_rails7/config/boot.rb index 988a5ddc..6d349b91 100644 --- a/example_rails7/config/boot.rb +++ b/example_rails7/config/boot.rb @@ -1,4 +1,5 @@ -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +# Set up gems listed in the Gemfile. +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__) -require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" # Speed up boot time by caching expensive operations. +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) +$LOAD_PATH.unshift File.expand_path("../../lib", __dir__) diff --git a/example_rails8/Gemfile b/example_rails8/Gemfile index a079686b..a30b1749 100644 --- a/example_rails8/Gemfile +++ b/example_rails8/Gemfile @@ -62,5 +62,3 @@ group :test do gem "capybara" gem "selenium-webdriver" end - -gem "rolemodel-rails", "> 0.20", group: :development, path: ".." diff --git a/example_rails8/Gemfile.lock b/example_rails8/Gemfile.lock index 6281b619..61901d8c 100644 --- a/example_rails8/Gemfile.lock +++ b/example_rails8/Gemfile.lock @@ -1,9 +1,3 @@ -PATH - remote: .. - specs: - rolemodel_rails (0.27.1) - rails (> 7.1) - GEM remote: https://rubygems.org/ specs: @@ -401,7 +395,6 @@ DEPENDENCIES propshaft puma (>= 5.0) rails (~> 8.1.2) - rolemodel-rails (> 0.20)! rubocop-rails-omakase selenium-webdriver solid_cable @@ -522,7 +515,6 @@ CHECKSUMS regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4 reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 - rolemodel_rails (0.27.1) rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834 diff --git a/example_rails8/config/boot.rb b/example_rails8/config/boot.rb index 988a5ddc..6d349b91 100644 --- a/example_rails8/config/boot.rb +++ b/example_rails8/config/boot.rb @@ -1,4 +1,5 @@ -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +# Set up gems listed in the Gemfile. +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__) -require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" # Speed up boot time by caching expensive operations. +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) +$LOAD_PATH.unshift File.expand_path("../../lib", __dir__) diff --git a/lib/rolemodel/version.rb b/lib/rolemodel/version.rb index 8d28a6b3..b22f8add 100644 --- a/lib/rolemodel/version.rb +++ b/lib/rolemodel/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module RolemodelRails +module Rolemodel VERSION = '0.27.1' end diff --git a/rolemodel-rails.gemspec b/rolemodel-rails.gemspec index f47e93a4..86b7962e 100644 --- a/rolemodel-rails.gemspec +++ b/rolemodel-rails.gemspec @@ -1,7 +1,7 @@ require_relative 'lib/rolemodel/version' Gem::Specification.new do |spec| - spec.name = 'rolemodel-rails' + spec.name = 'rolemodel-rails' spec.version = Rolemodel::VERSION spec.authors = ['RoleModel Software Inc'] spec.email = ['it-support@rolemodelsoftware.com'] diff --git a/spec/support/helpers/example_app.rb b/spec/support/helpers/example_app.rb index 99a9dd26..61daa0aa 100644 --- a/spec/support/helpers/example_app.rb +++ b/spec/support/helpers/example_app.rb @@ -1,13 +1,17 @@ # frozen_string_literal: true module ExampleApp - TEMPLATE_APP_PATH = File.expand_path Dir.glob('./example_rails?').max # Always test against the most recent example app + # Always test against the most recent example app + TEMPLATE_APP_PATH = File.expand_path Dir.glob('./example_rails?').max def prepare_test_app self.destination_root ||= File.expand_path('spec/tmp') cleanup_test_app FileUtils.cp_r(TEMPLATE_APP_PATH, destination_root) - clean_test_gemfile + end + + def cleanup_test_app + FileUtils.rm_rf(destination_root) end # run_generator already captures stdout @@ -19,14 +23,4 @@ def run_generator_against_test_app(*args, generator: described_class) FileUtils.cd(destination_root) { run_generator(*args) } end end - - def cleanup_test_app - FileUtils.rm_rf(destination_root) - end - - def clean_test_gemfile - gemfile_path = File.join(destination_root, 'Gemfile') - - File.write(gemfile_path, File.readlines(gemfile_path).grep_v(/rolemodel-rails/).join) - end end