diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 210b652..2d54517 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -62,3 +62,5 @@ jobs: run: bundle exec rubocop -P - name: Check manifest run: bundle exec rake manifest:check + - name: Check appraisals + run: bundle exec rake appraisal:check diff --git a/.rubocop.yml b/.rubocop.yml index b19a2ac..585ad82 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -102,10 +102,11 @@ Rails/ApplicationRecord: Rails/BulkChangeTable: Enabled: false -# Manifest tasks do not need environment +# Manifest and appraisal tasks do not need environment Rails/RakeEnvironment: Exclude: - 'lib/tasks/manifest.rake' + - 'lib/tasks/appraisal.rake' # Migrations should not do validations in general? Rails/SkipsModelValidations: diff --git a/Gemfile b/Gemfile index b0150c0..a9cfb6d 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec group :development, :test do gem "appraisal", "~> 2.3" - gem "rspec-rails", "~> 8.0" + gem "rspec-rails", "~> 7.1" gem "rubocop", "~> 1.91" gem "rubocop-capybara", "~> 3.0" gem "rubocop-factory_bot", "~> 2.28" diff --git a/Manifest.txt b/Manifest.txt index 3f9dd57..e07f89e 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -6,5 +6,6 @@ lib/publify_app/textfilter_code.rb lib/publify_textfilter_code.rb lib/publify_textfilter_code/engine.rb lib/publify_textfilter_code/version.rb +lib/tasks/appraisal.rake lib/tasks/manifest.rake lib/tasks/publify_textfilter_code_tasks.rake diff --git a/Rakefile b/Rakefile index d9e6868..ad3b0fe 100644 --- a/Rakefile +++ b/Rakefile @@ -7,17 +7,18 @@ rescue LoadError end APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__) -load "rails/tasks/engine.rake" +require "rspec/core/rake_task" + +load "rails/tasks/engine.rake" load "rails/tasks/statistics.rake" +load "lib/tasks/manifest.rake" +load "lib/tasks/appraisal.rake" Bundler::GemHelper.install_tasks -require "rspec/core/rake_task" - desc "Run all specs in spec directory" RSpec::Core::RakeTask.new(spec: "app:db:test:prepare") task default: :spec -load "lib/tasks/manifest.rake" task default: "manifest:check" diff --git a/lib/tasks/appraisal.rake b/lib/tasks/appraisal.rake new file mode 100644 index 0000000..d27cfb0 --- /dev/null +++ b/lib/tasks/appraisal.rake @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +namespace :appraisal do + desc "Check appraisals" + task :check do + Appraisal::AppraisalFile.each do |appraisal| + existing = File.read(appraisal.gemfile_path) + signature = Appraisal::Customize.heading || "This file was generated by Appraisal" + header = appraisal.send :comment_lines, signature + body = appraisal.send :quoted_gemfile + expected = [header, body].join("\n\n") + raise "Outdated appraisal: #{appraisal.name}" unless existing.chomp == expected.chomp + end + end +end