Skip to content

Commit

Permalink
Merge pull request #113 from emjot/rails6
Browse files Browse the repository at this point in the history
Rails 6/7 compatibility + several updates
  • Loading branch information
mherold authored Apr 3, 2024
2 parents 3002c3e + 466bfb3 commit f5a43ba
Show file tree
Hide file tree
Showing 44 changed files with 421 additions and 155 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ jobs:

steps:
- uses: actions/checkout@master
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.x
ruby-version: 2.7.8

- name: Install bundle
run: bundle
- name: Run rubocop
run: bundle exec rubocop

- name: Publish to RubyGems
run: |
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/test_and_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Lint & Test

on: push

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- 2.7.8
- 3.0.6
- 3.1.4
- 3.2.3
appraisal:
- rails-5.2
- rails-6.0
- rails-6.1
- rails-7.0
- rails-7.1
exclude:
- ruby: 3.0.6
appraisal: rails-5.2
- ruby: 3.1.4
appraisal: rails-5.2
- ruby: 3.2.3
appraisal: rails-5.2
steps:
- name: Install system dependencies
run: sudo apt-get install -y libsqlite3-dev
- uses: actions/checkout@master
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install bundle
run: bundle
- name: Install appraisal
run: bundle exec appraisal install
- name: Run tests
run: bundle exec appraisal ${{ matrix.appraisal }} rspec
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Install system dependencies
run: sudo apt-get install -y libsqlite3-dev
- uses: actions/checkout@master
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.8
- name: Install bundle
run: bundle
- name: Run rubocop
run: bundle exec rubocop
28 changes: 25 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
require: rubocop-performance
require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec

inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- bin/*
TargetRubyVersion: 2.2
- gemfiles/*
- vendor/bundle/**/*
NewCops: enable
TargetRubyVersion: 2.7

Gemspec/RequireMFA:
Exclude:
- 'permanent_records.gemspec'

Metrics/BlockLength:
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Max: 120

RSpec/ContextWording:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false

RSpec/NestedGroups:
Enabled: false

Style/BlockDelimiters:
Enabled: false
60 changes: 59 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,65 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-10-15 13:32:11 +0200 using RuboCop version 0.68.1.
# on 2024-03-26 14:12:23 UTC using RuboCop version 1.62.1.
# 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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 11
RSpec/AnyInstance:
Exclude:
- 'spec/permanent_records_spec.rb'

# Offense count: 3
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 22

# Offense count: 5
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/permanent_records/circular_sti_dependency_spec.rb'
- 'spec/permanent_records/counter_cache_spec.rb'
- 'spec/permanent_records/propagate_validation_flag_spec.rb'
- 'spec/permanent_records/revive_parent_first_spec.rb'
- 'spec/permanent_records/validate_presence_spec.rb'

# Offense count: 5
RSpec/LetSetup:
Exclude:
- 'spec/permanent_records/revive_parent_first_spec.rb'
- 'spec/permanent_records_spec.rb'

# Offense count: 1
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 60
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/permanent_records_spec.rb'

# Offense count: 5
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/permanent_records/circular_sti_dependency_spec.rb'
- 'spec/permanent_records/counter_cache_spec.rb'
- 'spec/permanent_records/propagate_validation_flag_spec.rb'
- 'spec/permanent_records/revive_parent_first_spec.rb'
- 'spec/permanent_records/validate_presence_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Rake/Desc:
Exclude:
- 'Rakefile'
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

appraise 'rails-5.2' do
gem 'rails', '5.2.8.1'
end

appraise 'rails-6.0' do
gem 'rails', '6.0.6.1'
end

appraise 'rails-6.1' do
gem 'rails', '6.1.7.7'
end

appraise 'rails-7.0' do
gem 'rails', '7.0.8.1'
end

appraise 'rails-7.1' do
gem 'rails', '7.1.3.2'
end
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'appraisal'
gem 'database_cleaner', '>= 1.5.1'
gem 'pry-byebug'
gem 'rake'
gem 'rspec', '>= 3.5.0'
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'sqlite3'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PermanentRecords (Rails 5)
# PermanentRecords

[http://github.com/JackDanger/permanent_records/](http://github.com/JackDanger/permanent_records/)

Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'bundler'
require 'yaml'
require 'English'
Expand Down
7 changes: 0 additions & 7 deletions ci

This file was deleted.

1 change: 1 addition & 0 deletions gemfiles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.gemfile.lock
17 changes: 17 additions & 0 deletions gemfiles/rails_5.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "database_cleaner", ">= 1.5.1"
gem "pry-byebug"
gem "rake"
gem "rspec", ">= 3.5.0"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "sqlite3"
gem "rails", "5.2.8.1"

gemspec path: "../"
17 changes: 17 additions & 0 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "database_cleaner", ">= 1.5.1"
gem "pry-byebug"
gem "rake"
gem "rspec", ">= 3.5.0"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "sqlite3"
gem "rails", "6.0.6.1"

gemspec path: "../"
17 changes: 17 additions & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "database_cleaner", ">= 1.5.1"
gem "pry-byebug"
gem "rake"
gem "rspec", ">= 3.5.0"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "sqlite3"
gem "rails", "6.1.7.7"

gemspec path: "../"
17 changes: 17 additions & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "database_cleaner", ">= 1.5.1"
gem "pry-byebug"
gem "rake"
gem "rspec", ">= 3.5.0"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "sqlite3"
gem "rails", "7.0.8.1"

gemspec path: "../"
17 changes: 17 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "database_cleaner", ">= 1.5.1"
gem "pry-byebug"
gem "rake"
gem "rspec", ">= 3.5.0"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "sqlite3"
gem "rails", "7.1.3.2"

gemspec path: "../"
1 change: 0 additions & 1 deletion github-actions-test.yml

This file was deleted.

Loading

0 comments on commit f5a43ba

Please sign in to comment.