unobtrusive_resources 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +115 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/lib/unobtrusive_resources/version.rb +5 -0
- data/lib/unobtrusive_resources.rb +235 -0
- data/unobtrusive_resources.gemspec +37 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9ff4b08d28b8530be536bd22d80a4d65cd22a3f207a68de79e40897ba6d3c4b
|
4
|
+
data.tar.gz: 06e8edf697482f0e99e5242f3bfdf32e9da448160fe87dea5f5e6d147e3afce8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6ce03f6c26013112bae8675bdf42b51fa506c4abdef3973e59ef20c98636f0511b247a8070a9a889997b9fea86507862d99c75608601575cd3ce2e8df1af631
|
7
|
+
data.tar.gz: db9c2657a73bd571c8cb97029af2c9791e7ea4b827c26138f9dc5498a87b80ea1b7df0ec743df6cf1d27e70ace8f71885cea31e8532e665df308e37d6d6d630b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at sergey@cimon.io. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Serhii Konev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# UnobtrusiveResources
|
2
|
+
|
3
|
+
This gem provides convenient set of methods for resource management to keep your controllers as "skinny" as possible.
|
4
|
+
Main idea is to organize controller actions' code in terms of resource CRUD.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
class BotsController < ApplicationController
|
10
|
+
# ...
|
11
|
+
|
12
|
+
unobtrusive finder_method: :find_by_slug!,
|
13
|
+
find_for_create_by: :slug,
|
14
|
+
resource_class: Bot,
|
15
|
+
relationship_name: :bots,
|
16
|
+
permitted_params_key: :bot,
|
17
|
+
permitted_params_create_value: %i[name code],
|
18
|
+
permitted_params_update_value: %i[name code]
|
19
|
+
def index
|
20
|
+
respond_with(collection)
|
21
|
+
end
|
22
|
+
|
23
|
+
def show
|
24
|
+
respond_with(resource)
|
25
|
+
end
|
26
|
+
|
27
|
+
def new
|
28
|
+
build_resource
|
29
|
+
respond_with(resource)
|
30
|
+
end
|
31
|
+
|
32
|
+
def create
|
33
|
+
find_or_create_resource
|
34
|
+
respond_with(resource)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
update_resource
|
39
|
+
respond_with(resource)
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
destroy_resource
|
44
|
+
respond_with(resource)
|
45
|
+
end
|
46
|
+
# ...
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Keep in mind, that following methods should be defined (or configured with `unobtrusive` method call) in order to make default configuration to work properly:
|
51
|
+
|
52
|
+
- `relationship_name`
|
53
|
+
- `resource_class`
|
54
|
+
- `find_for_create_by`
|
55
|
+
- `permitted_params_key`
|
56
|
+
- `permitted_params_create_value`
|
57
|
+
- `permitted_params_update_value`
|
58
|
+
- `parent_class`
|
59
|
+
- `parent_permitted_params_key`
|
60
|
+
|
61
|
+
For real-life projects most resource related actions will be a bit more complicated.
|
62
|
+
In such cases we can easily change underlying logic for, say, resource creation (redefine method):
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
class BotsController < ApplicationController
|
66
|
+
# ...
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
# Here `Bot` may be some model class or service object.
|
71
|
+
def create_resource
|
72
|
+
@_resource = Bot.custom_create(permitted_params)
|
73
|
+
end
|
74
|
+
# ...
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
## Installation
|
79
|
+
|
80
|
+
Add this line to your application's Gemfile:
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
gem 'unobtrusive_resources'
|
84
|
+
```
|
85
|
+
|
86
|
+
And then execute:
|
87
|
+
|
88
|
+
$ bundle
|
89
|
+
|
90
|
+
Or install it yourself as:
|
91
|
+
|
92
|
+
$ gem install unobtrusive_resources
|
93
|
+
|
94
|
+
## Usage
|
95
|
+
|
96
|
+
There is no need for additional initializer.
|
97
|
+
All necessary methods will be included into `ActionController::Base` via `ActiveSupport.on_load` (lazy load hook).
|
98
|
+
|
99
|
+
## Development
|
100
|
+
|
101
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
102
|
+
|
103
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
104
|
+
|
105
|
+
## Contributing
|
106
|
+
|
107
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cimon-io/unobtrusive_resources. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
108
|
+
|
109
|
+
## License
|
110
|
+
|
111
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
112
|
+
|
113
|
+
## Code of Conduct
|
114
|
+
|
115
|
+
Everyone interacting in the UnobtrusiveResources project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/cimon-io/unobtrusive_resources/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "unobtrusive_resources"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'unobtrusive_resources/version'
|
4
|
+
require 'active_support/concern'
|
5
|
+
require 'active_support/lazy_load_hooks'
|
6
|
+
|
7
|
+
module UnobtrusiveResources
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
# required methods
|
10
|
+
# :relationship_name
|
11
|
+
# :resource_class
|
12
|
+
# :find_for_create_by
|
13
|
+
# :permitted_params_key
|
14
|
+
# :permitted_params_create_value
|
15
|
+
# :permitted_params_update_value
|
16
|
+
|
17
|
+
# :parent_class
|
18
|
+
# :parent_permitted_params_key
|
19
|
+
included do
|
20
|
+
private_class_method :unobtrusive_method
|
21
|
+
private_class_method :safe_unobtrusive_method
|
22
|
+
end
|
23
|
+
|
24
|
+
class_methods do
|
25
|
+
def unobtrusive_method(method_name, &block)
|
26
|
+
return method_name if private_method_defined?(method_name)
|
27
|
+
return method_name if method_defined?(method_name)
|
28
|
+
|
29
|
+
define_method(method_name, &block)
|
30
|
+
protected method_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def safe_unobtrusive_method(method_name, value)
|
34
|
+
if value.respond_to?(:call)
|
35
|
+
unobtrusive_method(method_name, &value)
|
36
|
+
else
|
37
|
+
unobtrusive_method(method_name) { value }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def unobtrusive(options)
|
42
|
+
helper_method :resource,
|
43
|
+
:resource_class,
|
44
|
+
:resource_name,
|
45
|
+
:resource_collection_name,
|
46
|
+
:resource_route,
|
47
|
+
:resource_url,
|
48
|
+
:new_resource_url,
|
49
|
+
:edit_resource_url,
|
50
|
+
:collection,
|
51
|
+
:collection_route,
|
52
|
+
:collection_url
|
53
|
+
|
54
|
+
options.each do |key, value|
|
55
|
+
safe_unobtrusive_method(key, value)
|
56
|
+
end
|
57
|
+
|
58
|
+
unobtrusive_method :collection do
|
59
|
+
instance_variable_set(:@_collection, end_of_association_chain) unless instance_variable_defined?(:@_collection)
|
60
|
+
instance_variable_get(:@_collection)
|
61
|
+
end
|
62
|
+
|
63
|
+
unobtrusive_method :resource do
|
64
|
+
instance_variable_set(:@_resource, end_of_association_chain.public_send(finder_method, unobtrusive_params[finder_param])) unless instance_variable_defined?(:@_resource)
|
65
|
+
instance_variable_get(:@_resource)
|
66
|
+
end
|
67
|
+
|
68
|
+
unobtrusive_method :build_resource do
|
69
|
+
instance_variable_set(:@_resource, end_of_association_chain.build)
|
70
|
+
instance_variable_get(:@_resource).assign_attributes(build_permitted_params)
|
71
|
+
instance_variable_get(:@_resource)
|
72
|
+
end
|
73
|
+
|
74
|
+
unobtrusive_method :find_or_create_resource do
|
75
|
+
instance_variable_set(
|
76
|
+
:@_resource,
|
77
|
+
end_of_association_chain.find_by(find_for_create_by => permitted_params[find_for_create_by]) || end_of_association_chain.build.tap { |r| r.update(permitted_params) }
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
unobtrusive_method :create_resource do
|
82
|
+
instance_variable_set(
|
83
|
+
:@_resource,
|
84
|
+
end_of_association_chain.build.tap { |r| r.update(permitted_params) }
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
unobtrusive_method :update_resource do
|
89
|
+
resource.update(permitted_params)
|
90
|
+
end
|
91
|
+
|
92
|
+
unobtrusive_method :destroy_resource do
|
93
|
+
resource.destroy
|
94
|
+
end
|
95
|
+
|
96
|
+
unobtrusive_method :association_chain do
|
97
|
+
begin_of_association_chain.public_send(relationship_name)
|
98
|
+
end
|
99
|
+
|
100
|
+
unobtrusive_method :association_chain_with_accessible do
|
101
|
+
association_chain
|
102
|
+
end
|
103
|
+
|
104
|
+
unobtrusive_method :association_chain_with_includes do
|
105
|
+
association_chain_with_accessible
|
106
|
+
end
|
107
|
+
|
108
|
+
unobtrusive_method :end_of_association_chain do
|
109
|
+
association_chain_with_includes
|
110
|
+
end
|
111
|
+
|
112
|
+
unobtrusive_method :unobtrusive_params do
|
113
|
+
params
|
114
|
+
end
|
115
|
+
|
116
|
+
unobtrusive_method :finder_method do
|
117
|
+
:find
|
118
|
+
end
|
119
|
+
|
120
|
+
unobtrusive_method :finder_param do
|
121
|
+
:id
|
122
|
+
end
|
123
|
+
|
124
|
+
unobtrusive_method :resource_collection_name do
|
125
|
+
resource_class.model_name.plural
|
126
|
+
end
|
127
|
+
|
128
|
+
unobtrusive_method :resource_name do
|
129
|
+
resource_class.model_name.singular
|
130
|
+
end
|
131
|
+
|
132
|
+
# TODO: remove this method.
|
133
|
+
# Looks like this method is not used.
|
134
|
+
unobtrusive_method :relationship_singular_name do
|
135
|
+
resource_class.to_s.underscore.to_sym
|
136
|
+
end
|
137
|
+
|
138
|
+
unobtrusive_method :permitted_params do
|
139
|
+
unobtrusive_params.permit(permitted_params_key => send("permitted_params_#{action_name}_value"))[permitted_params_key]
|
140
|
+
end
|
141
|
+
|
142
|
+
unobtrusive_method :build_permitted_params do
|
143
|
+
{}
|
144
|
+
end
|
145
|
+
|
146
|
+
unobtrusive_method :collection_url do |*args|
|
147
|
+
url_for(collection_route(*args))
|
148
|
+
end
|
149
|
+
|
150
|
+
unobtrusive_method :resource_url do |*args|
|
151
|
+
url_for(resource_route(args))
|
152
|
+
end
|
153
|
+
|
154
|
+
unobtrusive_method :resource_route do |*args|
|
155
|
+
[resource, *args]
|
156
|
+
end
|
157
|
+
|
158
|
+
unobtrusive_method :edit_resource_url do |*args|
|
159
|
+
url_for(edit_resource_route(*args))
|
160
|
+
end
|
161
|
+
|
162
|
+
unobtrusive_method :edit_resource_route do |*args|
|
163
|
+
[:edit, resource, *args]
|
164
|
+
end
|
165
|
+
|
166
|
+
unobtrusive_method :new_resource_url do |*args|
|
167
|
+
url_for(new_resource_route(*args))
|
168
|
+
end
|
169
|
+
|
170
|
+
unobtrusive_method :new_resource_route do |*args|
|
171
|
+
[:new, resource_name, *args]
|
172
|
+
end
|
173
|
+
|
174
|
+
# parent methods
|
175
|
+
if method_defined?(:parent_class) || private_method_defined?(:parent_class)
|
176
|
+
helper_method :parent, :parent_class, :parent_name, :parent_collection_name, :parent_url
|
177
|
+
|
178
|
+
unobtrusive_method :parent do
|
179
|
+
instance_variable_set(:@_parent, parent_class.public_send(parent_finder_method, unobtrusive_params[parent_finder_param])) unless instance_variable_defined?(:@_parent)
|
180
|
+
instance_variable_get(:@_parent)
|
181
|
+
end
|
182
|
+
|
183
|
+
# TODO: Rename `unoptrusive_parent_params` => `unobtrusive_parent_params`
|
184
|
+
# Check if this method is used in existing repositories.
|
185
|
+
unobtrusive_method :unoptrusive_parent_params do
|
186
|
+
params
|
187
|
+
end
|
188
|
+
|
189
|
+
unobtrusive_method :parent_finder_method do
|
190
|
+
:find
|
191
|
+
end
|
192
|
+
|
193
|
+
unobtrusive_method :parent_finder_param do
|
194
|
+
:id
|
195
|
+
end
|
196
|
+
|
197
|
+
unobtrusive_method :parent_collection_name do
|
198
|
+
parent_class.model_name.plural
|
199
|
+
end
|
200
|
+
|
201
|
+
unobtrusive_method :parent_name do
|
202
|
+
parent_class.model_name.singular
|
203
|
+
end
|
204
|
+
|
205
|
+
unobtrusive_method :parent_url do |*args|
|
206
|
+
url_for(parent_route(*args))
|
207
|
+
end
|
208
|
+
|
209
|
+
unobtrusive_method :parent_route do |*args|
|
210
|
+
[parent, *args]
|
211
|
+
end
|
212
|
+
|
213
|
+
unobtrusive_method :collection_route do |*args|
|
214
|
+
[parent, relationship_name, *args]
|
215
|
+
end
|
216
|
+
|
217
|
+
unobtrusive_method :begin_of_association_chain do
|
218
|
+
parent
|
219
|
+
end
|
220
|
+
else
|
221
|
+
unobtrusive_method :begin_of_association_chain do
|
222
|
+
OpenStruct.new(relationship_name => resource_class.all)
|
223
|
+
end
|
224
|
+
|
225
|
+
unobtrusive_method :collection_route do |*args|
|
226
|
+
[relationship_name, *args]
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
ActiveSupport.on_load(:action_controller) do
|
234
|
+
include(::UnobtrusiveResources) if self == ActionController::Base
|
235
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'unobtrusive_resources/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'unobtrusive_resources'
|
7
|
+
spec.version = UnobtrusiveResources::VERSION
|
8
|
+
spec.authors = ['Alexey Osipenko', 'Serhii Konev']
|
9
|
+
spec.email = ['alexey@cimon.io', 'sergey@cimon.io']
|
10
|
+
|
11
|
+
spec.summary = 'Controller concern for skinny, concise and declarative actions'
|
12
|
+
spec.description = 'This gem provides number of utility methods to cleanup codebase, related to controllers. Extremely usefull for common resource management actions (CRUD).'
|
13
|
+
spec.homepage = 'https://github.com/cimon-io/unobtrusive_resources'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
|
+
else
|
21
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
22
|
+
'public gem pushes.'
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_dependency 'activesupport', '>= 3.0', '< 8.0'
|
33
|
+
|
34
|
+
spec.add_development_dependency 'bundler', '~> 2.2.33'
|
35
|
+
spec.add_development_dependency 'rake', '~> 12'
|
36
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unobtrusive_resources
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey Osipenko
|
8
|
+
- Serhii Konev
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-12-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.0'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '8.0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.0'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '8.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: bundler
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.2.33
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.2.33
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '12'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.7'
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.7'
|
76
|
+
description: This gem provides number of utility methods to cleanup codebase, related
|
77
|
+
to controllers. Extremely usefull for common resource management actions (CRUD).
|
78
|
+
email:
|
79
|
+
- alexey@cimon.io
|
80
|
+
- sergey@cimon.io
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- ".gitignore"
|
86
|
+
- ".travis.yml"
|
87
|
+
- CODE_OF_CONDUCT.md
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- bin/console
|
93
|
+
- bin/rspec
|
94
|
+
- bin/setup
|
95
|
+
- lib/unobtrusive_resources.rb
|
96
|
+
- lib/unobtrusive_resources/version.rb
|
97
|
+
- unobtrusive_resources.gemspec
|
98
|
+
homepage: https://github.com/cimon-io/unobtrusive_resources
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata:
|
102
|
+
allowed_push_host: https://rubygems.org
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubygems_version: 3.2.3
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Controller concern for skinny, concise and declarative actions
|
122
|
+
test_files: []
|