classy_cancan 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.drone.yml +4 -0
- data/.ruby-version +1 -1
- data/.travis.yml +5 -0
- data/Gemfile.lock +17 -13
- data/README.md +7 -3
- data/Rakefile +6 -3
- data/classy_cancan.gemspec +3 -1
- data/lib/classy_cancan/base_ability.rb +5 -0
- data/lib/classy_cancan/version.rb +1 -1
- data/spec/lib/classy_cancan/base_ability_spec.rb +2 -2
- metadata +34 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 593cb37e0b99e27dc5b4c36b9b7ff0b399921f6c
|
4
|
+
data.tar.gz: f380ef580ced13017e869e60d4bf2255b6826fea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 552f3825e30f33cbb831537cb6ef8f8ad4509d286e01d7f96da3520cef83eefdb94ac3d2f58f647edb0b6fe4faf688d7754d644f7171592fef01ba9d6bd00d2a
|
7
|
+
data.tar.gz: c3232f6932618a1ac34ce1065090d0af35dcafb2ed7a3c6b07c29d502ed0c9c860d3f5b2b94950de7190e8ffaa910e453cbe120d56d17da206078824399d7073
|
data/.drone.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.4
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
classy_cancan (0.0.
|
4
|
+
classy_cancan (0.0.3)
|
5
5
|
cancancan
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
cancancan (1.
|
10
|
+
cancancan (1.10.1)
|
11
11
|
diff-lcs (1.2.5)
|
12
|
-
|
13
|
-
|
14
|
-
rspec-
|
15
|
-
rspec-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
rake (10.4.2)
|
13
|
+
rspec (3.2.0)
|
14
|
+
rspec-core (~> 3.2.0)
|
15
|
+
rspec-expectations (~> 3.2.0)
|
16
|
+
rspec-mocks (~> 3.2.0)
|
17
|
+
rspec-core (3.2.0)
|
18
|
+
rspec-support (~> 3.2.0)
|
19
|
+
rspec-expectations (3.2.0)
|
19
20
|
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-mocks (3.
|
22
|
-
|
23
|
-
|
21
|
+
rspec-support (~> 3.2.0)
|
22
|
+
rspec-mocks (3.2.0)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.2.0)
|
25
|
+
rspec-support (3.2.0)
|
24
26
|
|
25
27
|
PLATFORMS
|
26
28
|
ruby
|
27
29
|
|
28
30
|
DEPENDENCIES
|
31
|
+
bundler
|
29
32
|
classy_cancan!
|
33
|
+
rake
|
30
34
|
rspec
|
data/README.md
CHANGED
@@ -5,17 +5,21 @@
|
|
5
5
|
When using Cancan/can, a `Ability` class in a larger Ruby on Rails application can grow quite quickly.
|
6
6
|
This gem lets you seperate model specific ability definitions into their own class.
|
7
7
|
|
8
|
+
This is a first approach to solve this. Pull Requests to make things easier to use are very much appreciated.
|
9
|
+
|
8
10
|
## Installation
|
9
11
|
|
10
|
-
Add the following
|
12
|
+
Add the following lines to your `Gemfile`:
|
11
13
|
|
12
14
|
```ruby
|
15
|
+
gem 'cancancan'
|
13
16
|
gem 'classy_cancan'
|
14
17
|
```
|
15
18
|
|
16
19
|
Now run `bundle install`.
|
17
20
|
|
18
|
-
**Note**: This gem
|
21
|
+
**Note**: This gem should work with both [cancan](https://github.com/ryanb/cancan) and
|
22
|
+
[cancancan](https://github.com/CanCanCommunity/cancancan).
|
19
23
|
|
20
24
|
## Usage
|
21
25
|
|
@@ -27,7 +31,7 @@ class Ability
|
|
27
31
|
include CanCan::Ability
|
28
32
|
|
29
33
|
def initialize(user)
|
30
|
-
ContactAbility.
|
34
|
+
ContactAbility.setup(self, user)
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
data/Rakefile
CHANGED
@@ -5,6 +5,7 @@ rescue LoadError
|
|
5
5
|
end
|
6
6
|
|
7
7
|
require 'rdoc/task'
|
8
|
+
require 'rspec/core/rake_task'
|
8
9
|
|
9
10
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
11
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -14,8 +15,10 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
15
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
18
|
Bundler::GemHelper.install_tasks
|
21
19
|
|
20
|
+
desc 'Run RSpec'
|
21
|
+
RSpec::Core::RakeTask.new do |t|
|
22
|
+
t.verbose = false
|
23
|
+
end
|
24
|
+
task default: :spec
|
data/classy_cancan.gemspec
CHANGED
@@ -7,7 +7,7 @@ require 'classy_cancan/version'
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'classy_cancan'
|
9
9
|
s.version = ClassyCancan::VERSION
|
10
|
-
s.authors = ['Philippe
|
10
|
+
s.authors = ['Philippe Haessig']
|
11
11
|
s.email = ['phil@neckhair.ch']
|
12
12
|
s.homepage = 'http://github.com/neckhair/classy_cancan'
|
13
13
|
s.summary = 'Classify your cancancan abilities'
|
@@ -18,5 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency 'cancancan'
|
20
20
|
|
21
|
+
s.add_development_dependency 'bundler'
|
22
|
+
s.add_development_dependency 'rake'
|
21
23
|
s.add_development_dependency 'rspec'
|
22
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ClassyCancan::BaseAbility do
|
3
|
+
RSpec.describe ClassyCancan::BaseAbility do
|
4
4
|
class Contact
|
5
5
|
end
|
6
6
|
|
@@ -15,7 +15,7 @@ describe ClassyCancan::BaseAbility do
|
|
15
15
|
include CanCan::Ability
|
16
16
|
|
17
17
|
def initialize(user)
|
18
|
-
ContactAbility.
|
18
|
+
ContactAbility.setup(self, user)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classy_cancan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Philippe
|
7
|
+
- Philippe Haessig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cancancan
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rspec
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,10 +73,12 @@ executables: []
|
|
45
73
|
extensions: []
|
46
74
|
extra_rdoc_files: []
|
47
75
|
files:
|
76
|
+
- ".drone.yml"
|
48
77
|
- ".gitignore"
|
49
78
|
- ".rspec"
|
50
79
|
- ".ruby-gemset"
|
51
80
|
- ".ruby-version"
|
81
|
+
- ".travis.yml"
|
52
82
|
- Gemfile
|
53
83
|
- Gemfile.lock
|
54
84
|
- MIT-LICENSE
|
@@ -80,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
110
|
version: '0'
|
81
111
|
requirements: []
|
82
112
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.4.2
|
84
114
|
signing_key:
|
85
115
|
specification_version: 4
|
86
116
|
summary: Classify your cancancan abilities
|