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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffb4ead8e780e0e1d16f40efd92e2235b73d3695
4
- data.tar.gz: 9efaf76e48ddb67ccd0e41f154f6de3676b99571
3
+ metadata.gz: 593cb37e0b99e27dc5b4c36b9b7ff0b399921f6c
4
+ data.tar.gz: f380ef580ced13017e869e60d4bf2255b6826fea
5
5
  SHA512:
6
- metadata.gz: 5e64331fe1718035e3ab506539f53a35407b9924b0186336637bf5d04b8a7f89072254e0351df94c726863a5a3fa36c70ce2d856b06ac6d423d42513fa4074ab
7
- data.tar.gz: 8599858c0c66ff8bf3d4124a4bd6a51662756834d1e55a119cbc8922781238ccb5ec70b7a0d96e22ebd40a7aec0758114aa3296ee5346e2eaeee194e70afd885
6
+ metadata.gz: 552f3825e30f33cbb831537cb6ef8f8ad4509d286e01d7f96da3520cef83eefdb94ac3d2f58f647edb0b6fe4faf688d7754d644f7171592fef01ba9d6bd00d2a
7
+ data.tar.gz: c3232f6932618a1ac34ce1065090d0af35dcafb2ed7a3c6b07c29d502ed0c9c860d3f5b2b94950de7190e8ffaa910e453cbe120d56d17da206078824399d7073
@@ -0,0 +1,4 @@
1
+ image: ruby:2.1.4
2
+ script:
3
+ - bundle install
4
+ - rake
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.1.4
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
@@ -1,30 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- classy_cancan (0.0.1)
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.9.2)
10
+ cancancan (1.10.1)
11
11
  diff-lcs (1.2.5)
12
- rspec (3.1.0)
13
- rspec-core (~> 3.1.0)
14
- rspec-expectations (~> 3.1.0)
15
- rspec-mocks (~> 3.1.0)
16
- rspec-core (3.1.5)
17
- rspec-support (~> 3.1.0)
18
- rspec-expectations (3.1.2)
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.1.0)
21
- rspec-mocks (3.1.2)
22
- rspec-support (~> 3.1.0)
23
- rspec-support (3.1.1)
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 line to your `Gemfile`:
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 is useless without `cancan` or `cancancan`.
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.new(self, user).setup
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
@@ -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 Hässig']
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
@@ -11,7 +11,12 @@ module ClassyCancan
11
11
  @user = user
12
12
  end
13
13
 
14
+ def self.setup(ability, user)
15
+ new(ability, user).setup
16
+ end
17
+
14
18
  def setup
19
+ fail 'You have to define a setup method in your ClassyCancan Ability class.'
15
20
  end
16
21
  end
17
22
  end
@@ -1,3 +1,3 @@
1
1
  module ClassyCancan
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  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.new(self, user).setup
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.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - Philippe Hässig
7
+ - Philippe Haessig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-09 00:00:00.000000000 Z
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.2.2
113
+ rubygems_version: 2.4.2
84
114
  signing_key:
85
115
  specification_version: 4
86
116
  summary: Classify your cancancan abilities