readymade 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +52 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/readymade/action.rb +33 -0
- data/lib/readymade/form.rb +131 -0
- data/lib/readymade/operation.rb +71 -0
- data/lib/readymade/response.rb +43 -0
- data/lib/readymade/version.rb +5 -0
- data/lib/readymade.rb +12 -0
- data/readymade.gemspec +35 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 544c5ded752ee719d0f562e17a0c0ce58c78e6fa1da485b1b4e8c19d0dc88e21
|
4
|
+
data.tar.gz: e23c2ac26779987b73cfe45483ca0b856ff690b687fca08ef48ff917fbf51739
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4a82c9c992c58031a679488fffe58203703f07ba2b63036322cc7d97a704dc954b58efea3fb5c1a29ae27fcbf82871f409721a533e1558edc0b0a92dce57102c
|
7
|
+
data.tar.gz: 7b8dab1d0db59d93757d4eb00cc78d4514cf00692386394658a328647c5f4a8f720f71f8f8a8e9aa26d05fb8f7430b90d9fc4b1f6fdb1e5f7a82c64427e74003
|
data/.gitignore
ADDED
data/.rspec
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 orest.f@coaxsoft.com. 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 [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
readymade (0.2.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (6.1.4.1)
|
10
|
+
activesupport (= 6.1.4.1)
|
11
|
+
activesupport (6.1.4.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
zeitwerk (~> 2.3)
|
17
|
+
byebug (11.1.3)
|
18
|
+
concurrent-ruby (1.1.9)
|
19
|
+
diff-lcs (1.4.4)
|
20
|
+
i18n (1.8.11)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
minitest (5.14.4)
|
23
|
+
rake (13.0.6)
|
24
|
+
rspec (3.10.0)
|
25
|
+
rspec-core (~> 3.10.0)
|
26
|
+
rspec-expectations (~> 3.10.0)
|
27
|
+
rspec-mocks (~> 3.10.0)
|
28
|
+
rspec-core (3.10.1)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-expectations (3.10.1)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-mocks (3.10.2)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.10.0)
|
36
|
+
rspec-support (3.10.3)
|
37
|
+
tzinfo (2.0.4)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
zeitwerk (2.5.1)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
activemodel
|
46
|
+
byebug
|
47
|
+
rake
|
48
|
+
readymade!
|
49
|
+
rspec
|
50
|
+
|
51
|
+
BUNDLED WITH
|
52
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 OrestF
|
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,44 @@
|
|
1
|
+
# Lead
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/readymade`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'readymade'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install readymade
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/readymade. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/readymade/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Lead project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/readymade/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'readymade'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'readymade/response'
|
4
|
+
|
5
|
+
module Readymade
|
6
|
+
class Action
|
7
|
+
class NonKeywordArgumentsError < StandardError; end
|
8
|
+
|
9
|
+
def self.call(*args, &block)
|
10
|
+
new(*args, &block).call
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_reader :args, :data
|
14
|
+
|
15
|
+
def initialize(**args)
|
16
|
+
raise NonKeywordArgumentsError if args.present? && !args.is_a?(Hash)
|
17
|
+
|
18
|
+
@args = @data = args
|
19
|
+
|
20
|
+
@args.each do |name, value|
|
21
|
+
instance_variable_set("@#{name}", value)
|
22
|
+
end
|
23
|
+
|
24
|
+
# yield if block_given?
|
25
|
+
end
|
26
|
+
|
27
|
+
def call; end
|
28
|
+
|
29
|
+
def response(status, *args)
|
30
|
+
Response.new(status, *args)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_model'
|
4
|
+
|
5
|
+
module Readymade
|
6
|
+
class Form
|
7
|
+
include ActiveModel::Model
|
8
|
+
|
9
|
+
attr_accessor :record, :params, :args
|
10
|
+
|
11
|
+
PERMITTED_ATTRIBUTES = [].freeze
|
12
|
+
REQUIRED_ATTRIBUTES = [].freeze
|
13
|
+
|
14
|
+
def initialize(params, **args)
|
15
|
+
@params = params
|
16
|
+
@record = args[:record]
|
17
|
+
@args = args
|
18
|
+
@nested_forms = []
|
19
|
+
@required_attributes = Array(args[:required]).presence
|
20
|
+
@permitted_attributes = (Array(@required_attributes) + Array(args[:permitted])).presence
|
21
|
+
|
22
|
+
parse_datetime_params
|
23
|
+
|
24
|
+
# Slice all attributes which is not required by form
|
25
|
+
# to omit save of unpredictable params
|
26
|
+
@params&.slice!(*permitted_attributes) # if permitted_attributes.present?
|
27
|
+
|
28
|
+
# dynamically creates attr accessors
|
29
|
+
@params&.keys&.each do |key|
|
30
|
+
singleton_class.class_eval do
|
31
|
+
attr_accessor key
|
32
|
+
end
|
33
|
+
end
|
34
|
+
# automatically validates all REQUIRED_ATTRIBUTES
|
35
|
+
singleton_class.validates(*required_attributes, presence: true) if required_attributes.present?
|
36
|
+
|
37
|
+
build_nested_forms
|
38
|
+
|
39
|
+
super(@params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def permitted_attributes
|
43
|
+
@permitted_attributes ||= self.class::PERMITTED_ATTRIBUTES
|
44
|
+
end
|
45
|
+
|
46
|
+
def required_attributes
|
47
|
+
@required_attributes ||= self.class::REQUIRED_ATTRIBUTES
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_nested_forms
|
51
|
+
nested_forms_mapping.each do |attr, form_class|
|
52
|
+
next if params[attr].blank?
|
53
|
+
|
54
|
+
if form_class.is_a?(Array)
|
55
|
+
n_forms = params[attr].map { |_i, attrs| form_class[0].new(attrs) }
|
56
|
+
|
57
|
+
@nested_forms.push(*n_forms)
|
58
|
+
define_singleton_method("#{attr}_forms") { n_forms }
|
59
|
+
else
|
60
|
+
@nested_forms.push(f = form_class.new(params[attr]))
|
61
|
+
define_singleton_method("#{attr}_form") { f }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def validate
|
67
|
+
super && validate_nested(*nested_forms)
|
68
|
+
end
|
69
|
+
|
70
|
+
def validate_nested(*nested_forms)
|
71
|
+
nested_forms.compact.map(&:validate).all? || sync_nested_errors(nested_forms)
|
72
|
+
end
|
73
|
+
|
74
|
+
def sync_nested_errors(nested_forms)
|
75
|
+
nested_forms.each do |n_form|
|
76
|
+
n_form.errors.each do |code, text|
|
77
|
+
errors.add("#{n_form.humanized_name}.#{code}", text)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
84
|
+
def sync_errors(from: self, to: record)
|
85
|
+
return if [from, to].any?(&:blank?)
|
86
|
+
|
87
|
+
errors = from.errors.instance_variable_get('@messages')
|
88
|
+
errors.merge!(to.errors.instance_variable_get('@messages'))
|
89
|
+
|
90
|
+
to.errors.instance_variable_set('@messages', errors)
|
91
|
+
to.errors.messages.transform_values!(&:uniq)
|
92
|
+
end
|
93
|
+
|
94
|
+
def humanized_name
|
95
|
+
self.class.name.underscore.split('/')[0]
|
96
|
+
end
|
97
|
+
|
98
|
+
# uses datetime_params to fix the following issue:
|
99
|
+
# https://stackoverflow.com/questions/5073756/where-is-the-rails-method-that-converts-data-from-datetime-select-into-a-datet
|
100
|
+
def parse_datetime_params
|
101
|
+
datetime_params.each do |param|
|
102
|
+
next if @params[param].present?
|
103
|
+
|
104
|
+
# set datetime to nil if year is blank
|
105
|
+
if @params["#{param}(1i)"].blank?
|
106
|
+
@params[param] = nil
|
107
|
+
|
108
|
+
next
|
109
|
+
end
|
110
|
+
|
111
|
+
@params[param] = DateTime.new(*(1..5).map { |i| @params["#{param}(#{i}i)"].to_i })
|
112
|
+
end
|
113
|
+
rescue ArgumentError
|
114
|
+
nil
|
115
|
+
end
|
116
|
+
|
117
|
+
# list datetime_params in child form in order to parse datetime properly
|
118
|
+
def datetime_params
|
119
|
+
[]
|
120
|
+
end
|
121
|
+
|
122
|
+
# list nested_forms in child form in order to validate them
|
123
|
+
attr_reader :nested_forms
|
124
|
+
|
125
|
+
# define nested forms in format { attr_name: MyFormClass }
|
126
|
+
# use the following syntax if attribute is a collection: { attr_collection_name: [MyFormClass] }
|
127
|
+
def nested_forms_mapping
|
128
|
+
{}
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'readymade/response'
|
4
|
+
require 'readymade/action'
|
5
|
+
|
6
|
+
module Readymade
|
7
|
+
class Operation < Readymade::Action
|
8
|
+
attr_reader :form, :record, :record_params
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def build_form
|
13
|
+
@form = form_class.new(record_params, record: record)
|
14
|
+
end
|
15
|
+
|
16
|
+
def form_valid?
|
17
|
+
form.validate
|
18
|
+
end
|
19
|
+
|
20
|
+
def assign_attributes
|
21
|
+
record.assign_attributes(record_params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def record_valid?
|
25
|
+
return true if record.errors.none? && record.valid?
|
26
|
+
|
27
|
+
sync_errors_to_form && false
|
28
|
+
end
|
29
|
+
|
30
|
+
def save_record
|
31
|
+
record.save
|
32
|
+
end
|
33
|
+
|
34
|
+
def response(status, *args)
|
35
|
+
Response.new(status, *args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def success(*args)
|
39
|
+
response(:success, *args)
|
40
|
+
end
|
41
|
+
|
42
|
+
def validation_fail(status = :validation_fail, args = {})
|
43
|
+
sync_errors_to_form
|
44
|
+
response(status, args.merge!(record: record,
|
45
|
+
record_params: record_params,
|
46
|
+
form: form,
|
47
|
+
errors: form.errors.messages))
|
48
|
+
end
|
49
|
+
|
50
|
+
def fail(status = :fail, args = {})
|
51
|
+
sync_errors_to_form
|
52
|
+
|
53
|
+
response(status, args.merge!(record: record,
|
54
|
+
record_params: record_params,
|
55
|
+
form: form,
|
56
|
+
errors: form&.errors&.messages.presence || record&.errors&.messages))
|
57
|
+
end
|
58
|
+
|
59
|
+
def form_class
|
60
|
+
raise 'Define your own form object class in your operation'
|
61
|
+
end
|
62
|
+
|
63
|
+
def sync_errors_to_form
|
64
|
+
form.sync_errors(from: record, to: form)
|
65
|
+
end
|
66
|
+
|
67
|
+
def sync_errors_to_record
|
68
|
+
form.sync_errors
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readymade
|
4
|
+
class Response
|
5
|
+
class NonKeywordArgumentsError < StandardError; end
|
6
|
+
|
7
|
+
DEFAULT_STATUSES = %i[success fail].freeze
|
8
|
+
|
9
|
+
DEFAULT_STATUSES.each do |ds|
|
10
|
+
define_method("#{ds}?") do
|
11
|
+
ds.to_s == status
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :status, :args, :data
|
16
|
+
|
17
|
+
def initialize(status, *args)
|
18
|
+
@status = status.to_s
|
19
|
+
|
20
|
+
raise NonKeywordArgumentsError if args.present? && !args[0].is_a?(Hash)
|
21
|
+
|
22
|
+
@args = @data = args[0]
|
23
|
+
|
24
|
+
define_singleton_method("#{status}?") do
|
25
|
+
true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def errors
|
30
|
+
args[:errors].presence || {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def method_missing(method_name, *args, &block)
|
34
|
+
return false if method_name.to_s.end_with?('?')
|
35
|
+
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def respond_to_missing?(method_name, include_private = false)
|
40
|
+
method_name.to_s.end_with?('?') || super
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/readymade.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'readymade/action'
|
4
|
+
require 'readymade/form'
|
5
|
+
require 'readymade/operation'
|
6
|
+
require 'readymade/response'
|
7
|
+
require 'readymade/version'
|
8
|
+
|
9
|
+
module Readymade
|
10
|
+
class Error < StandardError; end
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
data/readymade.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/readymade/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'readymade'
|
7
|
+
spec.version = Readymade::VERSION
|
8
|
+
spec.authors = ['OrestF']
|
9
|
+
spec.email = ['falchuko@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Set of base classes for ABDI architecture'
|
12
|
+
spec.description = 'Set of base classes for ABDI architecture'
|
13
|
+
spec.homepage = 'https://github.com/OrestF/readymade'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
16
|
+
|
17
|
+
# spec.metadata['allowed_push_host'] = 'rubygems.org'
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
21
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| 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_development_dependency 'byebug'
|
33
|
+
spec.add_development_dependency 'rake'
|
34
|
+
spec.add_development_dependency 'rspec'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: readymade
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OrestF
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: byebug
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: rspec
|
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
|
+
description: Set of base classes for ABDI architecture
|
56
|
+
email:
|
57
|
+
- falchuko@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- lib/readymade.rb
|
74
|
+
- lib/readymade/action.rb
|
75
|
+
- lib/readymade/form.rb
|
76
|
+
- lib/readymade/operation.rb
|
77
|
+
- lib/readymade/response.rb
|
78
|
+
- lib/readymade/version.rb
|
79
|
+
- readymade.gemspec
|
80
|
+
homepage: https://github.com/OrestF/readymade
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
homepage_uri: https://github.com/OrestF/readymade
|
85
|
+
source_code_uri: https://github.com/OrestF/readymade
|
86
|
+
changelog_uri: https://github.com/OrestF/readymade/CHANGELOG.md
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.3.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.1.6
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Set of base classes for ABDI architecture
|
106
|
+
test_files: []
|