canard 0.3.7 → 0.4.0.pre
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/.travis.yml +9 -0
- data/Gemfile +6 -0
- data/TODO +0 -4
- data/canard.gemspec +1 -2
- data/lib/ability.rb +16 -10
- data/lib/canard/find_abilities.rb +1 -25
- data/lib/canard/railtie.rb +6 -3
- data/lib/canard/version.rb +1 -1
- data/lib/tasks/canard.rake +23 -0
- data/test/abilities/administrators.rb +5 -0
- data/test/canard/ability_test.rb +50 -34
- data/test/canard/canard_test.rb +5 -14
- data/test/canard/find_abilities_test.rb +22 -29
- metadata +72 -109
- data/test/abilities/admins.rb +0 -5
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -6,3 +6,9 @@ gemspec
|
|
6
6
|
group :test do
|
7
7
|
gem 'rake'
|
8
8
|
end
|
9
|
+
|
10
|
+
# for CRuby, Rubinius, including Windows and RubyInstaller
|
11
|
+
gem "sqlite3", :platform => [:ruby, :mswin, :mingw], :group => [:development, :test]
|
12
|
+
|
13
|
+
# for JRuby
|
14
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => [:jruby], :group => [:development, :test]
|
data/TODO
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
0.4.0
|
2
|
-
* Make framework agnostic.
|
3
2
|
* Split the test suite so Rails is only required for Rails integration. http://blog.railsware.com/2012/01/07/testing-gem-integration-with-multiple-ruby-frameworks/
|
4
3
|
* Test the railtie (currently implicity tested in dummy app).
|
5
|
-
* Add upgrade generator to move the now deprecated definitions to the new syntax.
|
6
|
-
* Remove old definition syntax and therefore deprecations.
|
7
|
-
* Remove ActiveSupport runtime dependency (which is just used for deprecation warnings).
|
8
4
|
0.5.0
|
9
5
|
* Expand the generated tests to produce all the standard abilities: index,show,read,new,create,edit,update,destroy.
|
10
6
|
* Test the generators.
|
data/canard.gemspec
CHANGED
@@ -5,6 +5,7 @@ require "canard/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "canard"
|
7
7
|
s.version = Canard::VERSION
|
8
|
+
s.date = `git log -1 --format="%cd" --date=short lib/canard/version.rb`
|
8
9
|
s.authors = ["James McCarthy"]
|
9
10
|
s.email = ["james2mccarthy@gmail.com"]
|
10
11
|
s.homepage = "https://github.com/james2m/canard"
|
@@ -19,9 +20,7 @@ Gem::Specification.new do |s|
|
|
19
20
|
s.require_paths = ["lib"]
|
20
21
|
|
21
22
|
s.add_development_dependency "minitest", "~> 2"
|
22
|
-
s.add_development_dependency "sqlite3"
|
23
23
|
s.add_development_dependency "rails", "~> 3.2.3"
|
24
|
-
s.add_runtime_dependency 'activesupport'
|
25
24
|
s.add_runtime_dependency "cancan"
|
26
25
|
s.add_runtime_dependency "role_model"
|
27
26
|
end
|
data/lib/ability.rb
CHANGED
@@ -30,34 +30,40 @@ class Ability
|
|
30
30
|
attr_reader :user
|
31
31
|
|
32
32
|
def initialize(object=nil)
|
33
|
-
|
33
|
+
|
34
34
|
# If object has a user attribute set the user from it otherwise assume
|
35
35
|
# this is the user.
|
36
36
|
@user = object.respond_to?(:user) ? object.user : object
|
37
|
-
|
37
|
+
|
38
38
|
if @user
|
39
39
|
# Add the base user abilities.
|
40
|
-
user_class_name = @user.class.name
|
41
|
-
append_abilities user_class_name
|
40
|
+
user_class_name = String(@user.class.name)
|
41
|
+
append_abilities ability_key(user_class_name) unless user_class_name.empty?
|
42
42
|
else
|
43
43
|
# If user not set then lets create a guest
|
44
44
|
@user = Object.new
|
45
45
|
append_abilities :guest
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
# If user has roles get those abilities
|
49
49
|
if @user.respond_to?(:roles)
|
50
50
|
# Add roles on top of the base user abilities
|
51
51
|
@user.roles.each { |role| append_abilities(role) }
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
private
|
57
|
-
|
58
|
-
def append_abilities(
|
57
|
+
|
58
|
+
def append_abilities(key)
|
59
59
|
ability_definitions = Canard.ability_definitions
|
60
|
-
instance_eval(&ability_definitions[
|
60
|
+
instance_eval(&ability_definitions[key]) if ability_definitions.has_key?(key)
|
61
|
+
end
|
62
|
+
|
63
|
+
def ability_key(class_name)
|
64
|
+
class_name.gsub!('::', '')
|
65
|
+
class_name.gsub!(/(.)([A-Z])/,'\1_\2')
|
66
|
+
class_name.downcase!.to_sym
|
61
67
|
end
|
62
68
|
|
63
69
|
end
|
@@ -1,40 +1,16 @@
|
|
1
1
|
module Canard
|
2
2
|
|
3
3
|
class << self
|
4
|
-
# A string specifying the location that should be searched for ability
|
5
|
-
# definitions. By default, Canard will attempt to load abilities from
|
6
|
-
# Rails.root + /abilities/.
|
7
|
-
attr_writer :abilities_path
|
8
|
-
|
9
|
-
def abilities_path
|
10
|
-
@abilities_path ||= 'abilities'
|
11
|
-
end
|
12
|
-
|
13
4
|
def ability_definitions
|
14
5
|
Abilities.definitions
|
15
6
|
end
|
16
|
-
|
17
|
-
def abilities_for(role, &block)
|
18
|
-
::ActiveSupport::Deprecation.warn("abilities_for is deprecated and will be removed from Canard 0.4.0. Use Canard::Abilities.for and move the definitions to app/abilities.")
|
19
|
-
ability_definitions[role] = block
|
20
|
-
end
|
21
|
-
|
22
7
|
end
|
23
8
|
|
24
9
|
def self.load_paths
|
25
10
|
Abilities.definition_paths.map { |path| File.expand_path(path) }
|
26
11
|
end
|
27
12
|
|
28
|
-
# TODO remove at version 0.4.0
|
29
13
|
def self.find_abilities #:nodoc:
|
30
|
-
absolute_abilities_path = File.expand_path(abilities_path)
|
31
|
-
|
32
|
-
if File.directory? absolute_abilities_path
|
33
|
-
Dir[File.join(absolute_abilities_path, '**', '*.rb')].sort.each do |file|
|
34
|
-
self.class_eval File.read(file)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
14
|
load_paths.each do |path|
|
39
15
|
Dir[File.join(path, '**', '*.rb')].sort.each do |file|
|
40
16
|
load file
|
@@ -42,5 +18,5 @@ module Canard
|
|
42
18
|
end
|
43
19
|
|
44
20
|
end
|
45
|
-
|
21
|
+
|
46
22
|
end
|
data/lib/canard/railtie.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rails'
|
|
3
3
|
|
4
4
|
module Canard
|
5
5
|
class Railtie < Rails::Railtie
|
6
|
-
|
6
|
+
|
7
7
|
initializer "carard.no_eager_loading", :before => 'before_eager_loading' do |app|
|
8
8
|
ActiveSupport::Dependencies.autoload_paths.reject!{ |path| Canard.load_paths.include?(path) }
|
9
9
|
# Don't eagerload our configs, we'll deal with them ourselves
|
@@ -19,7 +19,7 @@ module Canard
|
|
19
19
|
Canard.find_abilities
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
initializer "canard.abilities_reloading", :after => "action_dispatch.configure" do |app|
|
24
24
|
if ActionDispatch::Reloader.respond_to?(:to_prepare)
|
25
25
|
ActionDispatch::Reloader.to_prepare { Canard.find_abilities }
|
@@ -27,6 +27,9 @@ module Canard
|
|
27
27
|
ActionDispatch::Reloader.before { Canard.find_abilities }
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
|
+
rake_tasks do
|
32
|
+
load File.expand_path('../../tasks/canard.rake', __FILE__)
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
data/lib/canard/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
namespace :canard do
|
2
|
+
desc 'Upgrades deprecated ability definition syntax and moves the files from abilities to app/abilities'
|
3
|
+
task :upgrade => :environment do
|
4
|
+
require 'rake/clean'
|
5
|
+
source_path = 'abilities'
|
6
|
+
destination_path = Canard::Abilities.definition_paths.first
|
7
|
+
|
8
|
+
Dir.mkdir(destination_path) unless Dir.exists?(destination_path)
|
9
|
+
|
10
|
+
if Dir.exists?(source_path)
|
11
|
+
Dir[File.join(source_path, '*.rb')].each do |input_file|
|
12
|
+
input = File.read(input_file)
|
13
|
+
output = input.gsub(/abilities_for/, 'Canard::Abilities.for')
|
14
|
+
output_file = File.expand_path(File.basename(input_file), destination_path)
|
15
|
+
File.write(output_file, output)
|
16
|
+
File.delete(input_file)
|
17
|
+
end
|
18
|
+
Dir.delete(source_path)
|
19
|
+
else
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/test/canard/ability_test.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Ability do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
Canard::Abilities.default_path = File.expand_path('../../dummy/app/abilities', __FILE__)
|
7
7
|
# reload abilities because the reloader will have removed them after the railtie ran
|
8
8
|
Canard.find_abilities
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
describe "new" do
|
12
|
-
|
12
|
+
|
13
13
|
describe "with a user" do
|
14
|
-
|
14
|
+
|
15
15
|
let(:user) { User.new }
|
16
16
|
subject { Ability.new(user) }
|
17
|
-
|
17
|
+
|
18
18
|
it "assign the user to Ability#user" do
|
19
19
|
subject.user.must_equal user
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
describe "with a model that references a user" do
|
25
|
-
|
25
|
+
|
26
26
|
let(:user) { User.create }
|
27
27
|
let(:member) { Member.new(:user => user) }
|
28
|
-
|
28
|
+
|
29
29
|
subject { Ability.new(member) }
|
30
|
-
|
30
|
+
|
31
31
|
it "assign the user to Ability#user" do
|
32
32
|
subject.user.must_equal user
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
describe "with a user that has author role" do
|
38
|
-
|
38
|
+
|
39
39
|
let(:user) { User.create(:roles => [:author]) }
|
40
40
|
let(:member) { Member.create(:user => user) }
|
41
41
|
let(:other_member) { Member.new(:user => User.create) }
|
42
42
|
subject { Ability.new(user) }
|
43
|
-
|
43
|
+
|
44
44
|
it "has all the abilities of the base class" do
|
45
45
|
subject.can?(:edit, member).must_equal true
|
46
46
|
subject.can?(:update, member).must_equal true
|
@@ -48,7 +48,7 @@ describe Ability do
|
|
48
48
|
subject.can?(:edit, other_member).wont_equal true
|
49
49
|
subject.can?(:update, other_member).wont_equal true
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it "has all the abilities of an author" do
|
53
53
|
subject.can?(:new, Post).must_equal true
|
54
54
|
subject.can?(:create, Post).must_equal true
|
@@ -57,21 +57,21 @@ describe Ability do
|
|
57
57
|
subject.can?(:show, Post).must_equal true
|
58
58
|
subject.can?(:index, Post).must_equal true
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it "has no admin abilities" do
|
62
62
|
subject.cannot?(:destroy, Post).must_equal true
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "with a user that has admin and author roles" do
|
68
|
-
|
68
|
+
|
69
69
|
let(:user) { User.create(:roles => [:author, :admin]) }
|
70
70
|
let(:member) { Member.create(:user => user) }
|
71
71
|
let(:other_user) { User.create }
|
72
72
|
let(:other_member) { Member.new(:user => other_user) }
|
73
73
|
subject { Ability.new(user) }
|
74
|
-
|
74
|
+
|
75
75
|
it "has all the abilities of the base class" do
|
76
76
|
subject.can?(:edit, member).must_equal true
|
77
77
|
subject.can?(:update, member).must_equal true
|
@@ -79,39 +79,39 @@ describe Ability do
|
|
79
79
|
subject.cannot?(:edit, other_member).must_equal true
|
80
80
|
subject.cannot?(:update, other_member).must_equal true
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
it "has all the abilities of an author" do
|
84
84
|
subject.can?(:new, Post).must_equal true
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
it "has the abilities of an admin" do
|
88
88
|
subject.can?(:manage, Post).must_equal true
|
89
89
|
subject.can?(:manage, other_user).must_equal true
|
90
90
|
subject.can?(:destroy, other_user).must_equal true
|
91
91
|
subject.cannot?(:destroy, user).must_equal true
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
describe "with no user" do
|
97
|
-
|
97
|
+
|
98
98
|
subject { Ability.new }
|
99
|
-
|
99
|
+
|
100
100
|
it "applies the guest abilities" do
|
101
101
|
subject.can?(:index, Post)
|
102
102
|
subject.can?(:show, Post)
|
103
|
-
|
103
|
+
|
104
104
|
subject.cannot?(:create, Post)
|
105
105
|
subject.cannot?(:update, Post)
|
106
106
|
subject.cannot?(:destroy, Post)
|
107
|
-
|
107
|
+
|
108
108
|
subject.cannot?(:show, User)
|
109
109
|
subject.cannot?(:show, Member)
|
110
110
|
end
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
describe "with an instance of an anonymous class that has author role" do
|
114
|
-
|
114
|
+
|
115
115
|
let(:klass) do
|
116
116
|
Class.new do
|
117
117
|
extend Canard::UserModel
|
@@ -123,16 +123,16 @@ describe Ability do
|
|
123
123
|
let(:instance) { klass.new(:author) }
|
124
124
|
|
125
125
|
describe "for base class abilities" do
|
126
|
-
|
126
|
+
|
127
127
|
it "does nothing" do
|
128
128
|
proc { Ability.new(instance) }.must_be_silent
|
129
129
|
end
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
describe "for assigned roles" do
|
133
|
-
|
133
|
+
|
134
134
|
subject { Ability.new(instance) }
|
135
|
-
|
135
|
+
|
136
136
|
it "has all the abilities of an author" do
|
137
137
|
subject.can?(:new, Post).must_equal true
|
138
138
|
subject.can?(:create, Post).must_equal true
|
@@ -141,13 +141,29 @@ describe Ability do
|
|
141
141
|
subject.can?(:show, Post).must_equal true
|
142
142
|
subject.can?(:index, Post).must_equal true
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
it "has no admin abilities" do
|
146
146
|
subject.cannot?(:destroy, Post).must_equal true
|
147
147
|
end
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "ability_key" do
|
154
|
+
|
155
|
+
it "returns a snake case version of the string" do
|
156
|
+
class_name = 'CamelCaseString'
|
157
|
+
key = :camel_case_string
|
158
|
+
|
159
|
+
Ability.new.send(:ability_key, class_name).must_equal key
|
160
|
+
end
|
161
|
+
|
162
|
+
it "prepends namespaces to the class name" do
|
163
|
+
class_name = 'Namespace::CamelCaseString'
|
164
|
+
key = :namespace_camel_case_string
|
165
|
+
|
166
|
+
Ability.new.send(:ability_key, class_name).must_equal key
|
150
167
|
end
|
151
168
|
end
|
152
|
-
|
153
169
|
end
|
data/test/canard/canard_test.rb
CHANGED
@@ -2,26 +2,17 @@ require 'test_helper'
|
|
2
2
|
require 'canard'
|
3
3
|
|
4
4
|
describe Canard do
|
5
|
-
|
6
|
-
describe "abilities_path" do
|
7
|
-
|
8
|
-
it "should be mutable" do
|
9
|
-
Canard.abilities_path = 'app/abilities'
|
10
|
-
Canard.abilities_path.must_equal 'app/abilities'
|
11
|
-
end
|
12
5
|
|
13
|
-
end
|
14
|
-
|
15
6
|
describe "ability_definitions" do
|
16
|
-
|
7
|
+
|
17
8
|
it "should be an accessor" do
|
18
9
|
Canard.must_respond_to(:ability_definitions)
|
19
10
|
end
|
20
|
-
|
11
|
+
|
21
12
|
it "should be a hash" do
|
22
13
|
Canard.ability_definitions.must_be_instance_of Hash
|
23
14
|
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
15
|
+
|
16
|
+
end
|
17
|
+
|
27
18
|
end
|
@@ -1,50 +1,43 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'active_support/testing/deprecation'
|
3
2
|
|
4
3
|
describe Canard do
|
5
|
-
|
6
|
-
include ActiveSupport::Testing::Deprecation
|
7
|
-
|
8
|
-
before do
|
9
|
-
# Stop the deprecation warnings coming to stderr for these tests.
|
10
|
-
ActiveSupport::Deprecation.behavior = :notify
|
11
|
-
|
12
|
-
Canard::Abilities.default_path = File.expand_path('../../dummy/app/abilities', __FILE__)
|
13
|
-
Canard.abilities_path = File.expand_path('../abilities', __FILE__)
|
14
|
-
end
|
15
|
-
|
4
|
+
|
16
5
|
describe "find_abilities" do
|
17
|
-
|
6
|
+
|
7
|
+
before do
|
8
|
+
Canard::Abilities.default_path = File.expand_path('../../dummy/app/abilities', __FILE__)
|
9
|
+
end
|
10
|
+
|
18
11
|
it "loads the abilities into ability_definitions" do
|
19
12
|
Canard.find_abilities
|
20
13
|
|
21
14
|
Canard.ability_definitions.keys.must_include :admin
|
22
15
|
end
|
23
|
-
|
24
|
-
it "finds
|
16
|
+
|
17
|
+
it "finds abilities in the default path" do
|
18
|
+
Canard.find_abilities
|
19
|
+
|
20
|
+
Canard.ability_definitions.keys.must_include :author
|
21
|
+
Canard.ability_definitions.keys.wont_include :administrator
|
22
|
+
end
|
23
|
+
|
24
|
+
it "finds abilities in additional paths" do
|
25
|
+
Canard::Abilities.definition_paths << File.expand_path('../../abilities', __FILE__)
|
25
26
|
Canard.find_abilities
|
26
|
-
|
27
|
+
|
27
28
|
Canard.ability_definitions.keys.must_include :author
|
29
|
+
Canard.ability_definitions.keys.must_include :administrator
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
it "reloads existing abilities" do
|
31
33
|
Canard.find_abilities
|
32
34
|
Canard::Abilities.send(:instance_variable_set, '@definitions', {})
|
33
35
|
Canard.find_abilities
|
34
|
-
|
36
|
+
|
35
37
|
Canard.ability_definitions.keys.must_include :author
|
36
38
|
Canard.ability_definitions.keys.must_include :admin
|
37
39
|
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "abilities_for" do
|
42
|
-
|
43
|
-
it "raises a deprecation warning" do
|
44
|
-
assert_deprecated do
|
45
|
-
Canard.abilities_for(:this) { return 'that' }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
40
|
+
|
49
41
|
end
|
42
|
+
|
50
43
|
end
|
metadata
CHANGED
@@ -1,119 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: canard
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 7
|
10
|
-
version: 0.3.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0.pre
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- James McCarthy
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-08-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: minitest
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
version: "2"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2'
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: sqlite3
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
25
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
|
-
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
49
31
|
name: rails
|
50
|
-
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
52
33
|
none: false
|
53
|
-
requirements:
|
34
|
+
requirements:
|
54
35
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
hash: 9
|
57
|
-
segments:
|
58
|
-
- 3
|
59
|
-
- 2
|
60
|
-
- 3
|
36
|
+
- !ruby/object:Gem::Version
|
61
37
|
version: 3.2.3
|
62
38
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: activesupport
|
66
39
|
prerelease: false
|
67
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
41
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
type: :runtime
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.2.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
79
47
|
name: cancan
|
80
|
-
|
81
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
82
49
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
90
54
|
type: :runtime
|
91
|
-
version_requirements: *id005
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: role_model
|
94
55
|
prerelease: false
|
95
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: role_model
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
96
65
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
104
70
|
type: :runtime
|
105
|
-
|
106
|
-
|
107
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Wraps CanCan and RoleModel up to make role based authorisation really
|
79
|
+
easy in Rails 3.x.
|
80
|
+
email:
|
108
81
|
- james2mccarthy@gmail.com
|
109
82
|
executables: []
|
110
|
-
|
111
83
|
extensions: []
|
112
|
-
|
113
84
|
extra_rdoc_files: []
|
114
|
-
|
115
|
-
files:
|
85
|
+
files:
|
116
86
|
- .gitignore
|
87
|
+
- .travis.yml
|
117
88
|
- Gemfile
|
118
89
|
- MIT-LICENSE
|
119
90
|
- README.rdoc
|
@@ -134,7 +105,8 @@ files:
|
|
134
105
|
- lib/generators/canard/ability/templates/abilities.rb.erb
|
135
106
|
- lib/generators/rspec/ability/ability_generator.rb
|
136
107
|
- lib/generators/rspec/ability/templates/abilities_spec.rb.erb
|
137
|
-
-
|
108
|
+
- lib/tasks/canard.rake
|
109
|
+
- test/abilities/administrators.rb
|
138
110
|
- test/canard/abilities_test.rb
|
139
111
|
- test/canard/ability_test.rb
|
140
112
|
- test/canard/adapters/active_record_test.rb
|
@@ -175,39 +147,30 @@ files:
|
|
175
147
|
- test/test_helper.rb
|
176
148
|
homepage: https://github.com/james2m/canard
|
177
149
|
licenses: []
|
178
|
-
|
179
150
|
post_install_message:
|
180
151
|
rdoc_options: []
|
181
|
-
|
182
|
-
require_paths:
|
152
|
+
require_paths:
|
183
153
|
- lib
|
184
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
155
|
none: false
|
186
|
-
requirements:
|
187
|
-
- -
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
|
190
|
-
|
191
|
-
- 0
|
192
|
-
version: "0"
|
193
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
161
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
|
199
|
-
segments:
|
200
|
-
- 0
|
201
|
-
version: "0"
|
162
|
+
requirements:
|
163
|
+
- - ! '>'
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 1.3.1
|
202
166
|
requirements: []
|
203
|
-
|
204
167
|
rubyforge_project: canard
|
205
168
|
rubygems_version: 1.8.24
|
206
169
|
signing_key:
|
207
170
|
specification_version: 3
|
208
171
|
summary: Adds role based authorisation to Rails by combining RoleModel and CanCan.
|
209
|
-
test_files:
|
210
|
-
- test/abilities/
|
172
|
+
test_files:
|
173
|
+
- test/abilities/administrators.rb
|
211
174
|
- test/canard/abilities_test.rb
|
212
175
|
- test/canard/ability_test.rb
|
213
176
|
- test/canard/adapters/active_record_test.rb
|