Skip to content

Commit

Permalink
- Loosen version support requirement to include Mongoid 7.3, 8.0, and…
Browse files Browse the repository at this point in the history
… above.

- Add Rubocop to CI.
- Fix minor Rubocop issues.
- Dropped Ruby < 2.7.
  • Loading branch information
johnnyshields committed Sep 18, 2023
1 parent b0a8fc7 commit 7574eee
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 31 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Rubocop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
env:
CI: true
TESTOPTS: '-v'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: bundle install
run: bundle install --jobs 4 --retry 3
- name: Run Rubocop
run: bundle exec rubocop --parallel
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
strategy:
fail-fast: true
matrix:
ruby: [2.4, 2.5, 2.6, 2.7, 3.0, jruby, truffleruby]
ruby: [2.7, 3.0, 3.1, 3.2, jruby, truffleruby]
mongoid: [7, 8]
experimental: [false]
include:
- ruby: head
Expand Down Expand Up @@ -42,8 +43,12 @@ jobs:

- name: bundle install
run: bundle install --jobs 4 --retry 3
env:
MONGOID_VERSION: ${{ matrix.mongoid }}

- name: test
timeout-minutes: 10
run: bundle exec rake spec
continue-on-error: ${{ matrix.experimental }}
env:
MONGOID_VERSION: ${{ matrix.mongoid }}
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
Exclude:
- spec/**/*
- vendor/**/*
Expand All @@ -19,7 +19,7 @@ Layout/EmptyLineAfterGuardClause:
Enabled: false

Layout/IndentationWidth:
IgnoredPatterns:
AllowedPatterns:
- '^\s*module'

Layout/LineLength:
Expand Down
33 changes: 20 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
## 0.6.0 (2023/09/18)

* Loosen version support requirement to include Mongoid 7.3, 8.0, and above.
* Add Rubocop to CI.
* Fix minor Rubocop issues.
* Drop support for Ruby < 2.7.

## 0.5.0 (2021/07/24)

* Support only Mongoid 7.3 and later.
* In conformity with Mongoid 7.3+ behavior, dependencies are not destroyed when calling delete/delete!

## 0.4.1 (2021/07/24)

* Do not allow Mongoid 7.3 and later, due to breaking changes
* Switch to Github Actions from Travis CI
* Add Rubocop and fix issues
* Dropped Ruby < 2.4
* Do not allow Mongoid 7.3 and later, due to breaking changes.
* Switch to Github Actions from Travis CI.
* Add Rubocop and fix issues.
* Drop support for Ruby < 2.4.

## 0.4.0 (2019/05/29)

* Mongoid 7.0 support
* Drop Mongoid 6 and Ruby < 2.3
* Mongoid 7.0 support.
* Drop support for Mongoid 6 and Ruby < 2.3.

## 0.3.0 (2017/01/05)

* Mongoid 6.0 support
* Drop Mongoid 4/5 and Ruby < 2.2.2
* Mongoid 6.0 support.
* Drop support for Mongoid 4/5 and Ruby < 2.2.2.

## 0.2.1 (2015/09/28)

* [#40](https://github.com/simi/mongoid_paranoia/pull/40): Don't override mongoid original update - [@simi](https://github.com/simi).
* [#40](https://github.com/simi/mongoid_paranoia/pull/40): Don't override mongoid original update - [@simi](https://github.com/simi)

## 0.2.0 (2015/09/22)

* [#38](https://github.com/simi/mongoid_paranoia/pull/38): Added support for Mongoid 5 - [@dblock](https://github.com/dblock).
* [#29](https://github.com/simi/mongoid_paranoia/pull/29): Added `before_remove`, `after_remove` and `around_remove` callbacks - [@marcelloma](https://github.com/marcelloma).
* [#34](https://github.com/simi/mongoid_paranoia/pull/34): Allow configuring of the paranoid field naming on a global basis - [@ak47](https://github.com/ak47).
* [#38](https://github.com/simi/mongoid_paranoia/pull/38): Added support for Mongoid 5 - [@dblock](https://github.com/dblock)
* [#29](https://github.com/simi/mongoid_paranoia/pull/29): Added `before_remove`, `after_remove` and `around_remove` callbacks - [@marcelloma](https://github.com/marcelloma)
* [#34](https://github.com/simi/mongoid_paranoia/pull/34): Allow configuring of the paranoid field naming on a global basis - [@ak47](https://github.com/ak47)

## 0.1.2 (2014/07/11)

* Initial public release - [@simi](https://github.com/simi).
* Initial public release - [@simi](https://github.com/simi)
17 changes: 10 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
source 'https://rubygems.org'
gemspec name: 'mongoid_paranoia'

gem 'mongoid', '~> 7.3'

group :test do
gem 'rspec', '~> 3.8'
case (version = ENV['MONGOID_VERSION'] || '8')
when 'HEAD'
gem 'mongoid', github: 'mongodb/mongoid'
when /\A\d+\z/
gem 'mongoid', "~> #{version}.0"
else
gem 'mongoid', version
end

group :development do
gem 'rake'
end
gem 'rake'
gem 'rspec'
gem 'rubocop'
6 changes: 3 additions & 3 deletions lib/mongoid/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def persisted?
# @return [ true ] True.
#
# @since 1.0.0
alias :orig_delete :delete
alias orig_delete delete

def remove(_ = {})
time = self.deleted_at = Time.now
Expand All @@ -84,8 +84,8 @@ def remove(_ = {})
true
end

alias :delete :remove
alias :delete! :orig_delete
alias delete remove
alias delete! orig_delete

# Delete the paranoid +Document+ from the database completely. This will
# run the destroy and remove callbacks.
Expand Down
6 changes: 2 additions & 4 deletions mongoid_paranoia.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ Gem::Specification.new do |gem|
gem.license = 'MIT'

gem.files = Dir.glob('lib/**/*') + %w[LICENSE README.md]
gem.test_files = Dir.glob('{perf,spec}/**/*')
gem.require_paths = ['lib']

gem.add_dependency 'mongoid', '~> 7.3'

gem.add_development_dependency 'rubocop', '>= 1.8.1'
gem.add_dependency 'mongoid', '>= 7.3'
gem.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion perf/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MetaParanoidModel

if ENV['FORCE']
Mongoid.purge!
::Mongoid::Tasks::Database.create_indexes
Mongoid::Tasks::Database.create_indexes

n = 50_000
n.times {|i| Model.create(text: "text #{i}") }
Expand Down

0 comments on commit 7574eee

Please sign in to comment.