Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
coorasse committed May 23, 2024
2 parents a1e9a08 + 993d231 commit cbcf8b1
Show file tree
Hide file tree
Showing 45 changed files with 2,153 additions and 156 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 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][])
Expand Down Expand Up @@ -707,3 +713,6 @@ Please read the [guide on migrating from CanCanCan 2.x to 3.0](https://github.co
[@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
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
36 changes: 9 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
97 changes: 97 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "CanCanCan",
description: "The authorization Gem for Ruby on Rails.",
head: [
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
['link', { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" }],
['link', { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" }],
['link', { rel: "mask-icon", href: "./safari-pinned-tab.svg", color: "#3c3ebf" }],

['link', { rel: "icon", href: "/favicon.ico", type: "image/x-icon" }],
['link', { rel: "shortcut icon", href: "/favicon.ico", type: "image/x-icon" }],
],
sitemap: {
hostname: 'https://cancancan.dev'
},
cleanUrls: true,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Docs', link: '/README' },
{ text: 'Changelog', link: 'https://github.com/CanCanCommunity/cancancan/blob/main/CHANGELOG.md' },
{
text: 'Screencasts',
items: [
{ text: 'Screencast 1', link: 'http://railscasts.com/episodes/192-authorization-with-cancan' },
{ text: 'Screencast 2', link: 'https://www.youtube.com/watch?v=cTYu-OjUgDw' }
]
},
],

footer: {
message: 'Made with ❤️ by the <a href="https://github.com/CanCanCommunity/cancancan/graphs/contributors" target="_blank">CanCanCan community</a>',
copyright: `${new Date().getFullYear()} CanCanCan`
},
externalLinkIcon: true,

lastUpdated: {
formatOptions: {
dateStyle: 'medium',
}
},
editLink: {
pattern: 'https://github.com/CanCanCommunity/cancancan/edit/main/docs/:path'
},
search: {
provider: 'local'
},

logo: '/cancancan.png',

sidebar: [
{
text: 'Guide',
items: [
{ text: 'Introduction', link: '/introduction' },
{ text: 'Installation', link: '/installation' },
{ text: 'Define and check abilities', link: '/define_check_abilities' },
{ text: 'Controller helpers', link: '/controller_helpers' },
{ text: 'Fetching records', link: '/fetching_records' },
{ text: 'Cannot', link: '/cannot' },
{ text: 'Hash of conditions', link: '/hash_of_conditions' },
{ text: 'Combine Abilities', link: '/combine_abilities' },
{ text: 'Check abilities - avoid mistakes', link: '/check_abilities_mistakes' },
{ text: 'Handling CanCan::AccessDenied', link: '/handling_access_denied' },
{ text: 'Customize controller helpers', link: '/changing_defaults' },
{ text: 'Accessing request data', link: '/accessing_request_data' },
{ text: 'SQL strategies', link: '/sql_strategies' },
{ text: 'Accessible attributes', link: '/accessible_attributes' },
{ text: 'Testing', link: '/testing' },
{ text: 'Internationalization', link: '/internationalization' }
]
},
{
text: 'Further topics',
items: [
{ text: 'Migrating', link: '/migrating' },
{ text: 'Debugging Abilities', link: '/debugging' },
{ text: 'Split your ability file', link: '/split_ability' },
{ text: 'Define Abilities - best practices', link: '/define_abilities_best_practices' },
{ text: 'Abilities in database', link: '/abilities_in_database' },
{ text: 'Role-based Authorization', link: '/role_based_authorization' },
{ text: 'Model Adapter', link: '/model_adapter' },
{ text: 'Rules compression', link: '/rules_compression' },
{ text: 'Inherited Resources', link: '/inherited_resources' },
{ text: 'Devise', link: '/devise' },
{ text: 'FriendlyId', link: '/friendly_id' }
]
}
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/CanCanCommunity/cancancan' }
]
}
})
16 changes: 16 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import './style.css'

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
})
},
enhanceApp({ app, router, siteData }) {
}
} satisfies Theme
Loading

0 comments on commit cbcf8b1

Please sign in to comment.