roleable 0.1.0 → 0.2.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.
- data/README.md +17 -7
- data/lib/generators/roleable/install/USAGE +1 -1
- data/lib/generators/roleable/install/install_generator.rb +4 -3
- data/lib/generators/roleable/install/templates/applied_role.rb +5 -0
- data/lib/generators/roleable/install/templates/initializer.rb +4 -0
- data/lib/generators/roleable/install/templates/migration.rb +5 -6
- data/lib/roleable.rb +14 -1
- data/lib/roleable/{user_role.rb → applied_role.rb} +10 -10
- data/lib/roleable/configuration.rb +9 -0
- data/lib/roleable/resource.rb +12 -5
- data/lib/roleable/role.rb +1 -1
- data/lib/roleable/subject.rb +21 -19
- data/lib/roleable/version.rb +1 -1
- data/spec/roleable/resource_spec.rb +8 -7
- data/spec/roleable/subject_spec.rb +5 -5
- data/spec/support/shared_contexts.rb +3 -3
- metadata +66 -98
- data/lib/generators/roleable/install/templates/user_role.rb +0 -5
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://travis-ci.org/mcrowe/roleable)
|
4
4
|
|
5
|
-
A flexible
|
5
|
+
A flexible roles solution for active-record-backed Rails 3 applications. Allows for multiple roles scoped to instances of any model, as well as global roles (admin, for example).
|
6
6
|
|
7
7
|
Roleable is designed to be ultra simple and obvious, letting you build upon it to satisfy your needs. It is also designed to be efficient: using database indices, and well-crafted queries so that it can handle a huge number of roles.
|
8
8
|
|
@@ -18,7 +18,7 @@ And then execute:
|
|
18
18
|
|
19
19
|
$ bundle
|
20
20
|
|
21
|
-
Run the generator to create the `Role` and `
|
21
|
+
Run the generator to create the `Role` and `AppliedRole` models, migrations, and a configuration initializer:
|
22
22
|
|
23
23
|
$ rails g roleable:install
|
24
24
|
|
@@ -26,11 +26,11 @@ And then run the migrations:
|
|
26
26
|
|
27
27
|
$ rake db:migrate
|
28
28
|
|
29
|
-
(This will create the `roles` and `
|
29
|
+
(This will create the `roles` and `applied_roles` tables, together with the appropriate database indices.)
|
30
30
|
|
31
31
|
## Setup
|
32
32
|
|
33
|
-
Include `Roleable::Subject` into your
|
33
|
+
Include `Roleable::Subject` into your subject model, e.g.:
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
class User < ActiveRecord::Base
|
@@ -39,7 +39,7 @@ class User < ActiveRecord::Base
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
|
-
Include `Roleable::Resource` into any models you want to relate a
|
42
|
+
Include `Roleable::Resource` into any models you want to relate a subject role to (resource), e.g.:
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
class Page < ActiveRecord::Base
|
@@ -108,10 +108,20 @@ user.roles_for_resource(nil)
|
|
108
108
|
|
109
109
|
### Resource
|
110
110
|
|
111
|
-
Find users with a given role:
|
111
|
+
Find subjects (users) with a given role:
|
112
112
|
|
113
113
|
```ruby
|
114
|
-
page.
|
114
|
+
page.subjects_with_role(:editor)
|
115
|
+
```
|
116
|
+
|
117
|
+
## Customization
|
118
|
+
|
119
|
+
By default, roleable assumes that your subject model is called `User`. You can customize this by modifying the generated configuration intializer located at `config/initializers/roleable.rb`, e.g.:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
Roleable.configure do |config|
|
123
|
+
config.subject_class_name = 'principle'
|
124
|
+
end
|
115
125
|
```
|
116
126
|
|
117
127
|
Find users matching _any_ of a list of roles:
|
@@ -1,2 +1,2 @@
|
|
1
1
|
Description:
|
2
|
-
The roleable:install generator creates `Role` and `
|
2
|
+
The roleable:install generator creates `Role` and `AppliedRole` models, and generates the necessary migrations to create their database tables.
|
@@ -6,11 +6,12 @@ module Roleable
|
|
6
6
|
include Rails::Generators::Migration
|
7
7
|
source_root File.expand_path('../templates', __FILE__)
|
8
8
|
|
9
|
-
desc 'Generates a role and a
|
9
|
+
desc 'Generates a role and a applied_role model, along with migrations for their tables.'
|
10
10
|
def generate_install
|
11
11
|
copy_file 'role.rb', 'app/models/role.rb'
|
12
|
-
copy_file '
|
13
|
-
|
12
|
+
copy_file 'applied_role.rb', 'app/models/applied_role.rb'
|
13
|
+
copy_file 'initializer.rb', 'config/initializers/roleable.rb'
|
14
|
+
migration_template 'migration.rb', 'db/migrate/roleable_create_roles_and_applied_roles.rb'
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.next_migration_number(path)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class RoleableCreateRolesAndAppliedRoles < ActiveRecord::Migration
|
2
2
|
|
3
3
|
def change
|
4
4
|
create_table :roles do |t|
|
@@ -6,16 +6,15 @@ class RoleableCreateRolesAndUserRoles < ActiveRecord::Migration
|
|
6
6
|
t.timestamps
|
7
7
|
end
|
8
8
|
|
9
|
-
create_table :
|
10
|
-
t.references :
|
9
|
+
create_table :applied_roles do |t|
|
10
|
+
t.references :subject
|
11
11
|
t.references :role
|
12
12
|
t.references :resource, :polymorphic => true
|
13
13
|
t.timestamps
|
14
14
|
end
|
15
15
|
|
16
|
-
add_index :
|
17
|
-
add_index :
|
18
|
-
add_index :user_roles, [:resource_type, :resource_id]
|
16
|
+
add_index :applied_roles, :subject_id
|
17
|
+
add_index :applied_roles, [:resource_type, :resource_id]
|
19
18
|
end
|
20
19
|
|
21
20
|
end
|
data/lib/roleable.rb
CHANGED
@@ -2,4 +2,17 @@ require 'roleable/version'
|
|
2
2
|
require 'roleable/subject'
|
3
3
|
require 'roleable/resource'
|
4
4
|
require 'roleable/role'
|
5
|
-
require 'roleable/
|
5
|
+
require 'roleable/applied_role'
|
6
|
+
require 'roleable/configuration'
|
7
|
+
|
8
|
+
module Roleable
|
9
|
+
|
10
|
+
def self.configuration
|
11
|
+
@configuration ||= Roleable::Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.configure
|
15
|
+
yield configuration if block_given?
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module Roleable::
|
1
|
+
module Roleable::AppliedRole
|
2
2
|
|
3
3
|
def self.extended(base)
|
4
|
-
base.belongs_to :
|
4
|
+
base.belongs_to :subject, :class_name => Roleable.configuration.subject_class_name
|
5
5
|
base.belongs_to :role
|
6
6
|
base.belongs_to :resource, :polymorphic => true
|
7
7
|
|
8
|
-
base.attr_accessible :role, :
|
8
|
+
base.attr_accessible :role, :subject_id, :resource
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
where(:
|
11
|
+
def with_subject(subject)
|
12
|
+
where(:subject_id => subject && subject.id)
|
13
13
|
end
|
14
14
|
|
15
15
|
def with_resource(resource)
|
@@ -35,14 +35,14 @@ module Roleable::UserRole
|
|
35
35
|
#
|
36
36
|
# Returns the record if it was saved, otherwise nil.
|
37
37
|
def create_if_unique!(attributes)
|
38
|
-
|
39
|
-
|
40
|
-
record_attributes =
|
38
|
+
applied_role = new(attributes)
|
39
|
+
|
40
|
+
record_attributes = applied_role.attributes.reject do |k, v|
|
41
41
|
%w(id updated_at created_at).include?(k)
|
42
42
|
end
|
43
43
|
|
44
|
-
if !exists?(record_attributes) &&
|
45
|
-
|
44
|
+
if !exists?(record_attributes) && applied_role.save
|
45
|
+
applied_role
|
46
46
|
else
|
47
47
|
nil
|
48
48
|
end
|
data/lib/roleable/resource.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Roleable::Resource
|
2
2
|
|
3
3
|
def self.included(base)
|
4
|
-
base.has_many :
|
4
|
+
base.has_many :applied_roles, :as => :resource
|
5
5
|
end
|
6
6
|
|
7
7
|
# Return a list of users that have the given role for this resource.
|
@@ -9,11 +9,18 @@ module Roleable::Resource
|
|
9
9
|
#
|
10
10
|
# ==== Examples
|
11
11
|
#
|
12
|
-
# page.
|
13
|
-
# page.
|
12
|
+
# page.subjects_with_role(:editor) # => [user1, user2, ...]
|
13
|
+
# page.subjects_with_role([:editor, :author]) # => [user1, user2, ...]
|
14
14
|
#
|
15
|
-
def
|
16
|
-
|
15
|
+
def subjects_with_role(role_name)
|
16
|
+
subject_class.joins(:applied_roles).
|
17
|
+
merge( ::AppliedRole.with_role_name(role_name).with_resource(self) )
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def subject_class
|
23
|
+
Roleable.configuration.subject_class_name.classify.constantize
|
17
24
|
end
|
18
25
|
|
19
26
|
end
|
data/lib/roleable/role.rb
CHANGED
data/lib/roleable/subject.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Roleable::Subject
|
2
2
|
|
3
3
|
def self.included(base)
|
4
|
-
base.has_many :
|
4
|
+
base.has_many :applied_roles, :foreign_key => 'subject_id'
|
5
5
|
end
|
6
6
|
|
7
|
-
# Add a role to the
|
7
|
+
# Add a role to the subject scoped to the given resource or global if no resource given.
|
8
8
|
#
|
9
|
-
# Does nothing if a role with the given name doesn't exist, or if the
|
9
|
+
# Does nothing if a role with the given name doesn't exist, or if the subject already has
|
10
10
|
# the given role.
|
11
11
|
#
|
12
12
|
# ==== Examples
|
@@ -17,13 +17,13 @@ module Roleable::Subject
|
|
17
17
|
def add_role(role_name, resource = nil)
|
18
18
|
role = ::Role.find_by_name(role_name) or return
|
19
19
|
|
20
|
-
::
|
20
|
+
::AppliedRole.create_if_unique!(:subject_id => self.id, :role => role, :resource => resource)
|
21
21
|
end
|
22
22
|
|
23
|
-
# Check if the
|
23
|
+
# Check if the subject has the given role for the given resource, or if they have the role globally
|
24
24
|
# if no resource given.
|
25
25
|
#
|
26
|
-
# Returns <tt>true</tt> if the
|
26
|
+
# Returns <tt>true</tt> if the subject has the role, <tt>false</tt> otherwise.
|
27
27
|
#
|
28
28
|
# ==== Examples
|
29
29
|
#
|
@@ -31,12 +31,14 @@ module Roleable::Subject
|
|
31
31
|
# user.has_role?(:admin) # True if the user has a global admin role
|
32
32
|
#
|
33
33
|
def has_role?(role_name, resource = nil)
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
::AppliedRole.
|
35
|
+
with_subject(self).
|
36
|
+
with_resource(resource).
|
37
|
+
with_role_name(role_name).
|
38
|
+
exists?
|
37
39
|
end
|
38
40
|
|
39
|
-
# Remove the given role from the
|
41
|
+
# Remove the given role from the subject for the given resource, or globally if no resource given.
|
40
42
|
#
|
41
43
|
# Returns <tt>true</tt> if the role was found and deleted, <tt>false</tt> otherwise.
|
42
44
|
#
|
@@ -46,15 +48,15 @@ module Roleable::Subject
|
|
46
48
|
# user.remove_role(:admin) # Remove the global admin role from the user
|
47
49
|
#
|
48
50
|
def remove_role(role_name, resource = nil)
|
49
|
-
|
51
|
+
applied_roles = ::AppliedRole.with_subject(self).with_resource(resource).with_role_name(role_name)
|
50
52
|
|
51
|
-
deleted_count =
|
53
|
+
deleted_count = applied_roles.delete_all
|
52
54
|
|
53
55
|
deleted_count > 0
|
54
56
|
end
|
55
57
|
|
56
|
-
# Return a list of resources of the given class, for which the
|
57
|
-
# If passed an array or roles, returns resources for which the
|
58
|
+
# Return a list of resources of the given class, for which the subject has the given role.
|
59
|
+
# If passed an array or roles, returns resources for which the subject has any of the roles.
|
58
60
|
#
|
59
61
|
# ==== Examples
|
60
62
|
#
|
@@ -62,19 +64,19 @@ module Roleable::Subject
|
|
62
64
|
# user.resources_with_role([:editor, :author], Page) # => [page1, page2, ...]
|
63
65
|
#
|
64
66
|
def resources_with_role(role_name, resource_class)
|
65
|
-
|
66
|
-
resource_class.includes(:
|
67
|
+
applied_roles = ::AppliedRole.with_subject(self).with_role_name(role_name).with_resource_class(resource_class)
|
68
|
+
resource_class.includes(:applied_roles).merge(applied_roles)
|
67
69
|
end
|
68
70
|
|
69
|
-
# Return a list of roles that the
|
71
|
+
# Return a list of roles that the subject has for the given resource.
|
70
72
|
#
|
71
73
|
# ==== Examples
|
72
74
|
#
|
73
75
|
# user.roles_for_resource(page) # => [role1, role2, ...]
|
74
76
|
#
|
75
77
|
def roles_for_resource(resource)
|
76
|
-
|
77
|
-
::Role.includes(:
|
78
|
+
applied_roles = ::AppliedRole.with_subject(self).with_resource(resource)
|
79
|
+
::Role.includes(:applied_roles).merge(applied_roles)
|
78
80
|
end
|
79
81
|
|
80
82
|
end
|
data/lib/roleable/version.rb
CHANGED
@@ -4,19 +4,19 @@ describe Roleable::Resource do
|
|
4
4
|
|
5
5
|
include_context 'with models'
|
6
6
|
|
7
|
-
describe '#
|
7
|
+
describe '#subjects_with_role' do
|
8
8
|
|
9
9
|
before do
|
10
10
|
@page = Page.create
|
11
11
|
@editor_role = Role.create(:name => 'editor')
|
12
12
|
@author_role = Role.create(:name => 'author')
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
context 'with a single role' do
|
16
16
|
|
17
17
|
context 'with a role that doesnt exist' do
|
18
18
|
it 'returns an empty list' do
|
19
|
-
@page.
|
19
|
+
@page.subjects_with_role(:notarole).should be_empty
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -26,8 +26,9 @@ describe Roleable::Resource do
|
|
26
26
|
3.times { User.create.add_role(:editor, @page) }
|
27
27
|
end
|
28
28
|
|
29
|
+
|
29
30
|
it 'returns a list of the users' do
|
30
|
-
users = @page.
|
31
|
+
users = @page.subjects_with_role(:editor)
|
31
32
|
|
32
33
|
users.length.should == 3
|
33
34
|
users.first.should be_a(User)
|
@@ -36,8 +37,8 @@ describe Roleable::Resource do
|
|
36
37
|
it 'doesnt return users that dont have the role' do
|
37
38
|
other_page = Page.create
|
38
39
|
other_user = User.create.add_role(:editor, other_page)
|
39
|
-
|
40
|
-
users = @page.
|
40
|
+
|
41
|
+
users = @page.subjects_with_role(:editor)
|
41
42
|
|
42
43
|
users.length.should == 3
|
43
44
|
end
|
@@ -52,7 +53,7 @@ describe Roleable::Resource do
|
|
52
53
|
2.times { User.create.add_role(:author, @page) }
|
53
54
|
User.create
|
54
55
|
|
55
|
-
users = @page.
|
56
|
+
users = @page.subjects_with_role([:editor, :author])
|
56
57
|
|
57
58
|
users.length.should == 5
|
58
59
|
end
|
@@ -23,8 +23,8 @@ describe Roleable::Subject do
|
|
23
23
|
@result.should be_false
|
24
24
|
end
|
25
25
|
|
26
|
-
it 'doesnt create a new
|
27
|
-
|
26
|
+
it 'doesnt create a new applied_role' do
|
27
|
+
AppliedRole.count.should == 0
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -36,11 +36,11 @@ describe Roleable::Subject do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'creates a new user role' do
|
39
|
-
|
39
|
+
AppliedRole.count.should == 1
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'associates the user role with the given user' do
|
43
|
-
@user_role.
|
43
|
+
@user_role.subject.should == @user
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'associates the user role with the given role' do
|
@@ -66,7 +66,7 @@ describe Roleable::Subject do
|
|
66
66
|
|
67
67
|
context 'when the user already has the given role for the resource' do
|
68
68
|
it 'doesnt create another user role' do
|
69
|
-
expect { @user.add_role(:admin, @page) }.to_not change(
|
69
|
+
expect { @user.add_role(:admin, @page) }.to_not change(AppliedRole, :count)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -13,16 +13,16 @@ shared_context 'with models' do
|
|
13
13
|
model { extend Roleable::Role }
|
14
14
|
end
|
15
15
|
|
16
|
-
with_model :
|
16
|
+
with_model :AppliedRole do
|
17
17
|
table do |t|
|
18
|
-
t.integer :
|
18
|
+
t.integer :subject_id
|
19
19
|
t.integer :role_id
|
20
20
|
t.integer :resource_id
|
21
21
|
t.string :resource_type
|
22
22
|
|
23
23
|
t.timestamps
|
24
24
|
end
|
25
|
-
model { extend Roleable::
|
25
|
+
model { extend Roleable::AppliedRole }
|
26
26
|
end
|
27
27
|
|
28
28
|
end
|
metadata
CHANGED
@@ -1,108 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: roleable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Mitch Crowe
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
|
-
requirements:
|
25
|
-
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 25
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 9
|
31
|
-
version: "0.9"
|
32
|
-
prerelease: false
|
12
|
+
date: 2012-05-11 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
33
15
|
name: rake
|
34
|
-
|
35
|
-
type: :development
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2162720700 !ruby/object:Gem::Requirement
|
38
17
|
none: false
|
39
|
-
requirements:
|
18
|
+
requirements:
|
40
19
|
- - ~>
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 2
|
45
|
-
- 8
|
46
|
-
version: "2.8"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.9'
|
22
|
+
type: :development
|
47
23
|
prerelease: false
|
24
|
+
version_requirements: *2162720700
|
25
|
+
- !ruby/object:Gem::Dependency
|
48
26
|
name: rspec
|
49
|
-
|
50
|
-
type: :development
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &2162719820 !ruby/object:Gem::Requirement
|
53
28
|
none: false
|
54
|
-
requirements:
|
29
|
+
requirements:
|
55
30
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
- 1
|
60
|
-
- 3
|
61
|
-
version: "1.3"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.8'
|
33
|
+
type: :development
|
62
34
|
prerelease: false
|
35
|
+
version_requirements: *2162719820
|
36
|
+
- !ruby/object:Gem::Dependency
|
63
37
|
name: sqlite3
|
64
|
-
|
65
|
-
type: :development
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &2162719040 !ruby/object:Gem::Requirement
|
68
39
|
none: false
|
69
|
-
requirements:
|
40
|
+
requirements:
|
70
41
|
- - ~>
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 3
|
75
|
-
- 0
|
76
|
-
version: "3.0"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.3'
|
44
|
+
type: :development
|
77
45
|
prerelease: false
|
46
|
+
version_requirements: *2162719040
|
47
|
+
- !ruby/object:Gem::Dependency
|
78
48
|
name: activerecord
|
79
|
-
|
80
|
-
type: :development
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &2162718020 !ruby/object:Gem::Requirement
|
83
50
|
none: false
|
84
|
-
requirements:
|
51
|
+
requirements:
|
85
52
|
- - ~>
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
89
|
-
- 0
|
90
|
-
- 2
|
91
|
-
version: "0.2"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
type: :development
|
92
56
|
prerelease: false
|
57
|
+
version_requirements: *2162718020
|
58
|
+
- !ruby/object:Gem::Dependency
|
93
59
|
name: with_model
|
94
|
-
|
60
|
+
requirement: &2162717140 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.2'
|
95
66
|
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2162717140
|
96
69
|
description: Roles solution for active-record-backed Rails 3 applications
|
97
|
-
email:
|
70
|
+
email:
|
98
71
|
- crowe.mitch@gmail.com
|
99
72
|
executables: []
|
100
|
-
|
101
73
|
extensions: []
|
102
|
-
|
103
74
|
extra_rdoc_files: []
|
104
|
-
|
105
|
-
files:
|
75
|
+
files:
|
106
76
|
- .gitignore
|
107
77
|
- .rspec
|
108
78
|
- .travis.yml
|
@@ -113,55 +83,53 @@ files:
|
|
113
83
|
- Rakefile
|
114
84
|
- lib/generators/roleable/install/USAGE
|
115
85
|
- lib/generators/roleable/install/install_generator.rb
|
86
|
+
- lib/generators/roleable/install/templates/applied_role.rb
|
87
|
+
- lib/generators/roleable/install/templates/initializer.rb
|
116
88
|
- lib/generators/roleable/install/templates/migration.rb
|
117
89
|
- lib/generators/roleable/install/templates/role.rb
|
118
|
-
- lib/generators/roleable/install/templates/user_role.rb
|
119
90
|
- lib/roleable.rb
|
91
|
+
- lib/roleable/applied_role.rb
|
92
|
+
- lib/roleable/configuration.rb
|
120
93
|
- lib/roleable/resource.rb
|
121
94
|
- lib/roleable/role.rb
|
122
95
|
- lib/roleable/subject.rb
|
123
|
-
- lib/roleable/user_role.rb
|
124
96
|
- lib/roleable/version.rb
|
125
97
|
- roleable.gemspec
|
126
98
|
- spec/roleable/resource_spec.rb
|
127
99
|
- spec/roleable/subject_spec.rb
|
128
100
|
- spec/spec_helper.rb
|
129
101
|
- spec/support/shared_contexts.rb
|
130
|
-
has_rdoc: true
|
131
102
|
homepage: https://github.com/mcrowe/roleable
|
132
103
|
licenses: []
|
133
|
-
|
134
104
|
post_install_message:
|
135
105
|
rdoc_options: []
|
136
|
-
|
137
|
-
require_paths:
|
106
|
+
require_paths:
|
138
107
|
- lib
|
139
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
109
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
|
145
|
-
segments:
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
segments:
|
146
115
|
- 0
|
147
|
-
|
148
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
hash: 3443296545749404592
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
118
|
none: false
|
150
|
-
requirements:
|
151
|
-
- -
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
|
154
|
-
segments:
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
segments:
|
155
124
|
- 0
|
156
|
-
|
125
|
+
hash: 3443296545749404592
|
157
126
|
requirements: []
|
158
|
-
|
159
127
|
rubyforge_project:
|
160
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.8.10
|
161
129
|
signing_key:
|
162
130
|
specification_version: 3
|
163
131
|
summary: Roles solution for active-record-backed Rails 3 applications
|
164
|
-
test_files:
|
132
|
+
test_files:
|
165
133
|
- spec/roleable/resource_spec.rb
|
166
134
|
- spec/roleable/subject_spec.rb
|
167
135
|
- spec/spec_helper.rb
|