rolify 6.0.0 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39183b0e66a9dfdbe636059ec28145106f14347129676c334598ff4f330edfc0
4
- data.tar.gz: 686c5b98efcc79e84b104cca586053b920032cbc0bf7978baa0b1caa04e021bb
3
+ metadata.gz: 548e7372a5619722f724ddf29ced05a3a23f1d13ffc25ee3395121be3b0848f9
4
+ data.tar.gz: 9841e7f855554d8ab8e8027048d338acf36041a3ed96648f3b523a4b99b3ee0a
5
5
  SHA512:
6
- metadata.gz: a24f0ef337c8c5d1b9381e30020ba18c790193f4b00085cbd2581f25d6322d5ffeee099a22a43b4b4c86de66a2774364f799426ae71ed331027d5e565a06be72
7
- data.tar.gz: b1d55761a7a5df75a9c1f462ca04232c44e81adcc180ece7232386f0c6f4dff0441cc463e674075c5906fc3c3ddcc71922dd20cf2129eecff099fa604db56b94
6
+ metadata.gz: b6b084f10550cea5c75b07a41cc54ccf37d05b879b6e81a7a1ed979e6ce59198728adb5208ff9ab97c62ddee02692d73707a3a2fc0ad99b48d306500986fdfa4
7
+ data.tar.gz: b99ae9811babb9d719e857704f8491fca157e1fc9949a0be783314938ed0a6e229b4b3f2043060a407ae75251594f0553d9836232459d3d2e0ba2fb70afce6ac
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -1,5 +1,5 @@
1
1
  name: activerecord
2
- on: [push]
2
+ on: [push, pull_request]
3
3
  jobs:
4
4
  ubuntu:
5
5
  runs-on: ubuntu-latest
@@ -7,21 +7,27 @@ jobs:
7
7
  strategy:
8
8
  matrix:
9
9
  gemfile: [activerecord_4, activerecord_5, activerecord_6]
10
- ruby: [2.5.7, 2.6.5, 2.7.2]
10
+ ruby: [2.5.9, 2.6.10, 2.7.7]
11
+ include:
12
+ - gemfile: activerecord_7
13
+ ruby: '3.2'
14
+ - gemfile: activerecord_7
15
+ ruby: '3.1'
16
+ - gemfile: activerecord_7
17
+ ruby: '3.0'
18
+ - gemfile: activerecord_6
19
+ ruby: '3.0'
11
20
  env:
12
21
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
13
22
  ADAPTER: active_record
14
23
  steps:
15
- - uses: actions/checkout@v2
24
+ - uses: actions/checkout@v3
25
+ - run: sudo apt-get install -y libsqlite3-dev
16
26
  - name: Setup ruby
17
27
  uses: ruby/setup-ruby@v1
18
28
  with:
19
29
  ruby-version: ${{ matrix.ruby }}
20
- - run: sudo apt-get install -y libsqlite3-dev
21
- - run: gem update --system
22
- - run: gem install bundler
23
- - run: gem --version
24
- - run: bundle install
30
+ bundler-cache: true
25
31
  - name: Run Tests
26
32
  run: |
27
33
  bundle exec rake
@@ -1,5 +1,5 @@
1
1
  name: mongoid
2
- on: [push]
2
+ on: [push, pull_request]
3
3
  jobs:
4
4
  ubuntu:
5
5
  runs-on: ubuntu-latest
@@ -12,21 +12,18 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  gemfile: [mongoid_5]
15
- ruby: [2.5.7, 2.6.5, 2.7.2]
15
+ ruby: [2.5.9, 2.6.10, 2.7.7]
16
16
  env:
17
17
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
18
18
  ADAPTER: mongoid
19
19
  steps:
20
- - uses: actions/checkout@v2
20
+ - uses: actions/checkout@v3
21
+ - run: sudo apt-get install -y libsqlite3-dev
21
22
  - name: Setup ruby
22
23
  uses: ruby/setup-ruby@v1
23
24
  with:
24
25
  ruby-version: ${{ matrix.ruby }}
25
- - run: sudo apt-get install -y libsqlite3-dev
26
- - run: gem update --system
27
- - run: gem install bundler
28
- - run: gem --version
29
- - run: bundle install
26
+ bundler-cache: true
30
27
  - name: Run Tests
31
28
  run: |
32
29
  bundle exec rake
data/Appraisals CHANGED
@@ -1,5 +1,6 @@
1
1
  appraise 'mongoid-5' do
2
2
  gem "mongoid", "~> 5"
3
+ gem "mongo", "< 2.17"
3
4
  gem "bson_ext", "1.5.1"
4
5
  gem 'bigdecimal', '1.4.2'
5
6
  end
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 6.0.1
2
+
3
+ * Fix with_role with :any resource
4
+
1
5
  = 6.0.0 (April 2, 2021)
2
6
 
3
7
  Breaking changes:
@@ -3,10 +3,10 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "sqlite3", "~> 1.4", platform: "ruby"
6
- gem "activerecord", ">= 6.0.0", require: "active_record"
7
- gem "actionpack", ">= 6.0.0"
8
- gem "activemodel", ">= 6.0.0"
9
- gem "railties", ">= 6.0.0"
6
+ gem "activerecord", "~> 6.1.0", require: "active_record"
7
+ gem "actionpack", "~> 6.1.0"
8
+ gem "activemodel", "~> 6.1.0"
9
+ gem "railties", "~> 6.1.0"
10
10
 
11
11
  group :test do
12
12
  gem "codeclimate-test-reporter", require: nil
@@ -0,0 +1,22 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3", "~> 1.4", platform: "ruby"
6
+ gem "activerecord", "~> 7.0.0", require: "active_record"
7
+ gem "actionpack", "~> 7.0.0"
8
+ gem "activemodel", "~> 7.0.0"
9
+ gem "railties", "~> 7.0.0"
10
+
11
+ group :test do
12
+ gem "codeclimate-test-reporter", require: nil
13
+ gem "coveralls", require: false
14
+ gem "database_cleaner", "~> 1.6.2"
15
+ gem "its"
16
+ gem "test-unit"
17
+ gem "byebug"
18
+ gem "pry"
19
+ gem "pry-byebug"
20
+ end
21
+
22
+ gemspec path: "../"
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "mongoid", "~> 5"
6
+ gem "mongo", "< 2.17"
6
7
  gem "bson_ext", "1.5.1"
7
8
  gem "bigdecimal", "1.4.2"
8
9
 
@@ -1,7 +1,7 @@
1
1
  module Rolify
2
2
  module Finders
3
3
  def with_role(role_name, resource = nil)
4
- strict = self.strict_rolify and resource and resource != :any
4
+ strict = self.strict_rolify && resource && resource != :any
5
5
  self.adapter.scope(
6
6
  self,
7
7
  { :name => role_name, :resource => resource },
@@ -46,4 +46,4 @@ module Rolify
46
46
  block.call(users_to_add)
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module Rolify
2
- VERSION = "6.0.0"
2
+ VERSION = "6.0.1"
3
3
  end
@@ -32,7 +32,11 @@ describe Rolify::Generators::RolifyGenerator, :if => ENV['ADAPTER'] == 'active_r
32
32
  end
33
33
  }
34
34
  require File.join(destination_root, "app/models/user.rb")
35
- run_generator
35
+ if Rails::VERSION::MAJOR >= 7
36
+ run_generator %w(--skip-collision-check)
37
+ else
38
+ run_generator
39
+ end
36
40
  }
37
41
 
38
42
  describe 'config/initializers/rolify.rb' do
@@ -63,6 +63,11 @@ shared_examples_for :finders do |param_name, param_method|
63
63
  it { subject.with_role("admin".send(param_method), Forum.first).should be_empty }
64
64
  it { subject.with_role("moderator".send(param_method), Forum.first).should be_empty }
65
65
  end
66
+
67
+ context "on any resource" do
68
+ it { subject.with_role("admin".send(param_method), :any).should_not be_empty }
69
+ it { subject.with_role("moderator".send(param_method), :any).should_not be_empty }
70
+ end
66
71
  end
67
72
  end
68
73
  end
@@ -115,7 +120,7 @@ shared_examples_for :finders do |param_name, param_method|
115
120
  end
116
121
  end
117
122
  end
118
-
123
+
119
124
 
120
125
  describe ".with_all_roles" do
121
126
  it { should respond_to(:with_all_roles) }
@@ -146,4 +151,4 @@ shared_examples_for :finders do |param_name, param_method|
146
151
  it { subject.with_any_role({ :name => "visitor".send(param_method), :resource => :any }, { :name => "moderator".send(param_method), :resource => :any }).should =~ [ root, modo, visitor ] }
147
152
  end
148
153
  end
149
- end
154
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "simplecov"
2
- SimpleCov.start
1
+ require 'coveralls'
2
+ Coveralls.wear_merged!
3
3
 
4
4
  require 'rubygems'
5
5
  require "bundler/setup"
@@ -13,9 +13,6 @@ rescue LoadError
13
13
  end
14
14
  require 'database_cleaner'
15
15
 
16
- require 'coveralls'
17
- Coveralls.wear_merged!
18
-
19
16
  ENV['ADAPTER'] ||= 'active_record'
20
17
 
21
18
  load File.dirname(__FILE__) + "/support/adapters/#{ENV['ADAPTER']}.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolify
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florent Monbillard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-25 00:00:00.000000000 Z
12
+ date: 2023-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ammeter
@@ -91,6 +91,7 @@ executables: []
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
+ - ".github/dependabot.yml"
94
95
  - ".github/workflows/activerecord.yml"
95
96
  - ".github/workflows/mongoid.yml"
96
97
  - ".gitignore"
@@ -106,6 +107,7 @@ files:
106
107
  - gemfiles/activerecord_4.gemfile
107
108
  - gemfiles/activerecord_5.gemfile
108
109
  - gemfiles/activerecord_6.gemfile
110
+ - gemfiles/activerecord_7.gemfile
109
111
  - gemfiles/mongoid_5.gemfile
110
112
  - gemfiles/mongoid_6.gemfile
111
113
  - gemfiles/mongoid_7.gemfile
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  - !ruby/object:Gem::Version
198
200
  version: '0'
199
201
  requirements: []
200
- rubygems_version: 3.2.15
202
+ rubygems_version: 3.4.1
201
203
  signing_key:
202
204
  specification_version: 4
203
205
  summary: Roles library with resource scoping