rolify 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.hakiri.yml +1 -0
- data/.travis.yml +36 -71
- data/Appraisals +34 -21
- data/CHANGELOG.rdoc +18 -8
- data/Gemfile +2 -1
- data/README.md +16 -5
- data/Rakefile +1 -0
- data/gemfiles/activerecord_4.gemfile +5 -3
- data/gemfiles/activerecord_5.gemfile +7 -6
- data/gemfiles/activerecord_6.gemfile +28 -0
- data/gemfiles/mongoid_5.gemfile +4 -2
- data/gemfiles/{mongoid_3.gemfile → mongoid_6.gemfile} +4 -3
- data/gemfiles/{mongoid_4.gemfile → mongoid_7.gemfile} +5 -3
- data/lib/generators/active_record/rolify_generator.rb +3 -3
- data/lib/generators/active_record/templates/model.rb +13 -14
- data/lib/rolify.rb +2 -2
- data/lib/rolify/adapters/active_record/resource_adapter.rb +2 -2
- data/lib/rolify/adapters/active_record/role_adapter.rb +3 -9
- data/lib/rolify/role.rb +1 -1
- data/lib/rolify/version.rb +1 -1
- data/rolify.gemspec +5 -4
- data/spec/generators/rolify/rolify_activerecord_generator_spec.rb +8 -0
- data/spec/rolify/utils_spec.rb +19 -0
- data/spec/support/adapters/{mongoid_3.yml → mongoid_6.yml} +2 -2
- data/spec/support/adapters/{mongoid_4.yml → mongoid_7.yml} +2 -2
- metadata +20 -21
- data/gemfiles/Gemfile.rails-3.2 +0 -27
- data/gemfiles/Gemfile.rails-4.0 +0 -33
- data/gemfiles/Gemfile.rails-4.1 +0 -37
- data/gemfiles/activerecord_3.gemfile +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 63187a09a4130c5a7f1066f306783ac5c2fba4e54d5f7130e4b60bdc921b7834
|
|
4
|
+
data.tar.gz: f66383e7b30ead36d1f2dac277cb473dc41479db4656a4bea0ac85f6c6253f69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e212c338c8f11662d4bf7f267ae4ecf7e9a4206667cf051053cbaf55b72bd9ba08f7022aed3f85737e29919c3b045129bdec8dfb2922dcb1544232583ce6fcd
|
|
7
|
+
data.tar.gz: e0d2c815832045141b1be4ff76a419704785d57e7195b9c18cafa35885267a4cecd3cf9b11ce7952192317d47ae57115d4831860694227aceb072ac56e5ed9ad
|
data/.hakiri.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dependency_source: gemspec_file
|
data/.travis.yml
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
-
sudo: false
|
|
3
2
|
|
|
4
3
|
before_install:
|
|
5
4
|
- gem update --system
|
|
@@ -11,80 +10,46 @@ script: bundle exec rake
|
|
|
11
10
|
after_success:
|
|
12
11
|
- bundle exec codeclimate-test-reporter
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
rvm:
|
|
14
|
+
- 2.7.0
|
|
15
|
+
- 2.6.3
|
|
16
|
+
- 2.5.5
|
|
17
|
+
- 2.4.6
|
|
18
|
+
- 2.3.8
|
|
19
|
+
|
|
20
|
+
gemfile:
|
|
21
|
+
- gemfiles/activerecord_4.gemfile
|
|
22
|
+
- gemfiles/activerecord_5.gemfile
|
|
23
|
+
- gemfiles/activerecord_6.gemfile
|
|
24
|
+
- gemfiles/mongoid_5.gemfile
|
|
25
|
+
- gemfiles/mongoid_6.gemfile
|
|
26
|
+
- gemfiles/mongoid_7.gemfile
|
|
27
|
+
|
|
28
|
+
env:
|
|
29
|
+
- ADAPTER=active_record
|
|
30
|
+
- ADAPTER=mongoid
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- rvm: 2.2.4
|
|
33
|
-
gemfile: gemfiles/activerecord_4.gemfile
|
|
34
|
-
env: ADAPTER=active_record
|
|
35
|
-
- rvm: 2.1.8
|
|
36
|
-
gemfile: gemfiles/activerecord_4.gemfile
|
|
37
|
-
env: ADAPTER=active_record
|
|
38
|
-
- rvm: 2.0.0
|
|
39
|
-
gemfile: gemfiles/activerecord_4.gemfile
|
|
40
|
-
env: ADAPTER=active_record
|
|
41
|
-
|
|
42
|
-
- rvm: 2.3.0
|
|
43
|
-
gemfile: gemfiles/activerecord_5.gemfile
|
|
44
|
-
env: ADAPTER=active_record
|
|
45
|
-
- rvm: 2.2.4
|
|
46
|
-
gemfile: gemfiles/activerecord_5.gemfile
|
|
47
|
-
env: ADAPTER=active_record
|
|
48
|
-
|
|
49
|
-
- rvm: 2.3.0
|
|
50
|
-
gemfile: gemfiles/mongoid_3.gemfile
|
|
51
|
-
env: ADAPTER=mongoid
|
|
52
|
-
- rvm: 2.2.4
|
|
53
|
-
gemfile: gemfiles/mongoid_3.gemfile
|
|
54
|
-
env: ADAPTER=mongoid
|
|
55
|
-
- rvm: 2.1.8
|
|
56
|
-
gemfile: gemfiles/mongoid_3.gemfile
|
|
57
|
-
env: ADAPTER=mongoid
|
|
58
|
-
- rvm: 2.0.0
|
|
59
|
-
gemfile: gemfiles/mongoid_3.gemfile
|
|
60
|
-
env: ADAPTER=mongoid
|
|
61
|
-
|
|
62
|
-
- rvm: 2.3.0
|
|
63
|
-
gemfile: gemfiles/mongoid_4.gemfile
|
|
64
|
-
env: ADAPTER=mongoid
|
|
65
|
-
- rvm: 2.2.4
|
|
66
|
-
gemfile: gemfiles/mongoid_4.gemfile
|
|
67
|
-
env: ADAPTER=mongoid
|
|
68
|
-
- rvm: 2.1.8
|
|
69
|
-
gemfile: gemfiles/mongoid_4.gemfile
|
|
70
|
-
env: ADAPTER=mongoid
|
|
71
|
-
- rvm: 2.0.0
|
|
72
|
-
gemfile: gemfiles/mongoid_4.gemfile
|
|
73
|
-
env: ADAPTER=mongoid
|
|
74
|
-
|
|
75
|
-
- rvm: 2.3.0
|
|
76
|
-
gemfile: gemfiles/mongoid_5.gemfile
|
|
77
|
-
env: ADAPTER=mongoid
|
|
78
|
-
- rvm: 2.2.4
|
|
79
|
-
gemfile: gemfiles/mongoid_5.gemfile
|
|
32
|
+
matrix:
|
|
33
|
+
exclude:
|
|
34
|
+
- gemfile: gemfiles/activerecord_4.gemfile
|
|
80
35
|
env: ADAPTER=mongoid
|
|
81
|
-
-
|
|
82
|
-
gemfile: gemfiles/mongoid_5.gemfile
|
|
36
|
+
- gemfile: gemfiles/activerecord_5.gemfile
|
|
83
37
|
env: ADAPTER=mongoid
|
|
84
|
-
-
|
|
85
|
-
gemfile: gemfiles/mongoid_5.gemfile
|
|
38
|
+
- gemfile: gemfiles/activerecord_6.gemfile
|
|
86
39
|
env: ADAPTER=mongoid
|
|
87
|
-
|
|
40
|
+
- gemfile: gemfiles/activerecord_6.gemfile
|
|
41
|
+
rvm: 2.4.6
|
|
42
|
+
- gemfile: gemfiles/activerecord_6.gemfile
|
|
43
|
+
rvm: 2.3.8
|
|
44
|
+
- gemfile: gemfiles/mongoid_5.gemfile
|
|
45
|
+
env: ADAPTER=active_record
|
|
46
|
+
- gemfile: gemfiles/mongoid_6.gemfile
|
|
47
|
+
env: ADAPTER=active_record
|
|
48
|
+
- gemfile: gemfiles/mongoid_7.gemfile
|
|
49
|
+
env: ADAPTER=active_record
|
|
50
|
+
allow_failures:
|
|
51
|
+
- gemfile: gemfiles/mongoid_6.gemfile
|
|
52
|
+
- gemfile: gemfiles/mongoid_7.gemfile
|
|
88
53
|
|
|
89
54
|
services: mongodb
|
|
90
55
|
|
data/Appraisals
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
appraise 'mongoid-3' do
|
|
2
|
-
gem "mongoid", "~> 3"
|
|
3
|
-
gem "bson_ext", :platform => "ruby"
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
appraise 'mongoid-4' do
|
|
7
|
-
gem "mongoid", "~> 4"
|
|
8
|
-
gem "bson_ext", :platform => "ruby"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
1
|
appraise 'mongoid-5' do
|
|
12
2
|
gem "mongoid", "~> 5"
|
|
13
|
-
gem "bson_ext",
|
|
3
|
+
gem "bson_ext", "1.5.1"
|
|
4
|
+
gem 'bigdecimal', '1.4.2'
|
|
14
5
|
end
|
|
15
6
|
|
|
16
|
-
appraise '
|
|
17
|
-
gem "
|
|
18
|
-
gem "
|
|
7
|
+
appraise 'mongoid-6' do
|
|
8
|
+
gem "mongoid", "~> 6"
|
|
9
|
+
gem "bson_ext", "1.5.1"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
appraise 'mongoid-7' do
|
|
13
|
+
gem "mongoid", "~> 7"
|
|
14
|
+
gem "bson_ext", "1.5.1"
|
|
15
|
+
gem "railties", "5.2.4.1"
|
|
19
16
|
end
|
|
20
17
|
|
|
21
18
|
appraise 'activerecord-4' do
|
|
22
|
-
gem "sqlite3",
|
|
23
|
-
gem "activerecord", "~> 4.2.
|
|
19
|
+
gem "sqlite3", "~> 1.3.6"
|
|
20
|
+
gem "activerecord", "~> 4.2.11", :require => "active_record"
|
|
21
|
+
gem 'bigdecimal', '1.4.2'
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
appraise 'activerecord-5' do
|
|
27
|
-
gem "sqlite3",
|
|
28
|
-
gem "activerecord", "
|
|
25
|
+
gem "sqlite3", "~> 1.3.6"
|
|
26
|
+
gem "activerecord", "~> 5.2.4", :require => "active_record"
|
|
29
27
|
|
|
30
28
|
# Ammeter dependencies:
|
|
31
|
-
gem "actionpack", "
|
|
32
|
-
gem "activemodel", "
|
|
33
|
-
gem "railties", "
|
|
29
|
+
gem "actionpack", "~> 5.2.4"
|
|
30
|
+
gem "activemodel", "~> 5.2.4"
|
|
31
|
+
gem "railties", "~> 5.2.4"
|
|
34
32
|
|
|
35
33
|
gem 'rspec-rails' , github: 'rspec/rspec-rails'
|
|
36
34
|
gem 'rspec-core' , github: 'rspec/rspec-core'
|
|
37
35
|
gem 'rspec-expectations', github: 'rspec/rspec-expectations'
|
|
38
36
|
gem 'rspec-mocks' , github: 'rspec/rspec-mocks'
|
|
39
37
|
gem 'rspec-support' , github: 'rspec/rspec-support'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
appraise 'activerecord-6' do
|
|
41
|
+
gem "sqlite3", "~> 1.4", :platform => "ruby"
|
|
42
|
+
gem "activerecord", ">= 6.0.0", :require => "active_record"
|
|
40
43
|
|
|
44
|
+
# Ammeter dependencies:
|
|
45
|
+
gem "actionpack", ">= 6.0.0"
|
|
46
|
+
gem "activemodel", ">= 6.0.0"
|
|
47
|
+
gem "railties", ">= 6.0.0"
|
|
48
|
+
|
|
49
|
+
gem 'rspec-rails' , github: 'rspec/rspec-rails'
|
|
50
|
+
gem 'rspec-core' , github: 'rspec/rspec-core'
|
|
51
|
+
gem 'rspec-expectations', github: 'rspec/rspec-expectations'
|
|
52
|
+
gem 'rspec-mocks' , github: 'rspec/rspec-mocks'
|
|
53
|
+
gem 'rspec-support' , github: 'rspec/rspec-support'
|
|
41
54
|
end
|
data/CHANGELOG.rdoc
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
= 5.3.0 (June 1, 2020)
|
|
2
|
+
|
|
3
|
+
5.3.0 will be the last version to support Ruby < 2.5 and Rails < 5.2. Support for these will be dropped in the next major release.
|
|
4
|
+
|
|
5
|
+
* Fix deprecation warning in Ruby 2.7
|
|
6
|
+
* Add Rails 6 support to migration generator
|
|
7
|
+
* Significant ActiveRecord performance improvements to <tt>add_role</tt> and <tt>without_role</tt>
|
|
8
|
+
* Mongoid fix and performance improvement and to <tt>roles_name</tt>
|
|
9
|
+
* Make it safe to call <tt>Thing.with_role(:admin, user)</tt> with new record
|
|
10
|
+
|
|
1
11
|
= 5.2.0 (Dec 14, 2017)
|
|
2
12
|
* Fix regression in generator around belongs_to options compatibility
|
|
3
13
|
* Update version of database_cleaner
|
|
@@ -126,7 +136,7 @@
|
|
|
126
136
|
* fixed a backward incompatible change introduced in Rails 3.2 release (<tt>find_or_create_by_* generated methods</tt>)
|
|
127
137
|
|
|
128
138
|
= 2.2 (Jan 18, 2012)
|
|
129
|
-
* fixed a bug in the initializer file regarding dynamic shortcuts
|
|
139
|
+
* fixed a bug in the initializer file regarding dynamic shortcuts
|
|
130
140
|
|
|
131
141
|
= 2.1 (Nov 30, 2011)
|
|
132
142
|
* added syntactic sugar: <tt>grant</tt> and <tt>revoke</tt> are aliases for <tt>has_role</tt> and <tt>has_no_role</tt>
|
|
@@ -167,8 +177,8 @@
|
|
|
167
177
|
|
|
168
178
|
= 1.0 (Aug 25, 2011)
|
|
169
179
|
* added a new parameter to disable dynamic shortcut methods due to potential incompatibility with other gems using method_missing with the same pattern
|
|
170
|
-
* add <tt>Rolify.dynamic_shortcuts = false</tt> in the initializer file or
|
|
171
|
-
* use the generator command with a third parameter:
|
|
180
|
+
* add <tt>Rolify.dynamic_shortcuts = false</tt> in the initializer file or
|
|
181
|
+
* use the generator command with a third parameter:
|
|
172
182
|
* <tt>rails g rolify:role Role User false</tt>
|
|
173
183
|
* removed the railtie as it created more problems than it solved
|
|
174
184
|
* code refactoring to do some speed improvements and code clean up
|
|
@@ -177,16 +187,16 @@
|
|
|
177
187
|
* rolify is now on travis-ci to monitor build status
|
|
178
188
|
|
|
179
189
|
= 0.7 (June 20, 2011)
|
|
180
|
-
* added a method_missing to catch newly created role outside the current ruby process (i.e. dynamic shortcut methods are not defined within this process)
|
|
181
|
-
* dynamic shortcut is created on the fly in the method_missing to avoid extra method_missing for the same dynamic shortcut
|
|
182
|
-
* check if the role actually exists in the database before defining the new method
|
|
190
|
+
* added a method_missing to catch newly created role outside the current ruby process (i.e. dynamic shortcut methods are not defined within this process)
|
|
191
|
+
* dynamic shortcut is created on the fly in the method_missing to avoid extra method_missing for the same dynamic shortcut
|
|
192
|
+
* check if the role actually exists in the database before defining the new method
|
|
183
193
|
* first call is slower due to method_missing but next calls are fast
|
|
184
194
|
* avoid strange bugs when spawning many ruby processes as the dynamic shortcut methods were only defined in the process that used the <tt>has_role</tt> command
|
|
185
195
|
|
|
186
196
|
= 0.6 (June 19, 2011)
|
|
187
197
|
* custom User and Role class names support
|
|
188
198
|
* can now use other class names for Role and User classes
|
|
189
|
-
* fixed generators and templates
|
|
199
|
+
* fixed generators and templates
|
|
190
200
|
* join table is explicitly set to avoid alphabetical order issue
|
|
191
201
|
* created a new railtie to load the dynamic shortcuts at startup
|
|
192
202
|
|
|
@@ -208,7 +218,7 @@
|
|
|
208
218
|
* Trying to remove a role scoped to a resource whereas the user has a global role won't remove it
|
|
209
219
|
|
|
210
220
|
= v0.3 (June 06, 2011)
|
|
211
|
-
* multiple roles check:
|
|
221
|
+
* multiple roles check:
|
|
212
222
|
* <tt>has_all_roles?</tt> returns true if the user has ALL the roles in arguments
|
|
213
223
|
* <tt>has_any_role?</tt> returns true if the user has ANY the roles in arguments
|
|
214
224
|
|
data/Gemfile
CHANGED
|
@@ -4,8 +4,9 @@ group :test do
|
|
|
4
4
|
gem 'appraisal'
|
|
5
5
|
gem 'coveralls', :require => false
|
|
6
6
|
gem 'its'
|
|
7
|
+
gem 'pry', '< 0.13.0' # pry pins can be removed when we drop Ruby 2.3
|
|
7
8
|
gem 'byebug'
|
|
8
|
-
gem 'pry-byebug'
|
|
9
|
+
gem 'pry-byebug', '< 3.8.0'
|
|
9
10
|
gem 'test-unit' # Implicitly loaded by ammeter
|
|
10
11
|
gem 'database_cleaner', '~> 1.6.2'
|
|
11
12
|
gem 'codeclimate-test-reporter', :require => nil
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# rolify [](http://badge.fury.io/rb/rolify) [](http://badge.fury.io/rb/rolify) [](http://travis-ci.org/RolifyCommunity/rolify) [](https://codeclimate.com/github/RolifyCommunity/rolify) [](https://coveralls.io/github/RolifyCommunity/rolify?branch=master)
|
|
2
2
|
|
|
3
3
|
Very simple Roles library without any authorization enforcement supporting scope on resource object.
|
|
4
4
|
|
|
@@ -15,9 +15,9 @@ This library can be easily integrated with any authentication gem ([devise](http
|
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
* Rails >=
|
|
19
|
-
* ActiveRecord >=
|
|
20
|
-
* supports ruby 2.
|
|
18
|
+
* Rails >= 4.2
|
|
19
|
+
* ActiveRecord >= 4.2 <b>or</b> Mongoid >= 4.0
|
|
20
|
+
* supports ruby 2.2+, JRuby 1.6.0+ (in 1.9 mode) and Rubinius 2.0.0dev (in 1.9 mode)
|
|
21
21
|
* support of ruby 1.8 has been dropped due to Mongoid >=3.0 that only supports 1.9 new hash syntax
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
@@ -46,7 +46,7 @@ rails g rolify Role User
|
|
|
46
46
|
rails g rolify:role Role User
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
The generator will create your Role model, add a migration file, and update your User class with new class methods.
|
|
49
|
+
The generator will create your Role model, add a migration file, and update your User class with new class methods.
|
|
50
50
|
|
|
51
51
|
### 2. Run the migration (only required when using ActiveRecord)
|
|
52
52
|
|
|
@@ -181,6 +181,17 @@ user.has_role? :moderator, Forum.last
|
|
|
181
181
|
=> true
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
To check if a user has the exact role scoped to a resource class:
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
user = User.find(5)
|
|
188
|
+
user.add_role :moderator # sets a global role
|
|
189
|
+
user.has_role? :moderator, Forum.first
|
|
190
|
+
=> true
|
|
191
|
+
user.has_strict_role? :moderator, Forum.last
|
|
192
|
+
=> false
|
|
193
|
+
```
|
|
194
|
+
|
|
184
195
|
### 6. Resource roles querying
|
|
185
196
|
|
|
186
197
|
Starting from rolify 3.0, you can search roles on instance level or class level resources.
|
data/Rakefile
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "sqlite3",
|
|
6
|
-
gem "activerecord", "~> 4.2.
|
|
5
|
+
gem "sqlite3", "~> 1.3.6"
|
|
6
|
+
gem "activerecord", "~> 4.2.11", require: "active_record"
|
|
7
|
+
gem "bigdecimal", "1.4.2"
|
|
7
8
|
|
|
8
9
|
group :test do
|
|
9
10
|
gem "appraisal"
|
|
10
11
|
gem "coveralls", require: false
|
|
11
12
|
gem "its"
|
|
13
|
+
gem "pry", "< 0.13.0"
|
|
12
14
|
gem "byebug"
|
|
13
|
-
gem "pry-byebug"
|
|
15
|
+
gem "pry-byebug", "< 3.8.0"
|
|
14
16
|
gem "test-unit"
|
|
15
17
|
gem "database_cleaner", "~> 1.6.2"
|
|
16
18
|
gem "codeclimate-test-reporter", require: nil
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "sqlite3",
|
|
6
|
-
gem "activerecord", "
|
|
7
|
-
gem "actionpack", "
|
|
8
|
-
gem "activemodel", "
|
|
9
|
-
gem "railties", "
|
|
5
|
+
gem "sqlite3", "~> 1.3.6"
|
|
6
|
+
gem "activerecord", "~> 5.2.4", require: "active_record"
|
|
7
|
+
gem "actionpack", "~> 5.2.4"
|
|
8
|
+
gem "activemodel", "~> 5.2.4"
|
|
9
|
+
gem "railties", "~> 5.2.4"
|
|
10
10
|
gem "rspec-rails", github: "rspec/rspec-rails"
|
|
11
11
|
gem "rspec-core", github: "rspec/rspec-core"
|
|
12
12
|
gem "rspec-expectations", github: "rspec/rspec-expectations"
|
|
@@ -17,8 +17,9 @@ group :test do
|
|
|
17
17
|
gem "appraisal"
|
|
18
18
|
gem "coveralls", require: false
|
|
19
19
|
gem "its"
|
|
20
|
+
gem "pry", "< 0.13.0"
|
|
20
21
|
gem "byebug"
|
|
21
|
-
gem "pry-byebug"
|
|
22
|
+
gem "pry-byebug", "< 3.8.0"
|
|
22
23
|
gem "test-unit"
|
|
23
24
|
gem "database_cleaner", "~> 1.6.2"
|
|
24
25
|
gem "codeclimate-test-reporter", require: nil
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
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"
|
|
10
|
+
gem "rspec-rails", github: "rspec/rspec-rails"
|
|
11
|
+
gem "rspec-core", github: "rspec/rspec-core"
|
|
12
|
+
gem "rspec-expectations", github: "rspec/rspec-expectations"
|
|
13
|
+
gem "rspec-mocks", github: "rspec/rspec-mocks"
|
|
14
|
+
gem "rspec-support", github: "rspec/rspec-support"
|
|
15
|
+
|
|
16
|
+
group :test do
|
|
17
|
+
gem "appraisal"
|
|
18
|
+
gem "coveralls", require: false
|
|
19
|
+
gem "its"
|
|
20
|
+
gem "pry", "< 0.13.0"
|
|
21
|
+
gem "byebug"
|
|
22
|
+
gem "pry-byebug", "< 3.8.0"
|
|
23
|
+
gem "test-unit"
|
|
24
|
+
gem "database_cleaner", "~> 1.6.2"
|
|
25
|
+
gem "codeclimate-test-reporter", require: nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
gemspec path: "../"
|
data/gemfiles/mongoid_5.gemfile
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
5
|
gem "mongoid", "~> 5"
|
|
6
|
-
gem "bson_ext",
|
|
6
|
+
gem "bson_ext", "1.5.1"
|
|
7
|
+
gem "bigdecimal", "1.4.2"
|
|
7
8
|
|
|
8
9
|
group :test do
|
|
9
10
|
gem "appraisal"
|
|
10
11
|
gem "coveralls", require: false
|
|
11
12
|
gem "its"
|
|
13
|
+
gem "pry", "< 0.13.0"
|
|
12
14
|
gem "byebug"
|
|
13
|
-
gem "pry-byebug"
|
|
15
|
+
gem "pry-byebug", "< 3.8.0"
|
|
14
16
|
gem "test-unit"
|
|
15
17
|
gem "database_cleaner", "~> 1.6.2"
|
|
16
18
|
gem "codeclimate-test-reporter", require: nil
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "mongoid", "~>
|
|
6
|
-
gem "bson_ext",
|
|
5
|
+
gem "mongoid", "~> 6"
|
|
6
|
+
gem "bson_ext", "1.5.1"
|
|
7
7
|
|
|
8
8
|
group :test do
|
|
9
9
|
gem "appraisal"
|
|
10
10
|
gem "coveralls", require: false
|
|
11
11
|
gem "its"
|
|
12
|
+
gem "pry", "< 0.13.0"
|
|
12
13
|
gem "byebug"
|
|
13
|
-
gem "pry-byebug"
|
|
14
|
+
gem "pry-byebug", "< 3.8.0"
|
|
14
15
|
gem "test-unit"
|
|
15
16
|
gem "database_cleaner", "~> 1.6.2"
|
|
16
17
|
gem "codeclimate-test-reporter", require: nil
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "mongoid", "~>
|
|
6
|
-
gem "bson_ext",
|
|
5
|
+
gem "mongoid", "~> 7"
|
|
6
|
+
gem "bson_ext", "1.5.1"
|
|
7
|
+
gem "railties", "5.2.4.1"
|
|
7
8
|
|
|
8
9
|
group :test do
|
|
9
10
|
gem "appraisal"
|
|
10
11
|
gem "coveralls", require: false
|
|
11
12
|
gem "its"
|
|
13
|
+
gem "pry", "< 0.13.0"
|
|
12
14
|
gem "byebug"
|
|
13
|
-
gem "pry-byebug"
|
|
15
|
+
gem "pry-byebug", "< 3.8.0"
|
|
14
16
|
gem "test-unit"
|
|
15
17
|
gem "database_cleaner", "~> 1.6.2"
|
|
16
18
|
gem "codeclimate-test-reporter", require: nil
|
|
@@ -82,12 +82,12 @@ Please ensure that this model exists and is not mis-spelled and re-run the gener
|
|
|
82
82
|
MSG
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
def
|
|
86
|
-
Rails
|
|
85
|
+
def versioned_migrations?
|
|
86
|
+
Rails::VERSION::MAJOR >= 5
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def migration_version
|
|
90
|
-
if
|
|
90
|
+
if versioned_migrations?
|
|
91
91
|
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
has_and_belongs_to_many :<%= user_class.table_name %>, :join_table => :<%= join_table %>
|
|
1
|
+
has_and_belongs_to_many :<%= user_class.table_name %>, :join_table => :<%= join_table %>
|
|
2
|
+
<% if Rails::VERSION::MAJOR < 5 %>
|
|
3
|
+
belongs_to :resource,
|
|
4
|
+
:polymorphic => true
|
|
5
|
+
<% else %>
|
|
6
|
+
belongs_to :resource,
|
|
7
|
+
:polymorphic => true,
|
|
8
|
+
:optional => true
|
|
9
|
+
<% end %>
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<% else %>
|
|
7
|
-
belongs_to :resource,
|
|
8
|
-
:polymorphic => true,
|
|
9
|
-
:optional => true
|
|
10
|
-
<% end %>
|
|
11
|
+
validates :resource_type,
|
|
12
|
+
:inclusion => { :in => Rolify.resource_types },
|
|
13
|
+
:allow_nil => true
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
:inclusion => { :in => Rolify.resource_types },
|
|
14
|
-
:allow_nil => true
|
|
15
|
-
|
|
16
|
-
scopify
|
|
15
|
+
scopify
|
data/lib/rolify.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Rolify
|
|
|
27
27
|
rolify_options.merge!({ :join_table => self.role_join_table_name }) if Rolify.orm == "active_record"
|
|
28
28
|
rolify_options.merge!(options.reject{ |k,v| ![ :before_add, :after_add, :before_remove, :after_remove, :inverse_of ].include? k.to_sym })
|
|
29
29
|
|
|
30
|
-
has_and_belongs_to_many :roles, rolify_options
|
|
30
|
+
has_and_belongs_to_many :roles, **rolify_options
|
|
31
31
|
|
|
32
32
|
self.adapter = Rolify::Adapter::Base.create("role_adapter", self.role_cname, self.name)
|
|
33
33
|
|
|
@@ -48,7 +48,7 @@ module Rolify
|
|
|
48
48
|
self.role_cname = options[:role_cname]
|
|
49
49
|
self.role_table_name = self.role_cname.tableize.gsub(/\//, "_")
|
|
50
50
|
|
|
51
|
-
has_many association_name, resourcify_options
|
|
51
|
+
has_many association_name, **resourcify_options
|
|
52
52
|
|
|
53
53
|
self.resource_adapter = Rolify::Adapter::Base.create("resource_adapter", self.role_cname, self.name)
|
|
54
54
|
@@resource_types << self.name
|
|
@@ -26,7 +26,7 @@ module Rolify
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def in(relation, user, role_names)
|
|
29
|
-
roles = user.roles.where(:name => role_names).select("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)}")
|
|
29
|
+
roles = user.roles.where(:name => role_names).select("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)}").to_a
|
|
30
30
|
relation.where("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)} IN (?) AND ((#{quote_table(role_class.table_name)}.resource_id = #{quote_table(relation.table_name)}.#{quote_column(relation.primary_key)}) OR (#{quote_table(role_class.table_name)}.resource_id IS NULL))", roles)
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -40,7 +40,7 @@ module Rolify
|
|
|
40
40
|
|
|
41
41
|
def all_except(resource, excluded_obj)
|
|
42
42
|
prime_key = resource.primary_key.to_sym
|
|
43
|
-
resource.where(prime_key =>
|
|
43
|
+
resource.where.not(prime_key => excluded_obj.pluck(prime_key))
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
private
|
|
@@ -46,7 +46,7 @@ module Rolify
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def add(relation, role)
|
|
49
|
-
relation.
|
|
49
|
+
relation.roles << role unless relation.roles.include?(role)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def remove(relation, role_name, resource = nil)
|
|
@@ -68,19 +68,13 @@ module Rolify
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def scope(relation, conditions)
|
|
71
|
-
|
|
72
|
-
query = relation.scoped
|
|
73
|
-
else
|
|
74
|
-
query = relation.all
|
|
75
|
-
end
|
|
76
|
-
query = query.joins(:roles)
|
|
71
|
+
query = relation.joins(:roles)
|
|
77
72
|
query = where(query, conditions)
|
|
78
73
|
query
|
|
79
74
|
end
|
|
80
75
|
|
|
81
76
|
def all_except(user, excluded_obj)
|
|
82
|
-
|
|
83
|
-
user.where(prime_key => (user.all - excluded_obj).map(&prime_key))
|
|
77
|
+
user.where.not(user.primary_key => excluded_obj)
|
|
84
78
|
end
|
|
85
79
|
|
|
86
80
|
private
|
data/lib/rolify/role.rb
CHANGED
data/lib/rolify/version.rb
CHANGED
data/rolify.gemspec
CHANGED
|
@@ -9,7 +9,6 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.version = Rolify::VERSION
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
|
11
11
|
s.homepage = 'https://github.com/RolifyCommunity/rolify'
|
|
12
|
-
s.rubyforge_project = s.name
|
|
13
12
|
|
|
14
13
|
s.license = 'MIT'
|
|
15
14
|
|
|
@@ -27,8 +26,10 @@ Gem::Specification.new do |s|
|
|
|
27
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
28
27
|
s.require_paths = ['lib']
|
|
29
28
|
|
|
29
|
+
s.required_ruby_version = '>= 2.3'
|
|
30
|
+
|
|
30
31
|
s.add_development_dependency 'ammeter', '~> 1.1' # Spec generator
|
|
31
|
-
s.add_development_dependency 'bundler', '~>
|
|
32
|
-
s.add_development_dependency 'rake', '~>
|
|
33
|
-
s.add_development_dependency 'rspec-rails', '~> 3.
|
|
32
|
+
s.add_development_dependency 'bundler', '~> 2.0' # packaging feature
|
|
33
|
+
s.add_development_dependency 'rake', '~> 12.3' # Tasks manager
|
|
34
|
+
s.add_development_dependency 'rspec-rails', '~> 3.8'
|
|
34
35
|
end
|
|
@@ -71,6 +71,7 @@ describe Rolify::Generators::RolifyGenerator, :if => ENV['ADAPTER'] == 'active_r
|
|
|
71
71
|
it { should contain "validates :resource_type,\n"
|
|
72
72
|
" :inclusion => { :in => Rolify.resource_types },\n"
|
|
73
73
|
" :allow_nil => true" }
|
|
74
|
+
it { should contain "scopify" }
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
describe 'app/models/user.rb' do
|
|
@@ -240,6 +241,13 @@ describe Rolify::Generators::RolifyGenerator, :if => ENV['ADAPTER'] == 'active_r
|
|
|
240
241
|
it { should be_a_migration }
|
|
241
242
|
it { should contain "create_table(:admin_roles)" }
|
|
242
243
|
it { should contain "create_table(:admin_users_admin_roles, :id => false) do" }
|
|
244
|
+
it do
|
|
245
|
+
if Rails::VERSION::MAJOR < 5
|
|
246
|
+
should contain "< ActiveRecord::Migration"
|
|
247
|
+
else
|
|
248
|
+
should contain "< ActiveRecord::Migration[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
249
|
+
end
|
|
250
|
+
end
|
|
243
251
|
|
|
244
252
|
context 'mysql2' do
|
|
245
253
|
let(:adapter) { 'Mysql2Adapter' }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Rolify::Utils do
|
|
4
|
+
class Harness
|
|
5
|
+
extend Rolify::Utils
|
|
6
|
+
define_method(:new_method) { |*_args| true }
|
|
7
|
+
deprecate :old_method, :new_method
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
let(:harness) { Harness.new }
|
|
11
|
+
|
|
12
|
+
context '#deprecate' do
|
|
13
|
+
it 'calls new method with same arguments' do
|
|
14
|
+
expect(harness).to receive(:warn).once
|
|
15
|
+
expect(harness).to receive(:new_method).once.with(1, 2, 3)
|
|
16
|
+
harness.old_method(1, 2, 3)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
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: 5.
|
|
4
|
+
version: 5.3.0
|
|
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:
|
|
12
|
+
date: 2020-06-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ammeter
|
|
@@ -31,42 +31,42 @@ dependencies:
|
|
|
31
31
|
requirements:
|
|
32
32
|
- - "~>"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
34
|
+
version: '2.0'
|
|
35
35
|
type: :development
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
39
|
- - "~>"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
41
|
+
version: '2.0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: rake
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
46
|
- - "~>"
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: '
|
|
48
|
+
version: '12.3'
|
|
49
49
|
type: :development
|
|
50
50
|
prerelease: false
|
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
|
53
53
|
- - "~>"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: '
|
|
55
|
+
version: '12.3'
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: rspec-rails
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
60
|
- - "~>"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '3.
|
|
62
|
+
version: '3.8'
|
|
63
63
|
type: :development
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - "~>"
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '3.
|
|
69
|
+
version: '3.8'
|
|
70
70
|
description: Very simple Roles library without any authorization enforcement supporting
|
|
71
71
|
scope on resource objects (instance or class). Supports ActiveRecord and Mongoid
|
|
72
72
|
ORMs.
|
|
@@ -78,6 +78,7 @@ extensions: []
|
|
|
78
78
|
extra_rdoc_files: []
|
|
79
79
|
files:
|
|
80
80
|
- ".gitignore"
|
|
81
|
+
- ".hakiri.yml"
|
|
81
82
|
- ".travis.yml"
|
|
82
83
|
- Appraisals
|
|
83
84
|
- CHANGELOG.rdoc
|
|
@@ -87,15 +88,12 @@ files:
|
|
|
87
88
|
- README.md
|
|
88
89
|
- Rakefile
|
|
89
90
|
- UPGRADE.rdoc
|
|
90
|
-
- gemfiles/Gemfile.rails-3.2
|
|
91
|
-
- gemfiles/Gemfile.rails-4.0
|
|
92
|
-
- gemfiles/Gemfile.rails-4.1
|
|
93
|
-
- gemfiles/activerecord_3.gemfile
|
|
94
91
|
- gemfiles/activerecord_4.gemfile
|
|
95
92
|
- gemfiles/activerecord_5.gemfile
|
|
96
|
-
- gemfiles/
|
|
97
|
-
- gemfiles/mongoid_4.gemfile
|
|
93
|
+
- gemfiles/activerecord_6.gemfile
|
|
98
94
|
- gemfiles/mongoid_5.gemfile
|
|
95
|
+
- gemfiles/mongoid_6.gemfile
|
|
96
|
+
- gemfiles/mongoid_7.gemfile
|
|
99
97
|
- lib/generators/active_record/rolify_generator.rb
|
|
100
98
|
- lib/generators/active_record/templates/README
|
|
101
99
|
- lib/generators/active_record/templates/migration.rb
|
|
@@ -153,12 +151,13 @@ files:
|
|
|
153
151
|
- spec/rolify/shared_examples/shared_examples_for_remove_role.rb
|
|
154
152
|
- spec/rolify/shared_examples/shared_examples_for_roles.rb
|
|
155
153
|
- spec/rolify/shared_examples/shared_examples_for_scopes.rb
|
|
154
|
+
- spec/rolify/utils_spec.rb
|
|
156
155
|
- spec/spec_helper.rb
|
|
157
156
|
- spec/support/adapters/active_record.rb
|
|
158
157
|
- spec/support/adapters/mongoid.rb
|
|
159
|
-
- spec/support/adapters/mongoid_3.yml
|
|
160
|
-
- spec/support/adapters/mongoid_4.yml
|
|
161
158
|
- spec/support/adapters/mongoid_5.yml
|
|
159
|
+
- spec/support/adapters/mongoid_6.yml
|
|
160
|
+
- spec/support/adapters/mongoid_7.yml
|
|
162
161
|
- spec/support/adapters/utils/active_record.rb
|
|
163
162
|
- spec/support/adapters/utils/mongoid.rb
|
|
164
163
|
- spec/support/data.rb
|
|
@@ -176,15 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
176
175
|
requirements:
|
|
177
176
|
- - ">="
|
|
178
177
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '
|
|
178
|
+
version: '2.3'
|
|
180
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
180
|
requirements:
|
|
182
181
|
- - ">="
|
|
183
182
|
- !ruby/object:Gem::Version
|
|
184
183
|
version: '0'
|
|
185
184
|
requirements: []
|
|
186
|
-
|
|
187
|
-
rubygems_version: 2.6.14
|
|
185
|
+
rubygems_version: 3.1.2
|
|
188
186
|
signing_key:
|
|
189
187
|
specification_version: 4
|
|
190
188
|
summary: Roles library with resource scoping
|
|
@@ -216,12 +214,13 @@ test_files:
|
|
|
216
214
|
- spec/rolify/shared_examples/shared_examples_for_remove_role.rb
|
|
217
215
|
- spec/rolify/shared_examples/shared_examples_for_roles.rb
|
|
218
216
|
- spec/rolify/shared_examples/shared_examples_for_scopes.rb
|
|
217
|
+
- spec/rolify/utils_spec.rb
|
|
219
218
|
- spec/spec_helper.rb
|
|
220
219
|
- spec/support/adapters/active_record.rb
|
|
221
220
|
- spec/support/adapters/mongoid.rb
|
|
222
|
-
- spec/support/adapters/mongoid_3.yml
|
|
223
|
-
- spec/support/adapters/mongoid_4.yml
|
|
224
221
|
- spec/support/adapters/mongoid_5.yml
|
|
222
|
+
- spec/support/adapters/mongoid_6.yml
|
|
223
|
+
- spec/support/adapters/mongoid_7.yml
|
|
225
224
|
- spec/support/adapters/utils/active_record.rb
|
|
226
225
|
- spec/support/adapters/utils/mongoid.rb
|
|
227
226
|
- spec/support/data.rb
|
data/gemfiles/Gemfile.rails-3.2
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
platforms :rbx do
|
|
4
|
-
gem 'psych'
|
|
5
|
-
gem 'rubinius-coverage', '~> 2.0'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
group :test do
|
|
9
|
-
gem 'railties', '~> 3.2', '< 4.0'
|
|
10
|
-
case ENV['ADAPTER']
|
|
11
|
-
when nil, 'active_record'
|
|
12
|
-
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0.rc', :platform => 'jruby'
|
|
13
|
-
#Fix sqlite3 version for rbx until rubinus is updated
|
|
14
|
-
#https://github.com/travis-ci/travis-ci/issues/2006
|
|
15
|
-
gem 'sqlite3', '1.3.8', :platform => 'ruby'
|
|
16
|
-
gem 'activerecord', '~> 3.2.0', :require => 'active_record'
|
|
17
|
-
when 'mongoid'
|
|
18
|
-
gem 'mongoid', '>= 3.1'
|
|
19
|
-
gem 'bson_ext', :platform => 'ruby'
|
|
20
|
-
else
|
|
21
|
-
raise "Unknown model adapter: #{ENV['ADAPTER']}"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
gem 'coveralls', :require => false
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
gemspec :path => '../'
|
data/gemfiles/Gemfile.rails-4.0
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
platforms :rbx do
|
|
4
|
-
gem 'psych'
|
|
5
|
-
gem 'rubinius-coverage', '~> 2.0'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
group :test do
|
|
9
|
-
gem 'railties', '~> 4.0.1', '< 4.1'
|
|
10
|
-
gem 'ammeter'
|
|
11
|
-
gem 'rake'
|
|
12
|
-
gem 'rspec'
|
|
13
|
-
gem 'its'
|
|
14
|
-
gem 'rspec-rails'
|
|
15
|
-
gem 'fuubar'
|
|
16
|
-
gem 'bundler'
|
|
17
|
-
|
|
18
|
-
gem 'coveralls', :require => false
|
|
19
|
-
|
|
20
|
-
case ENV['ADAPTER']
|
|
21
|
-
when nil, 'active_record'
|
|
22
|
-
gem 'activerecord', '~> 4.0.1', :require => 'active_record'
|
|
23
|
-
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3.5', :platform => 'jruby'
|
|
24
|
-
#Fix sqlite3 version for rbx until rubinus is updated
|
|
25
|
-
#https://github.com/travis-ci/travis-ci/issues/2006
|
|
26
|
-
gem 'sqlite3', '1.3.8', :platform => 'ruby'
|
|
27
|
-
when 'mongoid'
|
|
28
|
-
gem 'mongoid', github: 'mongoid/mongoid'
|
|
29
|
-
gem 'bson_ext', :platform => 'ruby'
|
|
30
|
-
else
|
|
31
|
-
raise "Unknown model adapter: #{ENV['ADAPTER']}"
|
|
32
|
-
end
|
|
33
|
-
end
|
data/gemfiles/Gemfile.rails-4.1
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
platforms :rbx do
|
|
4
|
-
gem 'psych'
|
|
5
|
-
gem 'rubinius-coverage', '~> 2.0'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
group :test do
|
|
9
|
-
gem 'rails', github: 'rails/rails', branch: '4-1-stable'
|
|
10
|
-
# There is currently an active record bug in Rails 4.1.0, this is a workaround until 4.1.1 is released
|
|
11
|
-
# See https://github.com/rails/rails/issues/13648
|
|
12
|
-
# Without this patch, Resource.with_role(:role, User.first).count throws an SQL syntax exception
|
|
13
|
-
#gem 'railties', '~> 4.1.0'
|
|
14
|
-
gem 'ammeter'
|
|
15
|
-
gem 'rake'
|
|
16
|
-
gem 'rspec'
|
|
17
|
-
gem 'its'
|
|
18
|
-
gem 'rspec-rails'
|
|
19
|
-
gem 'fuubar'
|
|
20
|
-
gem 'bundler'
|
|
21
|
-
|
|
22
|
-
gem 'coveralls', :require => false
|
|
23
|
-
|
|
24
|
-
case ENV['ADAPTER']
|
|
25
|
-
when nil, 'active_record'
|
|
26
|
-
gem 'activerecord', '~> 4.1.0', :require => 'active_record'
|
|
27
|
-
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3.5', :platform => 'jruby'
|
|
28
|
-
#Fix sqlite3 version for rbx until rubinus is updated
|
|
29
|
-
#https://github.com/travis-ci/travis-ci/issues/2006
|
|
30
|
-
gem 'sqlite3', '1.3.8', :platform => 'ruby'
|
|
31
|
-
when 'mongoid'
|
|
32
|
-
gem 'mongoid', github: 'mongoid/mongoid'
|
|
33
|
-
gem 'bson_ext', :platform => 'ruby'
|
|
34
|
-
else
|
|
35
|
-
raise "Unknown model adapter: #{ENV['ADAPTER']}"
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# This file was generated by Appraisal
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gem "sqlite3", platform: "ruby"
|
|
6
|
-
gem "activerecord", "~> 3.2.0", require: "active_record"
|
|
7
|
-
|
|
8
|
-
group :test do
|
|
9
|
-
gem "appraisal"
|
|
10
|
-
gem "coveralls", require: false
|
|
11
|
-
gem "its"
|
|
12
|
-
gem "byebug"
|
|
13
|
-
gem "pry-byebug"
|
|
14
|
-
gem "test-unit"
|
|
15
|
-
gem "database_cleaner", "~> 1.6.2"
|
|
16
|
-
gem "codeclimate-test-reporter", require: nil
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
gemspec path: "../"
|