Skip to content

Commit

Permalink
Merge branch 'develop' into fix/nested_conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai-Kircher committed May 28, 2024
2 parents afa7f51 + eab3019 commit 750bc41
Show file tree
Hide file tree
Showing 55 changed files with 2,284 additions and 172 deletions.
47 changes: 22 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,38 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.6', '2.7', '3.0', 'jruby', 'truffleruby']
gemfile: ['gemfiles/activerecord_5.0.2.gemfile', 'gemfiles/activerecord_5.1.0.gemfile', 'gemfiles/activerecord_5.2.2.gemfile', 'gemfiles/activerecord_6.0.0.gemfile', 'gemfiles/activerecord_6.1.0.gemfile', 'gemfiles/activerecord_main.gemfile']
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
gemfile: ['gemfiles/activerecord_5.2.2.gemfile', 'gemfiles/activerecord_6.0.0.gemfile', 'gemfiles/activerecord_6.1.0.gemfile', 'gemfiles/activerecord_7.0.0.gemfile', 'gemfiles/activerecord_7.1.0.gemfile', 'gemfiles/activerecord_main.gemfile']
include:
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '3.1'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_6.1.0.gemfile'
ruby: '3.1'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_6.1.0.gemfile'
ruby: '3.0'
exclude:
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.0' # rails 5.2 can't run on ruby 3.0
- gemfile: 'gemfiles/activerecord_5.1.0.gemfile'
ruby: '3.0' # rails 5.1 can't run on ruby 3.0
- gemfile: 'gemfiles/activerecord_5.0.2.gemfile'
ruby: '3.0' # rails 5.0 can't run on ruby 3.0
- gemfile: 'gemfiles/activerecord_5.0.2.gemfile'
ruby: '3.0' # rails 5.0 can't run on ruby 3.0
- gemfile: 'gemfiles/activerecord_5.0.2.gemfile'
ruby: 'truffleruby' # TruffleRuby 21.0 targets Ruby 2.7, same as above
- gemfile: 'gemfiles/activerecord_5.1.0.gemfile'
ruby: 'truffleruby' # TruffleRuby 21.0 targets Ruby 2.7, same as above
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.1'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: 'truffleruby' # TruffleRuby 21.0 targets Ruby 2.7, same as above
ruby: '3.2'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_main.gemfile'
ruby: '2.6' # rails 7+ requires ruby 3.0+
- gemfile: 'gemfiles/activerecord_5.0.2.gemfile'
ruby: 'jruby' # this *should* work - there's a test failure; it's not incompatible like the other excludes. could be an issue in Rails 5.0.2?
- gemfile: 'gemfiles/activerecord_6.1.0.gemfile'
ruby: 'jruby' # this *should* work. it seems like there's an issue with rails 6 on jruby.
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_main.gemfile'
ruby: 'jruby' # this *should* work. it seems like there's an issue with rails 6 on jruby.

ruby: '3.0'
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

Expand Down Expand Up @@ -84,10 +81,10 @@ jobs:
bundler-cache: true

- name: Run tests on sqlite
run: DB=sqlite bundle exec rake
run: DB=sqlite bundle exec rspec

- name: Run tests on postgres
run: DB=postgres bundle exec rake
run: DB=postgres bundle exec rspec

lint:
name: Lint
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ Gemfile.lock
.ruby-version
.ruby-gemset
/tmp
.vitepress/cache
node_modules
.vitepress/dist
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ AllCops:
- 'gemfiles/**/*'
- 'vendor/**/*'
- 'Appraisals'
- 'node_modules/**/*'
3 changes: 3 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,6 @@ Style/StringChars:
Style/StringConcatenation:
Exclude:
- 'lib/cancan/rule.rb'

Lint/SafeNavigationChain:
Enabled: false
63 changes: 23 additions & 40 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
appraise 'activerecord_5.0.2' do
gem 'activerecord', '~> 5.0.2', require: 'active_record'
gem 'activesupport', '~> 5.0.2', require: 'active_support/all'
gem 'actionpack', '~> 5.0.2', require: 'action_pack'

gemfile.platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3'
gem 'jdbc-postgres'
end

gemfile.platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.3.0'
end
end

appraise 'activerecord_5.1.0' do
gem 'activerecord', '~> 5.1.0', require: 'active_record'
gem 'activesupport', '~> 5.1.0', require: 'active_support/all'
gem 'actionpack', '~> 5.1.0', require: 'action_pack'

gemfile.platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3'
gem 'jdbc-postgres'
end

gemfile.platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
end
end

appraise 'activerecord_5.2.2' do
gem 'activerecord', '~> 5.2.2', require: 'active_record'
gem 'activesupport', '~> 5.2.2', require: 'active_support/all'
Expand All @@ -45,7 +11,7 @@ appraise 'activerecord_5.2.2' do

gemfile.platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
gem 'sqlite3', '~> 1.7.3'
end
end

Expand All @@ -62,7 +28,7 @@ appraise 'activerecord_6.0.0' do

platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
gem 'sqlite3', '~> 1.7.3'
end
end

Expand All @@ -79,7 +45,7 @@ appraise 'activerecord_6.1.0' do

platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
gem 'sqlite3', '~> 1.7.3'
end
end

Expand All @@ -96,7 +62,24 @@ appraise 'activerecord_7.0.0' do

platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
gem 'sqlite3', '~> 1.7.3'
end
end

appraise 'activerecord_7.1.0' do
gem 'actionpack', '~> 7.1.0', require: 'action_pack'
gem 'activerecord', '~> 7.1.0', require: 'active_record'
gem 'activesupport', '~> 7.1.0', require: 'active_support/all'

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3'
gem 'jdbc-postgres'
end

platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.5.6'
gem 'sqlite3', '~> 1.7.3'
end
end

Expand All @@ -114,7 +97,7 @@ appraise 'activerecord_main' do
end

platforms :ruby, :mswin, :mingw do
gem 'pg', '~> 1.3.4'
gem 'sqlite3', '~> 1.4.2'
gem 'pg', '~> 1.5.6'
gem 'sqlite3', '~> 1.7.3'
end
end
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
## Unreleased
## 3.6.0

* [#849](https://github.com/CanCanCommunity/cancancan/pull/849): Update tests matrix. ([@coorasse][])
* [#843](https://github.com/CanCanCommunity/cancancan/pull/843): Compress duplicate rules. ([@MrChoclate][])
* [#841](https://github.com/CanCanCommunity/cancancan/pull/841): New https://cancancan.dev website. ([@pandermatt][])
* [#839](https://github.com/CanCanCommunity/cancancan/pull/839): switch from database column detection to Rails attributes detection. ([@kalsan][])
## 3.5.0

* [#653](https://github.com/CanCanCommunity/cancancan/pull/653): Add support for using an nil relation as a condition. ([@ghiculescu][])
* [#702](https://github.com/CanCanCommunity/cancancan/pull/702): Support scopes of STI classes as ability conditions. ([@honigc][])
* [#798](https://github.com/CanCanCommunity/cancancan/pull/798): Allow disabling of rules compressor via `CanCan.rules_compressor_enabled = false`. ([@coorasse][])
* [#814](https://github.com/CanCanCommunity/cancancan/pull/814): Fix issue with polymorphic associations. ([@WriterZephos][])

## 3.4.0

Expand Down Expand Up @@ -705,3 +712,7 @@ Please read the [guide on migrating from CanCanCan 2.x to 3.0](https://github.co
[@mtoneil]: https://github.com/mtoneil
[@Juleffel]: https://github.com/Juleffel
[@honigc]: https://github.com/honigc
[@WriterZephos]: https://github.com/WriterZephos
[@MrChoclate]: https://github.com/MrChoclate
[@pandermatt]: https://github.com/pandermatt
[@kalsan]: https://github.com/kalsan
18 changes: 17 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Reporting an Issue

1. If you have any questions about CanCanCan, search the [Wiki](https://github.com/cancancommunity/cancancan/wiki) or
1. If you have any questions about CanCanCan, search the [Developer guide](./docs/README.md) or
use [Stack Overflow](http://stackoverflow.com/questions/tagged/cancancan).
Do not post questions here.

Expand All @@ -25,3 +25,19 @@ Please make sure you have test coverage for anything you add or fix!
Please add a CHANGELOG entry with any relevant tags for issues, pull-requests, and authors.

Thanks for you contribution!

### Modify the Documentation

The documentation is written in Markdown and is located in the `docs` directory. The documentation is built using [VitePress](https://vitepress.dev).
VitePress supports all markdown features but also adds a few enhancements, which are documented in the [Markdown Extensions](https://vitepress.dev/guide/markdown).

```bash
npm install
npm run dev

# build for production, resulting in a static site in docs/.vitepress/dist
npm run build
```

Before submitting a pull request, please make sure the documentation builds correctly using `npm run build`.
Most likely the build will fail if there are any syntax errors in the markdown files or dead links.
38 changes: 10 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Code Climate Badge](https://codeclimate.com/github/CanCanCommunity/cancancan.svg)](https://codeclimate.com/github/CanCanCommunity/cancancan)

[Developer guide](./docs/README.md) |
[RDocs](http://rdoc.info/projects/CanCanCommunity/cancancan) |
[RDocs](https://www.rubydoc.info/github/CanCanCommunity/cancancan) |
[Screencast 1](http://railscasts.com/episodes/192-authorization-with-cancan) |
[Screencast 2](https://www.youtube.com/watch?v=cTYu-OjUgDw)

Expand All @@ -26,20 +26,14 @@ of models automatically and reduce duplicated code.

## Our sponsors
<br/>
<a href="https://www.renuo.ch" target="_blank">
<img src="./logo/renuo.png" alt="Renuo AG" height="50"/>
<a href="https://www.pennylane.com/" target="_blank">
<img src="./logo/pennylane.svg" alt="Pennylane" height="50"/>
</a>
<br/>
<br/>
<br/>
<a href="https://www.moderntreasury.com" target="_blank" style="display:inline">
<img src="./logo/modern_treasury.svg" alt="Modern Treasury" height="40"/>
</a>
<br/>
<br/>
<br/>
<a href="https://bullettrain.co" target="_blank">
<img src="./logo/bullet_train.png" alt="Bullet Train" height="50"/>
<br />
<br />
<br />
<a href="https://www.honeybadger.io/" target="_blank">
<img src="./logo/honeybadger.svg" alt="Honeybadger" height="45"/>
</a>
<br/>
<br/>
Expand All @@ -50,20 +44,8 @@ of models automatically and reduce duplicated code.
<br />
<br />
<br />
<a href="https://newrelic.com/" target="_blank">
<img src="./logo/new_relic.png" alt="NewRelic" height="45"/>
</a>
<br />
<br />
<br />
<a href="https://www.ontra.ai" target="_blank">
<img src="./logo/ontra.png" alt="Ontra" height="70"/>
</a>
<br />
<br />
<br />
<a href="https://www.honeybadger.io/" target="_blank">
<img src="./logo/honeybadger.svg" alt="Honeybadger" height="45"/>
<a href="https://www.renuo.ch" target="_blank">
<img src="./logo/renuo.png" alt="Renuo AG" height="50"/>
</a>
<br />
<br />
Expand Down
Loading

0 comments on commit 750bc41

Please sign in to comment.