controller_resources 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +17 -0
- data/README.md +4 -0
- data/controller_resources.gemspec +15 -14
- data/lib/controller_resources/extension.rb +8 -2
- data/lib/controller_resources/version.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +19 -5
- data/MIT-LICENSE +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6641d78693a54de498d10f9d1d53243bcaf1997d
|
4
|
+
data.tar.gz: 180ca43f6043f5a50a094e167cf399da6010b57c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08d0bc4c3a24e6110df16fb9210d4def5884f3cfaee4254ee2ca99367ad0dccdf4ec897a72944daa90c003a3866cffaaa592e5ea5267f68960e71b00afc2e730
|
7
|
+
data.tar.gz: 0e968d80f3d199f1ed5b800e61d2190c3e1fbd226ced05a59e0ce4eca736772f39090fa118a75564e0bf4604bb078b97423f10f3da7d5a63e08c047a5463571f
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm: 2.1.5
|
3
|
+
cache: bundle
|
4
|
+
before_script: bundle exec rake db:setup
|
5
|
+
script: bundle exec rspec
|
6
|
+
addons:
|
7
|
+
codeclimate:
|
8
|
+
repo_token:
|
9
|
+
secure: CxFMGcOhwkzowVZyys4fxSlsahNTNR6eBnRJmXqOhzjZwOoB7z0j3wfvIv8lDkKl03ayFUmToH147M4euh6RTbyCiFa9ti/bcVglWHaTDn6Qh5Ow6FWSJ76tIPAXpDaipn+ns8PQpsvrBISu6pB0MTgBbMwGQLpEUbDKtOCxexY=
|
10
|
+
deploy:
|
11
|
+
provider: rubygems
|
12
|
+
api_key:
|
13
|
+
secure: Ss+mExNaQHwVyJ0u5cN/BrrVEPZPUdojUxbVj5xa4fjT8OCmaeXY6DM24L1dDpysNLlExKzNVzK6JZNl1KFE03U6Be+S8sr5yJ3hlhPIqShA21+riiC/yeEnNw9oWv+EDDw2CD5TImF3u4YmGJohVdpCGl2U3tlRP5Kchz1vYjw=
|
14
|
+
gem: controller_resources
|
15
|
+
on:
|
16
|
+
tags: true
|
17
|
+
repo: tubbo/controller_resources
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# ControllerResources
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/tubbo/controller_resources.svg)](https://travis-ci.org/tubbo/controller_resources)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/tubbo/controller_resources/badges/gpa.svg)](https://codeclimate.com/github/tubbo/controller_resources)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/tubbo/controller_resources/badges/coverage.svg)](https://codeclimate.com/github/tubbo/controller_resources)
|
6
|
+
|
3
7
|
A Rails engine that unites DecentExposure, StrongParameters, Devise (if
|
4
8
|
installed) and Draper (if installed) to provide one hell of an awesome
|
5
9
|
controller DSL.
|
@@ -4,27 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'controller_resources/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'controller_resources'
|
8
8
|
spec.version = ControllerResources::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Tom Scott']
|
10
|
+
spec.email = ['tubbo@psychedeli.ca']
|
11
11
|
spec.summary = %q{A "glue" for decent_exposure, responders, draper and strong_params}
|
12
12
|
spec.description = %q{A "glue" for decent_exposure, responders, draper and strong_params}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/tubbo/controller_resources'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^|spec/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
24
|
+
spec.add_development_dependency 'pg'
|
25
|
+
spec.add_development_dependency 'generator_spec'
|
26
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
26
27
|
|
27
|
-
spec.add_dependency
|
28
|
-
spec.add_dependency
|
29
|
-
spec.add_dependency
|
28
|
+
spec.add_dependency 'rails', '>= 4.0.0'
|
29
|
+
spec.add_dependency 'decent_exposure'
|
30
|
+
spec.add_dependency 'responders'
|
30
31
|
end
|
@@ -27,6 +27,7 @@ module ControllerResources
|
|
27
27
|
class_attribute :_singleton_resource
|
28
28
|
class_attribute :_collection_resource
|
29
29
|
class_attribute :_finder_method
|
30
|
+
class_attribute :_protected_actions
|
30
31
|
|
31
32
|
# Use the StrongParameters strategy in DecentExposure
|
32
33
|
decent_configuration do
|
@@ -46,6 +47,7 @@ module ControllerResources
|
|
46
47
|
name = self.name.gsub(/Controller/, '').tableize if name.nil?
|
47
48
|
self._singleton_resource = name.to_s.singularize.to_sym
|
48
49
|
self._collection_resource = name.to_s.pluralize.to_sym
|
50
|
+
self._protected_actions = %w(create update destroy edit new)
|
49
51
|
|
50
52
|
class_eval <<-RUBY
|
51
53
|
expose :#{model}, except: %w(index)
|
@@ -70,13 +72,17 @@ module ControllerResources
|
|
70
72
|
self._edit_params = hash_of_params
|
71
73
|
end
|
72
74
|
|
75
|
+
def protect(action)
|
76
|
+
self._protected_actions << action
|
77
|
+
end
|
78
|
+
|
73
79
|
private
|
74
80
|
def authenticate
|
75
|
-
"before_action :authenticate_user!,
|
81
|
+
"before_action :authenticate_user!, only: %w(#{_protected_actions.join(' ')})"
|
76
82
|
end
|
77
83
|
|
78
84
|
def authorize
|
79
|
-
"authorize_actions_for #{
|
85
|
+
"authorize_actions_for #{model.to_s.classify}, only: %w(#{_protected_actions.join(' ')})"
|
80
86
|
end
|
81
87
|
|
82
88
|
def model_class
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controller_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Scott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rails
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,9 +146,9 @@ extra_rdoc_files: []
|
|
132
146
|
files:
|
133
147
|
- ".gitignore"
|
134
148
|
- ".ruby-version"
|
149
|
+
- ".travis.yml"
|
135
150
|
- Gemfile
|
136
151
|
- LICENSE.txt
|
137
|
-
- MIT-LICENSE
|
138
152
|
- README.md
|
139
153
|
- Rakefile
|
140
154
|
- bin/rails
|
@@ -210,16 +224,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
224
|
version: '0'
|
211
225
|
requirements: []
|
212
226
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.4.5
|
214
228
|
signing_key:
|
215
229
|
specification_version: 4
|
216
230
|
summary: A "glue" for decent_exposure, responders, draper and strong_params
|
217
231
|
test_files:
|
218
232
|
- ".gitignore"
|
219
233
|
- ".ruby-version"
|
234
|
+
- ".travis.yml"
|
220
235
|
- Gemfile
|
221
236
|
- LICENSE.txt
|
222
|
-
- MIT-LICENSE
|
223
237
|
- README.md
|
224
238
|
- Rakefile
|
225
239
|
- bin/rails
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2014 YOURNAME
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|