From b970c5ac31bc22225927df7525355b59f5124ad4 Mon Sep 17 00:00:00 2001 From: Larry Reid Date: Fri, 31 Oct 2025 21:55:47 +0000 Subject: [PATCH 1/3] Rake without bundle exec Also RuboCop changes --- .rubocop.yml | 7 +++++-- Rakefile | 28 ++++++++++++---------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index af7b7d59..f6bf4068 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ AllCops: DisplayCopNames: true DisplayStyleGuide: true TargetRubyVersion: 3.2 - TargetRailsVersion: 7.1 + TargetRailsVersion: 7.2 NewCops: enable Exclude: - bin/* @@ -25,7 +25,6 @@ AllCops: - gemfiles/vendor/bundle/**/* - vendor/bundle/**/* - Guardfile - - Rakefile - vendor/**/* Layout/LineLength: @@ -73,6 +72,10 @@ Rails/ApplicationRecord: Exclude: - "demo/db/migrate/**" +Rails/RakeEnvironment: + Exclude: + - "Rakefile" + Rails/RefuteMethods: Enabled: false diff --git a/Rakefile b/Rakefile index b8ab3040..02f48e18 100644 --- a/Rakefile +++ b/Rakefile @@ -1,30 +1,27 @@ begin - require 'bundler/setup' - - require 'bundler/gem_tasks' + require "bundler/setup" + require "bundler/gem_tasks" require "minitest/test_task" - require 'rdoc/task' - require 'rubocop/rake_task' + require "rdoc/task" + require "rubocop/rake_task" rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' + puts "You must run `bundle install` to run rake tasks" end RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'BootstrapForm' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.md') - rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.rdoc_dir = "rdoc" + rdoc.title = "BootstrapForm" + rdoc.options << "--line-numbers" + rdoc.rdoc_files.include("README.md") + rdoc.rdoc_files.include("lib/**/*.rb") end Minitest::TestTask.create(:test) do |t| - t.libs << "test" - t.libs << "lib" t.warning = false t.test_globs = ["test/**/*_test.rb"] end -desc 'Run RuboCop checks' +desc "Run RuboCop checks" RuboCop::RakeTask.new(:rubocop) task default: %i[test rubocop:autocorrect] @@ -32,7 +29,7 @@ task default: %i[test rubocop:autocorrect] namespace :test do desc "Run tests for all supported Rails versions, with current Ruby version" task :all do - original_gemfile = ENV["BUNDLE_GEMFILE"] + original_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil) gemfiles = Dir.glob("gemfiles/*.gemfile").reject { |f| File.basename(f) == "common.gemfile" } gemfiles.each do |f| ENV["BUNDLE_GEMFILE"] = f @@ -45,7 +42,6 @@ namespace :test do ENV.delete("BUNDLE_GEMFILE") system("bundle check") || system("bundle install") system("bundle exec rake test:all") - ensure original_gemfile.nil? ? ENV.delete("BUNDLE_GEMFILE") : ENV["BUNDLE_GEMFILE"] = original_gemfile Dir.chdir(original_directory) unless original_directory.nil? From 0767d734d63306d223e984483085e1baaf58c60c Mon Sep 17 00:00:00 2001 From: Larry Reid Date: Sun, 2 Nov 2025 21:30:55 +0000 Subject: [PATCH 2/3] Use new configuration (cont'd) --- lib/bootstrap_form/form_builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootstrap_form/form_builder.rb b/lib/bootstrap_form/form_builder.rb index e866c855..77dd0b55 100644 --- a/lib/bootstrap_form/form_builder.rb +++ b/lib/bootstrap_form/form_builder.rb @@ -69,7 +69,7 @@ def initialize(object_name, object, template, options) def add_default_form_attributes_and_form_inline(options) options[:html] ||= {} - options[:html].reverse_merge!(BootstrapForm.config.default_form_attributes) + options[:html].reverse_merge!(BootstrapForm.configuration.default_form_attributes) return unless options[:layout] == :inline From 5e3ed5a53bf4447a6c67be425c4daa30741aa078 Mon Sep 17 00:00:00 2001 From: Larry Reid Date: Wed, 5 Nov 2025 20:27:02 +0000 Subject: [PATCH 3/3] Pull over other differences --- .yarnrc | 2 +- Rakefile | 12 +++++++----- demo/Gemfile | 4 ++-- demo/Gemfile.lock | 2 +- gemfiles/common.gemfile | 1 + lib/bootstrap_form/form_builder.rb | 2 +- test/test_helper.rb | 7 +++++++ 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.yarnrc b/.yarnrc index 85f58a55..9f4ac467 100644 --- a/.yarnrc +++ b/.yarnrc @@ -2,4 +2,4 @@ # yarn lockfile v1 -lastUpdateCheck 1761786460258 +lastUpdateCheck 1762373771610 diff --git a/Rakefile b/Rakefile index 02f48e18..3af86619 100644 --- a/Rakefile +++ b/Rakefile @@ -4,8 +4,8 @@ begin require "minitest/test_task" require "rdoc/task" require "rubocop/rake_task" -rescue LoadError - puts "You must run `bundle install` to run rake tasks" +rescue LoadError => e + puts "You must run `bundle install` to run rake tasks (#{e.message})" end RDoc::Task.new(:rdoc) do |rdoc| @@ -17,7 +17,7 @@ RDoc::Task.new(:rdoc) do |rdoc| end Minitest::TestTask.create(:test) do |t| - t.warning = false + t.warning = true t.test_globs = ["test/**/*_test.rb"] end @@ -33,15 +33,17 @@ namespace :test do gemfiles = Dir.glob("gemfiles/*.gemfile").reject { |f| File.basename(f) == "common.gemfile" } gemfiles.each do |f| ENV["BUNDLE_GEMFILE"] = f + system("bundle update --bundler") system("bundle check") || system("bundle install") - system("bundle exec rake test") + system("rake test") end original_directory = Dir.pwd Dir.chdir("demo") ENV.delete("BUNDLE_GEMFILE") + system("bundle update --bundler") system("bundle check") || system("bundle install") - system("bundle exec rake test:all") + system("rake test:all") ensure original_gemfile.nil? ? ENV.delete("BUNDLE_GEMFILE") : ENV["BUNDLE_GEMFILE"] = original_gemfile Dir.chdir(original_directory) unless original_directory.nil? diff --git a/demo/Gemfile b/demo/Gemfile index bb87017a..cbf8dcfe 100644 --- a/demo/Gemfile +++ b/demo/Gemfile @@ -14,11 +14,11 @@ gem "sqlite3", ">= 2.1" gem "stimulus-rails" gem "thruster", require: false gem "turbo-rails" -gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] +gem "tzinfo-data", platforms: %i[windows jruby] group :development, :test do gem "brakeman", require: false - gem "debug", platforms: %i[mri mingw x64_mingw] + gem "debug", platforms: %i[mri windows] end group :development do diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index fe2dd8ca..9f737c0f 100644 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -310,4 +310,4 @@ DEPENDENCIES web-console BUNDLED WITH - 2.5.9 + 2.7.2 diff --git a/gemfiles/common.gemfile b/gemfiles/common.gemfile index f65c6ff5..b47fe3ec 100644 --- a/gemfiles/common.gemfile +++ b/gemfiles/common.gemfile @@ -20,6 +20,7 @@ end group :development, :test do gem "debug" gem "ostruct" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5.0") + gem "warning" end group :ci do diff --git a/lib/bootstrap_form/form_builder.rb b/lib/bootstrap_form/form_builder.rb index 77dd0b55..e866c855 100644 --- a/lib/bootstrap_form/form_builder.rb +++ b/lib/bootstrap_form/form_builder.rb @@ -69,7 +69,7 @@ def initialize(object_name, object, template, options) def add_default_form_attributes_and_form_inline(options) options[:html] ||= {} - options[:html].reverse_merge!(BootstrapForm.configuration.default_form_attributes) + options[:html].reverse_merge!(BootstrapForm.config.default_form_attributes) return unless options[:layout] == :inline diff --git a/test/test_helper.rb b/test/test_helper.rb index 6f2bb3af..7755ada5 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,12 @@ ENV["RAILS_ENV"] ||= "test" +puts "BUNDLE_GEMFILE: #{ENV.fetch('BUNDLE_GEMFILE', nil)}" # rubocop/ignore Rails/Output + +require "warning" +mail_gem_path = Gem::Specification.find_by_name("mail").full_gem_path +Warning.ignore(:not_reached, mail_gem_path) +Warning.ignore(/warning: assigned but unused variable - testEof/, mail_gem_path) + require "diffy" require "nokogiri" require "equivalent-xml"