zobi 4.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +170 -0
- data/app/decorators/zobi/collection_decorator.rb +7 -0
- data/app/decorators/zobi/resource_decorator.rb +7 -0
- data/lib/zobi.rb +45 -0
- data/lib/zobi/controlled_access.rb +77 -0
- data/lib/zobi/decorated.rb +32 -0
- data/lib/zobi/discover.rb +70 -0
- data/lib/zobi/engine.rb +6 -0
- data/lib/zobi/included.rb +20 -0
- data/lib/zobi/inherited.rb +42 -0
- data/lib/zobi/paginated.rb +24 -0
- data/lib/zobi/parameters_sanitizer.rb +71 -0
- data/lib/zobi/responders/pagination_responder.rb +25 -0
- data/lib/zobi/scoped.rb +32 -0
- data/lib/zobi/version.rb +4 -0
- metadata +283 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 69518a2db256e0b503887391e17de15b8007cb16
|
4
|
+
data.tar.gz: b13497e78105e33a61f8d083736ac2e023633a91
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f99d0a53a9257f453ef2cfc1c3ee6a3f0b288710ffdae88f53352392b1ad532b9108dce9e929d2183f4277fbeb889165bdaf73931a6b2797e95d7dbf1d730d7c
|
7
|
+
data.tar.gz: 9fab74b46acb53cad0cb57d861b9e50cd327435e8036c42342d17530ffed9ff3630b246341d2c083183deef9504fcbc85f8c507aab81a26aaf530a96fdad0519
|
data/README.md
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
Zobi
|
2
|
+
====
|
3
|
+
|
4
|
+
Zobi helps you to orchestrate your controller behaviors using the following gems :
|
5
|
+
|
6
|
+
- [**devise**](https://github.com/plataformatec/devise)
|
7
|
+
- [**inherited_resources**](https://github.com/josevalim/inherited_resources)
|
8
|
+
- [**has_scope**](https://github.com/plataformatec/has_scope)
|
9
|
+
- [**kaminari**](https://github.com/amatsuda/kaminari)
|
10
|
+
- [**pundit**](https://github.com/elabs/pundit)
|
11
|
+
- [**draper**](https://github.com/drapergem/draper)
|
12
|
+
|
13
|
+
How to use it?
|
14
|
+
--------------
|
15
|
+
|
16
|
+
Add it in your `Gemfile` and run `bundle install`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'zobi', '~> 4.0.0.rc2'
|
20
|
+
```
|
21
|
+
|
22
|
+
Next, include Zobi module in your controller and set modules you want to
|
23
|
+
include :
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
extend Zobi
|
27
|
+
behaviors :inherited, :scoped, :included, :paginated, :controlled_access, :decorated
|
28
|
+
```
|
29
|
+
|
30
|
+
Available modules
|
31
|
+
-----------------
|
32
|
+
|
33
|
+
### Inherited
|
34
|
+
|
35
|
+
This module uses
|
36
|
+
[inherited_resources](https://github.com/josevalim/inherited_resources) gem.
|
37
|
+
|
38
|
+
This module deals with String Parameters using Parameters classes.
|
39
|
+
|
40
|
+
A Parameters inherits from Zobi::ParametersSanitizer, and should define the list
|
41
|
+
of parameters and nested parameters to accept.
|
42
|
+
|
43
|
+
If your controller is namespaced, you should define the `resource_type` method to
|
44
|
+
override its generic behavior.
|
45
|
+
|
46
|
+
If your model is namespaced, you should define the defaults resource_class for
|
47
|
+
Inherited Resource, ie : `defaults resource_class: ::User::Address`
|
48
|
+
|
49
|
+
Here is an example :
|
50
|
+
|
51
|
+
``` ruby
|
52
|
+
module User
|
53
|
+
class AddressParameters < Zobi::ParametersSanitizer
|
54
|
+
|
55
|
+
# Optional, usefull for a namespaced controller, User::AddressesController
|
56
|
+
# here.
|
57
|
+
def resource_type
|
58
|
+
:user_address
|
59
|
+
end
|
60
|
+
|
61
|
+
protected
|
62
|
+
|
63
|
+
def fields
|
64
|
+
[
|
65
|
+
:id,
|
66
|
+
:street,
|
67
|
+
:zip_code,
|
68
|
+
nested_attributes: [:id, :foo, :bar]
|
69
|
+
]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
By default, Parameters class are discovered using the controller namespace.
|
76
|
+
Given a `User::AddressesController`, Zobi will search for
|
77
|
+
`User::AddressParameters` class.
|
78
|
+
|
79
|
+
If you don't want to use Parameters class, you can define the `permitted_params`
|
80
|
+
in your controller and perform custom filtering.
|
81
|
+
|
82
|
+
### Scoped
|
83
|
+
|
84
|
+
This module uses [has_scope](https://github.com/plataformatec/has_scope) gem.
|
85
|
+
|
86
|
+
|
87
|
+
### Included
|
88
|
+
|
89
|
+
This module only works with ActiveRecord because it uses the
|
90
|
+
[Eager Loading Associations of Active Record](http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations).
|
91
|
+
|
92
|
+
|
93
|
+
### Paginated
|
94
|
+
|
95
|
+
This module uses [kaminari](https://github.com/amatsuda/kaminari) gem.
|
96
|
+
|
97
|
+
|
98
|
+
### Controlled Access
|
99
|
+
|
100
|
+
This module uses [pundit](https://github.com/elabs/pundit) and
|
101
|
+
[devise](https://github.com/plataformatec/devise) gems.
|
102
|
+
|
103
|
+
|
104
|
+
### Decorated
|
105
|
+
|
106
|
+
This module uses [draper](https://github.com/drapergem/draper) gem and has a
|
107
|
+
dependency on Inherited modules for now.
|
108
|
+
|
109
|
+
By default, Zobi will try to discover the decorator class to use using the
|
110
|
+
current namespece.
|
111
|
+
|
112
|
+
For example, given a controller named Admin::User::AddressesController, Zobi
|
113
|
+
will try to find the appropriate decorator class in this order :
|
114
|
+
|
115
|
+
Collection :
|
116
|
+
|
117
|
+
``` ruby
|
118
|
+
Admin::User::AddressesDecorator
|
119
|
+
Admin::AddressesDecorator
|
120
|
+
AdressesDecorator
|
121
|
+
Admin::User::CollectionDecorator
|
122
|
+
Admin::CollectionDecorator
|
123
|
+
CollectionDecorator
|
124
|
+
```
|
125
|
+
|
126
|
+
Resource :
|
127
|
+
|
128
|
+
``` ruby
|
129
|
+
Admin::User::AddressDecorator
|
130
|
+
Admin::AddressDecorator
|
131
|
+
AdressDecorator
|
132
|
+
Admin::User::ResourceDecorator
|
133
|
+
Admin::ResourceDecorator
|
134
|
+
ResourceDecorator
|
135
|
+
```
|
136
|
+
|
137
|
+
If this is not the way you organize your decorators, you can override this
|
138
|
+
behavior by defining a method called `collection_decorator_class` or
|
139
|
+
`decorator_class` which returns the decorator class to use.
|
140
|
+
|
141
|
+
|
142
|
+
# Developing
|
143
|
+
|
144
|
+
Launch test suite :
|
145
|
+
|
146
|
+
``` console
|
147
|
+
cd spec/dummy
|
148
|
+
bundle exec rake db:test:prepare
|
149
|
+
cd ../..
|
150
|
+
bundle exec rspec
|
151
|
+
```
|
152
|
+
|
153
|
+
Launch the dummy app :
|
154
|
+
|
155
|
+
``` console
|
156
|
+
cd spec/dummy
|
157
|
+
bundle exec rake db:migrate
|
158
|
+
bundle exec rails s
|
159
|
+
```
|
160
|
+
|
161
|
+
# Versioning
|
162
|
+
|
163
|
+
We decided to follow rails versions to simplify update of Zobi when you want to
|
164
|
+
upgrade rails.
|
165
|
+
|
166
|
+
# Credits
|
167
|
+
|
168
|
+
Copyright (c) 2013 af83
|
169
|
+
|
170
|
+
Released under the MIT license
|
data/lib/zobi.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Dir["#{File.dirname(__FILE__)}/zobi/**/*.rb"].each { |f| require f }
|
4
|
+
|
5
|
+
module Zobi
|
6
|
+
BEHAVIORS = [:inherited, :scoped, :included, :paginated, :controlled_access, :decorated].freeze
|
7
|
+
|
8
|
+
def self.extended base
|
9
|
+
base.helper_method :collection, :resource
|
10
|
+
end
|
11
|
+
|
12
|
+
def behaviors *behaviors
|
13
|
+
(BEHAVIORS & behaviors).each do |behavior|
|
14
|
+
send(:include, behavior_module(behavior))
|
15
|
+
end
|
16
|
+
send(:include, ::Zobi::InstanceMethods)
|
17
|
+
end
|
18
|
+
|
19
|
+
def behavior_module name
|
20
|
+
"Zobi::#{name.to_s.camelize}".constantize
|
21
|
+
end
|
22
|
+
|
23
|
+
def behavior_included? name
|
24
|
+
ancestors.include?(behavior_module(name))
|
25
|
+
end
|
26
|
+
|
27
|
+
module InstanceMethods
|
28
|
+
|
29
|
+
def zobi_resource_class
|
30
|
+
return resource_class if self.class.behavior_included?(:inherited)
|
31
|
+
self.class.name.demodulize.gsub('Controller', '').singularize.constantize
|
32
|
+
end
|
33
|
+
|
34
|
+
def collection
|
35
|
+
return @collection if @collection
|
36
|
+
c = zobi_resource_class
|
37
|
+
BEHAVIORS.each do |behavior|
|
38
|
+
next unless self.class.behavior_included?(behavior)
|
39
|
+
c = send :"#{behavior}_collection", c
|
40
|
+
end
|
41
|
+
@collection = (c.is_a?(Class) ? c.all : c)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
# This module help to manage control access on your collection using pundit.
|
5
|
+
#
|
6
|
+
module ControlledAccess
|
7
|
+
|
8
|
+
def self.included base
|
9
|
+
base.send :include, Pundit
|
10
|
+
base.class_eval do
|
11
|
+
before_filter :authorize_resource
|
12
|
+
|
13
|
+
def policy_scope scope
|
14
|
+
Pundit.policy_scope!(controlled_access_user, scope)
|
15
|
+
end
|
16
|
+
|
17
|
+
def policy record
|
18
|
+
Pundit.policy!(controlled_access_user, record)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
# Authorize resource, see Policies.
|
26
|
+
def authorize_resource
|
27
|
+
case action_name
|
28
|
+
when build_resources_authorized
|
29
|
+
authorize controlled_access_build_resource
|
30
|
+
when resources_authorized
|
31
|
+
authorize controlled_access_resource
|
32
|
+
else
|
33
|
+
authorize zobi_resource_class
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def controlled_access_user
|
38
|
+
if self.class.to_s.split('::').first == 'Admin'
|
39
|
+
begin
|
40
|
+
current_administrator
|
41
|
+
rescue NameError
|
42
|
+
raise "You need to define the current_administrator method.".inspect
|
43
|
+
end
|
44
|
+
else
|
45
|
+
begin
|
46
|
+
current_user
|
47
|
+
rescue NameError
|
48
|
+
raise "You need to define the current_user method.".inspect
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def controlled_access_collection c
|
56
|
+
policy_scope c
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_resources_authorized
|
60
|
+
/new|create/
|
61
|
+
end
|
62
|
+
|
63
|
+
def resources_authorized
|
64
|
+
/edit|update|show|destroy/
|
65
|
+
end
|
66
|
+
|
67
|
+
def controlled_access_build_resource
|
68
|
+
return build_resource if respond_to?(:build_resource)
|
69
|
+
zobi_resource_class.new params[zobi_resource_class.to_s.to_sym]
|
70
|
+
end
|
71
|
+
|
72
|
+
def controlled_access_resource
|
73
|
+
return resource if respond_to?(:resource)
|
74
|
+
zobi_resource_class.find(params[:id])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
# This module decorate your collection and resource
|
5
|
+
# NB: dependencie on Inherited module
|
6
|
+
#
|
7
|
+
module Decorated
|
8
|
+
|
9
|
+
def resource
|
10
|
+
@resource ||= decorator_class.decorate super
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def collection_decorator_class
|
16
|
+
Zobi::Discover.new(self.class, :decorated, :collection).resolve
|
17
|
+
end
|
18
|
+
|
19
|
+
def decorator_class
|
20
|
+
Zobi::Discover.new(self.class, :decorated, :resource).resolve
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def decorated_collection c
|
26
|
+
collection_decorator_class.decorate(
|
27
|
+
(c.is_a?(Class) ? c.all : c),
|
28
|
+
with: decorator_class
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
Discover = Struct.new(:klass, :behavior, :type) do
|
5
|
+
CONFIG = {
|
6
|
+
decorated: {
|
7
|
+
suffix: 'Decorator',
|
8
|
+
resource: 'ResourceDecorator',
|
9
|
+
collection: 'CollectionDecorator'
|
10
|
+
}
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
def resolve
|
14
|
+
discovery.each do |klass|
|
15
|
+
begin
|
16
|
+
return klass.constantize
|
17
|
+
rescue NameError
|
18
|
+
next
|
19
|
+
end
|
20
|
+
end
|
21
|
+
"Zobi::#{fallback}".constantize
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def namespaces
|
27
|
+
last = ""
|
28
|
+
ns = klass.to_s.split('::')
|
29
|
+
ns.pop
|
30
|
+
ns.map{|i| last += "::#{i}"}.reverse.push '::'
|
31
|
+
end
|
32
|
+
|
33
|
+
def resource_class
|
34
|
+
collection_class.singularize
|
35
|
+
end
|
36
|
+
|
37
|
+
def collection_class
|
38
|
+
klass.to_s.demodulize.gsub('Controller', '')
|
39
|
+
end
|
40
|
+
|
41
|
+
def base_class
|
42
|
+
type == :resource ? resource_class : collection_class
|
43
|
+
end
|
44
|
+
|
45
|
+
def discovery
|
46
|
+
discovery = []
|
47
|
+
discovery << self.class.classes_for_namespaces(
|
48
|
+
namespaces, "#{base_class}#{suffix}"
|
49
|
+
)
|
50
|
+
discovery << self.class.classes_for_namespaces(namespaces, fallback)
|
51
|
+
discovery.flatten
|
52
|
+
end
|
53
|
+
|
54
|
+
def fallback
|
55
|
+
CONFIG[behavior][type]
|
56
|
+
end
|
57
|
+
|
58
|
+
def suffix
|
59
|
+
CONFIG[behavior][:suffix]
|
60
|
+
end
|
61
|
+
|
62
|
+
class << self
|
63
|
+
def classes_for_namespaces namespaces, base_name
|
64
|
+
namespaces.map{|ns|
|
65
|
+
"#{ns == '::' ? ns : "#{ns}::"}#{base_name}"
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/zobi/engine.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
# This module add some helpers to controllers.
|
5
|
+
#
|
6
|
+
# * inherit_resources
|
7
|
+
# * params filtering
|
8
|
+
#
|
9
|
+
module Inherited
|
10
|
+
def self.included(klass)
|
11
|
+
klass.inherit_resources
|
12
|
+
klass.send('include', Inherited::Hidden)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def inherited_collection c
|
18
|
+
end_of_association_chain
|
19
|
+
end
|
20
|
+
|
21
|
+
module Hidden
|
22
|
+
protected
|
23
|
+
|
24
|
+
# This method can be overwritted in controllers
|
25
|
+
def permitted_params
|
26
|
+
@permitted_params ||= parameters_class.new(self, params).params
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def parameters_class
|
32
|
+
klass = "#{self.class.to_s.sub('Controller', '').singularize}Parameters"
|
33
|
+
klass.constantize
|
34
|
+
rescue NameError
|
35
|
+
raise <<EOT
|
36
|
+
You need to define the class #{klass} or overwrite the permitted_params method in your controller.
|
37
|
+
EOT
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
# This module helps you to paginate your collection using kaminari
|
5
|
+
#
|
6
|
+
module Paginated
|
7
|
+
|
8
|
+
def self.included base
|
9
|
+
base.send :responders, 'zobi/responders/pagination'
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def paginate_per
|
15
|
+
params[:per]
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def paginated_collection c
|
21
|
+
c.page(params[:page]).per(paginate_per)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Zobi
|
3
|
+
# This class responsability is to filter parameters before sending it to the
|
4
|
+
# model.
|
5
|
+
#
|
6
|
+
# This class is meant to be inherited.
|
7
|
+
#
|
8
|
+
# Most of the time, two methods will be overriden: `fields` and
|
9
|
+
# `translated_fields`.
|
10
|
+
#
|
11
|
+
# If you need complex logic based on context of execution (user rights and so
|
12
|
+
# on...), you have access to the controller through the `context` attr.
|
13
|
+
# Meaning, `context.current_user` is possible. And then, you can implement
|
14
|
+
# all the `if` possible in the world.
|
15
|
+
#
|
16
|
+
class ParametersSanitizer
|
17
|
+
attr_reader :context, :canonical_params
|
18
|
+
private :context, :canonical_params
|
19
|
+
|
20
|
+
# @param [ApplicationController] context
|
21
|
+
# @param [ActionController::Parameters] canonical_params
|
22
|
+
#
|
23
|
+
# @return [Sanitizer]
|
24
|
+
#
|
25
|
+
def initialize(context, canonical_params)
|
26
|
+
@context, @canonical_params = context, canonical_params
|
27
|
+
end
|
28
|
+
|
29
|
+
# The only public method. Return sanitized parameters.
|
30
|
+
#
|
31
|
+
# @return [ActionController::Parameters]
|
32
|
+
#
|
33
|
+
def params
|
34
|
+
canonical_params.permit resource_type => permitted_fields
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
# @return [Array] array of fields
|
40
|
+
#
|
41
|
+
def fields
|
42
|
+
[]
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Array] array of translated fields
|
46
|
+
#
|
47
|
+
def translated_fields
|
48
|
+
[]
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array] array of locales
|
52
|
+
#
|
53
|
+
def locales
|
54
|
+
I18n.available_locales
|
55
|
+
end
|
56
|
+
|
57
|
+
# Computes all the fields
|
58
|
+
#
|
59
|
+
# @return [Array] Complete list of fields
|
60
|
+
#
|
61
|
+
def permitted_fields
|
62
|
+
fields + locales.map {|l| translated_fields.map {|f| "#{f}_#{l}" }}
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Symbol] The resource name to be required
|
66
|
+
#
|
67
|
+
def resource_type
|
68
|
+
self.class.to_s.demodulize.gsub('Parameters', '').underscore.to_sym
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
module Responders
|
5
|
+
module PaginationResponder
|
6
|
+
|
7
|
+
def respond(*)
|
8
|
+
if paginated?
|
9
|
+
controller.headers['X-Total-Pages'] = resource.total_pages.to_s
|
10
|
+
controller.headers['X-Current-Page'] = resource.current_page.to_s
|
11
|
+
controller.headers['X-Limit-Value'] = resource.limit_value.to_s
|
12
|
+
end
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def paginated?
|
19
|
+
resource.respond_to?(:total_pages) &&
|
20
|
+
resource.respond_to?(:current_page) &&
|
21
|
+
resource.respond_to?(:limit_value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/zobi/scoped.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Zobi
|
4
|
+
# This module helps you to filter your collection using has_scope
|
5
|
+
#
|
6
|
+
module Scoped
|
7
|
+
def self.included(klass)
|
8
|
+
klass.helper_method :filters_list
|
9
|
+
klass.before_filter :default_order
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def filters_list
|
15
|
+
scopes_configuration.keys
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def scoped_collection c
|
21
|
+
apply_scopes c
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_order
|
25
|
+
return unless params[:by_order]
|
26
|
+
{order: 'created_at', direction: 'desc'}.each do |k, v|
|
27
|
+
next if params[:by_order][k].present?
|
28
|
+
params[:by_order][k] = v
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/zobi/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zobi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.0.0.rc2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- klacointe
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
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: sqlite3
|
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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: responders
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: inherited_resources
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: has_scope
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.6.0.rc
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.6.0.rc
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: kaminari
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pundit
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: draper
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.3'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: devise
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.2'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: jquery-rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: faker
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: pry-rails
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: database_cleaner
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: rspec-rails
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
description: Keep your rails controllers DRY while using devise, inherited_resources,
|
238
|
+
has_scope, kaminari, pundit and draper
|
239
|
+
email: kevinlacointe@gmail.com
|
240
|
+
executables: []
|
241
|
+
extensions: []
|
242
|
+
extra_rdoc_files: []
|
243
|
+
files:
|
244
|
+
- README.md
|
245
|
+
- app/decorators/zobi/collection_decorator.rb
|
246
|
+
- app/decorators/zobi/resource_decorator.rb
|
247
|
+
- lib/zobi.rb
|
248
|
+
- lib/zobi/controlled_access.rb
|
249
|
+
- lib/zobi/decorated.rb
|
250
|
+
- lib/zobi/discover.rb
|
251
|
+
- lib/zobi/engine.rb
|
252
|
+
- lib/zobi/included.rb
|
253
|
+
- lib/zobi/inherited.rb
|
254
|
+
- lib/zobi/paginated.rb
|
255
|
+
- lib/zobi/parameters_sanitizer.rb
|
256
|
+
- lib/zobi/responders/pagination_responder.rb
|
257
|
+
- lib/zobi/scoped.rb
|
258
|
+
- lib/zobi/version.rb
|
259
|
+
homepage: https://github.com/af83/zobi
|
260
|
+
licenses:
|
261
|
+
- MIT
|
262
|
+
metadata: {}
|
263
|
+
post_install_message:
|
264
|
+
rdoc_options: []
|
265
|
+
require_paths:
|
266
|
+
- lib
|
267
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
+
requirements:
|
274
|
+
- - ">"
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: 1.3.1
|
277
|
+
requirements: []
|
278
|
+
rubyforge_project:
|
279
|
+
rubygems_version: 2.1.11
|
280
|
+
signing_key:
|
281
|
+
specification_version: 4
|
282
|
+
summary: Keep your rails controllers DRY.
|
283
|
+
test_files: []
|