From 99b3b0ac07ae724b4bf9aa921344ab500c3729ea Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 10:16:49 +0300 Subject: [PATCH 01/14] Add Appraisal --- .github/workflows/main.yml | 12 +++++------- .gitignore | 1 + .rubocop.yml | 1 + Appraisals | 19 +++++++++++++++++++ active_fields.gemspec | 1 + bin/appraisal | 27 +++++++++++++++++++++++++++ gemfiles/rails_7.1.gemfile | 15 +++++++++++++++ gemfiles/rails_7.2.gemfile | 15 +++++++++++++++ gemfiles/rails_8.0.gemfile | 15 +++++++++++++++ gemfiles/rails_8.1.gemfile | 15 +++++++++++++++ 10 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 Appraisals create mode 100755 bin/appraisal create mode 100644 gemfiles/rails_7.1.gemfile create mode 100644 gemfiles/rails_7.2.gemfile create mode 100644 gemfiles/rails_8.0.gemfile create mode 100644 gemfiles/rails_8.1.gemfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbd425d..6e5b642 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 3.4.7 + ruby-version: 3.4 bundler-cache: true - name: Run Rubocop @@ -24,14 +24,11 @@ jobs: test: runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} + name: Ruby ${{ matrix.ruby }} (${{ matrix.appraisal }}) strategy: matrix: - ruby: - - "3.1.7" - - "3.2.9" - - "3.3.10" - - "3.4.7" + ruby: ["3.1", "3.2", "3.3", "3.4"] + appraisal: ["rails_7.1", "rails_7.2", "rails_8.0", "rails_8.1"] services: postgres: image: postgres:17 @@ -49,6 +46,7 @@ jobs: env: RAILS_ENV: test CI: true + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index dc693c7..59d5ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ .ruby-version Gemfile.lock +gemfiles/*.lock TODO.md diff --git a/.rubocop.yml b/.rubocop.yml index bd2f0cc..d965ebb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,6 +14,7 @@ AllCops: TargetRailsVersion: 8.1 NewCops: enable Exclude: + - "gemfiles/*" - "spec/dummy/db/schema.rb" Layout/LineLength: diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..a17bae5 --- /dev/null +++ b/Appraisals @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# See https://github.com/thoughtbot/appraisal for more information. + +appraise "rails_7.1" do + gem "rails", "~> 7.1.0" +end + +appraise "rails_7.2" do + gem "rails", "~> 7.2.0" +end + +appraise "rails_8.0" do + gem "rails", "~> 8.0.0" +end + +appraise "rails_8.1" do + gem "rails", "~> 8.1.0" +end diff --git a/active_fields.gemspec b/active_fields.gemspec index d2e7955..7d65687 100644 --- a/active_fields.gemspec +++ b/active_fields.gemspec @@ -33,6 +33,7 @@ Gem::Specification.new do |spec| # Dependencies spec.add_dependency "rails", ">= 7.1" + spec.add_development_dependency "appraisal" spec.add_development_dependency "factory_bot" spec.add_development_dependency "pg" spec.add_development_dependency "rake" diff --git a/bin/appraisal b/bin/appraisal new file mode 100755 index 0000000..5038ce5 --- /dev/null +++ b/bin/appraisal @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'appraisal' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("appraisal", "appraisal") diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 0000000..9094e2a --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 7.1.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 0000000..9695ab3 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 7.2.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_8.0.gemfile b/gemfiles/rails_8.0.gemfile new file mode 100644 index 0000000..39557fd --- /dev/null +++ b/gemfiles/rails_8.0.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 8.0.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" diff --git a/gemfiles/rails_8.1.gemfile b/gemfiles/rails_8.1.gemfile new file mode 100644 index 0000000..195d332 --- /dev/null +++ b/gemfiles/rails_8.1.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "puma" +gem "propshaft" +gem "importmap-rails" +gem "stimulus-rails" +gem "rails", "~> 8.1.0" + +group :development do + gem "web-console" +end + +gemspec path: "../" From f2d221fccfe3922fe934f3e6b175f401de12c8a3 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 10:35:47 +0300 Subject: [PATCH 02/14] Disable Ruby 3.1 for Rails 8+ --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e5b642..9125c5f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,11 @@ jobs: matrix: ruby: ["3.1", "3.2", "3.3", "3.4"] appraisal: ["rails_7.1", "rails_7.2", "rails_8.0", "rails_8.1"] + exclude: + - ruby: 3.1 + appraisal: rails_8.0 + - ruby: 3.1 + appraisal: rails_8.1 services: postgres: image: postgres:17 From a7fb56b8a7714eac408f0587ae2163fae53b2de7 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 10:57:11 +0300 Subject: [PATCH 03/14] Try fix --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9125c5f..24045a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,6 @@ jobs: env: RAILS_ENV: test CI: true - BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile steps: - name: Checkout code uses: actions/checkout@v4 @@ -61,12 +60,16 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile - name: Set up Dummy run: spec/dummy/bin/setup + env: + BUNDLE_GEMFILE: ../../gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests - run: bin/rspec + run: bin/appraisal ${{ matrix.appraisal }} rspec - name: Run tests with customization - run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/rspec + run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/appraisal ${{ matrix.appraisal }} rspec From a3127a01d09e34770ab6e22a26480ede7bec3ac0 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 11:19:04 +0300 Subject: [PATCH 04/14] Try disable bundler cache --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24045a8..4ca8d7b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true + # bundler-cache: true env: BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile From c912997ae23560479909d8a118af01c024aedf55 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 11:22:30 +0300 Subject: [PATCH 05/14] Enable cache again --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ca8d7b..24045a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - # bundler-cache: true + bundler-cache: true env: BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile From 0fe323fa0e17af28cfd95ec7f7a37ad335d8531d Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 11:37:49 +0300 Subject: [PATCH 06/14] Use bundle exec appraisal --- .github/workflows/main.yml | 4 ++-- bin/appraisal | 27 --------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100755 bin/appraisal diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24045a8..84d8e17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: BUNDLE_GEMFILE: ../../gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests - run: bin/appraisal ${{ matrix.appraisal }} rspec + run: bundle exec appraisal ${{ matrix.appraisal }} rspec - name: Run tests with customization - run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/appraisal ${{ matrix.appraisal }} rspec + run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bundle exec appraisal ${{ matrix.appraisal }} rspec diff --git a/bin/appraisal b/bin/appraisal deleted file mode 100755 index 5038ce5..0000000 --- a/bin/appraisal +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'appraisal' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) - -bundle_binstub = File.expand_path("bundle", __dir__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("appraisal", "appraisal") From 4c44988a36f451fb0e78e6f377051f39bbadfa5c Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 11:58:47 +0300 Subject: [PATCH 07/14] Try fix setup script --- spec/dummy/bin/setup | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/spec/dummy/bin/setup b/spec/dummy/bin/setup index 5e0f9e0..a7cecf9 100755 --- a/spec/dummy/bin/setup +++ b/spec/dummy/bin/setup @@ -16,24 +16,15 @@ 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 ==" - # unless File.exist?("config/database.yml") - # FileUtils.cp "config/database.yml.sample", "config/database.yml" - # end - puts "\n== Preparing database ==" system! "bin/rails db:prepare" + system! "bin/rails db:reset" if ARGV.include?("--reset") 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" end From 42136ab84e3dbd925ee9e95fca0dcc281c4c00cd Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 12:01:32 +0300 Subject: [PATCH 08/14] Do not use appraisal directly in CI --- .github/workflows/main.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84d8e17..5630885 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,11 @@ jobs: BUNDLE_GEMFILE: ../../gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests - run: bundle exec appraisal ${{ matrix.appraisal }} rspec + run: bin/rspec + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests with customization - run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bundle exec appraisal ${{ matrix.appraisal }} rspec + run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/rspec + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile From cb2d8472bdacbebf21b57c9bb286dd25c023ef57 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 12:08:47 +0300 Subject: [PATCH 09/14] Style --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5630885..58c4763 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,10 +30,10 @@ jobs: ruby: ["3.1", "3.2", "3.3", "3.4"] appraisal: ["rails_7.1", "rails_7.2", "rails_8.0", "rails_8.1"] exclude: - - ruby: 3.1 - appraisal: rails_8.0 - - ruby: 3.1 - appraisal: rails_8.1 + - ruby: "3.1" + appraisal: "rails_8.0" + - ruby: "3.1" + appraisal: "rails_8.1" services: postgres: image: postgres:17 From cce777604559db8b3a2d09d561eac9b12acc6c48 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 12:25:40 +0300 Subject: [PATCH 10/14] Debug --- .github/workflows/main.yml | 4 +++- spec/dummy/config/boot.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58c4763..632df20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,6 +74,8 @@ jobs: BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests with customization - run: CHANGE_FIELD_BASE_CLASS=true CHANGE_VALUE_CLASS=true bin/rspec + run: bin/rspec env: + CHANGE_FIELD_BASE_CLASS: true + CHANGE_VALUE_CLASS: true BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index 59459d4..939c67e 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -2,6 +2,6 @@ # Set up gems listed in the Gemfile. ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) - +p ENV["BUNDLE_GEMFILE"], File.exist?(ENV["BUNDLE_GEMFILE"]) require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) From df381c2ac05198551458d40ae6f238f4c39f059b Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 12:55:18 +0300 Subject: [PATCH 11/14] Improve Dummy boot script to properly handle relative path in BUNDLE_GEMFILE --- spec/dummy/config/boot.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index 939c67e..9bb6d01 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -1,7 +1,12 @@ # frozen_string_literal: true +# Convert relative path to absolute, using project root as base +ENV["BUNDLE_GEMFILE"] = File.expand_path( + ENV["BUNDLE_GEMFILE"] || "Gemfile", + File.expand_path("../../..", __dir__), +) + # Set up gems listed in the Gemfile. -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) -p ENV["BUNDLE_GEMFILE"], File.exist?(ENV["BUNDLE_GEMFILE"]) require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) + $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) From 126996e11a17b0af4c47af612d3cf4ec67d9ba19 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 12:59:56 +0300 Subject: [PATCH 12/14] Debug log --- .github/workflows/main.yml | 2 +- spec/dummy/config/boot.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 632df20..8266661 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: - name: Set up Dummy run: spec/dummy/bin/setup env: - BUNDLE_GEMFILE: ../../gemfiles/${{ matrix.appraisal }}.gemfile + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile - name: Run tests run: bin/rspec diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index 9bb6d01..f2d322b 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -1,11 +1,17 @@ # frozen_string_literal: true +p ENV["BUNDLE_GEMFILE"] +p __dir__ +p File.expand_path("../../..", __dir__) + # Convert relative path to absolute, using project root as base ENV["BUNDLE_GEMFILE"] = File.expand_path( ENV["BUNDLE_GEMFILE"] || "Gemfile", File.expand_path("../../..", __dir__), ) +p ENV["BUNDLE_GEMFILE"] + # Set up gems listed in the Gemfile. require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) From 8121a7f9f53d6af99d31c65ec7f0f17800f234cb Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 13:48:53 +0300 Subject: [PATCH 13/14] Try fix --- .github/workflows/main.yml | 41 +++++++++++++++++--------------------- spec/dummy/config/boot.rb | 15 ++------------ 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8266661..85fed7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,31 +51,26 @@ jobs: env: RAILS_ENV: test CI: true + # Use absolute path for BUNDLE_GEMFILE to avoid issues with relative path resolution + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.appraisal }}.gemfile steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - name: Install Ruby and gems - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - env: - BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true - - name: Set up Dummy - run: spec/dummy/bin/setup - env: - BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile + - name: Set up Dummy + run: spec/dummy/bin/setup - - name: Run tests - run: bin/rspec - env: - BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile + - name: Run tests + run: bin/rspec - - name: Run tests with customization - run: bin/rspec - env: - CHANGE_FIELD_BASE_CLASS: true - CHANGE_VALUE_CLASS: true - BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile + - name: Run tests with customization + run: bin/rspec + env: + CHANGE_FIELD_BASE_CLASS: true + CHANGE_VALUE_CLASS: true diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index f2d322b..59459d4 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -1,18 +1,7 @@ # frozen_string_literal: true -p ENV["BUNDLE_GEMFILE"] -p __dir__ -p File.expand_path("../../..", __dir__) - -# Convert relative path to absolute, using project root as base -ENV["BUNDLE_GEMFILE"] = File.expand_path( - ENV["BUNDLE_GEMFILE"] || "Gemfile", - File.expand_path("../../..", __dir__), -) - -p ENV["BUNDLE_GEMFILE"] - # Set up gems listed in the Gemfile. -require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) From 2563d2231b1948380eb893cbb81a9929a2e5a715 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Thu, 27 Nov 2025 13:54:38 +0300 Subject: [PATCH 14/14] Update setup script --- spec/dummy/bin/setup | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/dummy/bin/setup b/spec/dummy/bin/setup index a7cecf9..8103740 100755 --- a/spec/dummy/bin/setup +++ b/spec/dummy/bin/setup @@ -18,6 +18,11 @@ FileUtils.chdir APP_ROOT do puts "== Installing dependencies ==" system("bundle check") || system!("bundle install") + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" + # end + puts "\n== Preparing database ==" system! "bin/rails db:prepare" system! "bin/rails db:reset" if ARGV.include?("--reset") @@ -25,6 +30,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" + # 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