rubanok 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -2
- data/LICENSE.txt +1 -1
- data/README.md +86 -14
- data/lib/rubanok/dsl/mapping.rb +12 -1
- data/lib/rubanok/dsl/matching.rb +3 -3
- data/lib/rubanok/processor.rb +37 -9
- data/lib/rubanok/rule.rb +16 -7
- data/lib/rubanok/version.rb +1 -1
- metadata +13 -56
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.rubocop.yml +0 -66
- data/.travis.yml +0 -27
- data/Gemfile +0 -13
- data/Gemfile.local +0 -2
- data/Rakefile +0 -10
- data/bin/console +0 -8
- data/bin/setup +0 -8
- data/gemfiles/rails42.gemfile +0 -5
- data/gemfiles/rails52.gemfile +0 -6
- data/gemfiles/rails6.gemfile +0 -6
- data/gemfiles/railsmaster.gemfile +0 -5
- data/lib/rubanok/ext/symbolize_keys.rb +0 -13
- data/rubanok.gemspec +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b992103f2ed0900e3f7b9f7aa631ee6b78d7f564c439a978a71ee44411915278
|
4
|
+
data.tar.gz: fcfe5bb16302cc7a45a75499e638fcde7288c269faf36f31c7abadb388cc29c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc24b6c4d71a01f92d458a72a994341972ae8fba49832756cacd994411d8dec6f6d390c7566d44c80d37ca52abcc15981bd34b14edd78d1941cd1fde6379be9
|
7
|
+
data.tar.gz: f0c9ae2bf40cf2db770af48032e1b5665776ad87b3abb37fc111e93bd88091e919136351dadb5d45faf7b11ea7205cd10f3d92e4909a0538317e73bb3f1c3502
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.3.0 (2020-10-21)
|
6
|
+
|
7
|
+
- Add `filter_with: Symbol | Proc` option to `.map` to allowing filtering the input value. ([@palkan][])
|
8
|
+
|
9
|
+
- Allow specifying `ignore_empty_values: *` per rule. ([@palkan][])
|
10
|
+
|
11
|
+
- Add `prepare` DSL method to transform the input once before the first rule is activated. ([@palkan][])
|
12
|
+
|
13
|
+
When no rules match, the method is not called.
|
14
|
+
Useful when you want to perform some default transformations.
|
15
|
+
|
5
16
|
## 0.2.1 (2019-08-24)
|
6
17
|
|
7
18
|
- Fix bug with trying to add a helper for API controller. ([@palkan][])
|
@@ -14,8 +25,8 @@ Fixes [#10](https://github.com/palkan/rubanok/issues/10).
|
|
14
25
|
|
15
26
|
```ruby
|
16
27
|
class PostsProcessor < Rubanok::Processor
|
17
|
-
map
|
18
|
-
match
|
28
|
+
map(:q) { block }
|
29
|
+
match(:page, :per_page, activate_on: :page) { block }
|
19
30
|
end
|
20
31
|
|
21
32
|
PostsProcessor.project(q: "search_me", filter: "smth", page: 2)
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2018 Vladimir Dementyev
|
3
|
+
Copyright (c) 2018-2020 Vladimir Dementyev
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/rubanok.svg)](https://rubygems.org/gems/rubanok)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/rubanok.svg)](https://rubygems.org/gems/rubanok)
|
2
|
+
![Build](https://github.com/palkan/rubanok/workflows/Build/badge.svg)
|
2
3
|
|
3
4
|
# Rubanok
|
4
5
|
|
@@ -13,12 +14,12 @@ So, instead of:
|
|
13
14
|
```ruby
|
14
15
|
class CourseSessionController < ApplicationController
|
15
16
|
def index
|
16
|
-
@sessions = CourseSession
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
@sessions = CourseSession
|
18
|
+
.search(params[:q])
|
19
|
+
.by_course_type(params[:course_type_id])
|
20
|
+
.by_role(params[:role_id])
|
21
|
+
.paginate(page_params)
|
22
|
+
.order(ordering_params)
|
22
23
|
end
|
23
24
|
end
|
24
25
|
```
|
@@ -53,7 +54,9 @@ end
|
|
53
54
|
Requirements:
|
54
55
|
|
55
56
|
- Ruby ~> 2.5
|
56
|
-
- Rails >=
|
57
|
+
- (optional\*) Rails >= 5.2 (Rails 4.2 should work but we don't test against it anymore)
|
58
|
+
|
59
|
+
\* This gem has no dependency on Rails.
|
57
60
|
|
58
61
|
<a href="https://evilmartians.com/">
|
59
62
|
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
|
@@ -106,8 +109,8 @@ There is also `match` method to handle values:
|
|
106
109
|
|
107
110
|
```ruby
|
108
111
|
class CourseSessionsProcessor < Rubanok::Processor
|
109
|
-
SORT_ORDERS = %w
|
110
|
-
SORTABLE_FIELDS = %w
|
112
|
+
SORT_ORDERS = %w[asc desc].freeze
|
113
|
+
SORTABLE_FIELDS = %w[id name created_at].freeze
|
111
114
|
|
112
115
|
match :sort_by, :sort do
|
113
116
|
having "course_id", "desc" do
|
@@ -152,6 +155,41 @@ If in example above you will call `CourseSessionsProcessor.call(CourseSession, f
|
|
152
155
|
|
153
156
|
**NOTE:** Rubanok only matches exact values; more complex matching could be added in the future.
|
154
157
|
|
158
|
+
### Default transformation
|
159
|
+
|
160
|
+
Sometimes it's useful to perform some transformations before **any** rule is activated.
|
161
|
+
|
162
|
+
There is a special `prepare` method which allows you to define the default transformation:
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
class CourseSearchQueryProcessor < Rubanok::Processor
|
166
|
+
prepare do
|
167
|
+
next if raw&.dig(:query, :bool)
|
168
|
+
|
169
|
+
{query: {bool: {filters: []}}}
|
170
|
+
end
|
171
|
+
|
172
|
+
map :ids do |ids:|
|
173
|
+
raw.dig(:query, :bool, :filters) << {terms: {id: ids}}
|
174
|
+
raw
|
175
|
+
end
|
176
|
+
end
|
177
|
+
```
|
178
|
+
|
179
|
+
The block should return a new initial value for the _raw_ input or `nil` (no transformation required).
|
180
|
+
|
181
|
+
The `prepare` callback is not executed if no params match, e.g.:
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
CourseSearchQueryProcessor.call(nil, {}) #=> nil
|
185
|
+
|
186
|
+
# But
|
187
|
+
CourseSearchQueryProcessor.call(nil, {ids: [1]}) #=> {query {bool: {filters: [{terms: {ids: [1]}}]}}}
|
188
|
+
|
189
|
+
# Note that we can omit the first argument altogether
|
190
|
+
CourseSearchQueryProcessor.call({ids: [1]})
|
191
|
+
```
|
192
|
+
|
155
193
|
### Getting the matching params
|
156
194
|
|
157
195
|
Sometimes it could be useful to get the params that were used to process the data by Rubanok processor (e.g., you can use this data in views to display the actual filters state).
|
@@ -200,7 +238,41 @@ end
|
|
200
238
|
|
201
239
|
By default, Rubanok ignores empty param values (using `#empty?` under the hood) and will not run matching rules on those values. For example: `{ q: "" }` and `{ q: nil }` won't activate the `map :q` rule.
|
202
240
|
|
203
|
-
You can change this behaviour by
|
241
|
+
You can change this behaviour by specifying `ignore_empty_values: true` option for a particular rule or enabling this behaviour globally via `Rubanok.ignore_empty_values = true` (enabled by default).
|
242
|
+
|
243
|
+
### Input values filtering
|
244
|
+
|
245
|
+
For complex input types, such as arrays, it might be useful to _prepare_ the value before passing to a transforming block or prevent the activation altogether.
|
246
|
+
|
247
|
+
We provide a `filter_with:` option for the `.map` method, which could be used as follows:
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
class PostsProcessor < Rubanok::Processor
|
251
|
+
# We can pass a Proc
|
252
|
+
map :ids, filter_with: ->(vals) { vals.reject(&:blank?).presence } do |ids:|
|
253
|
+
raw.where(id: ids)
|
254
|
+
end
|
255
|
+
|
256
|
+
# or define a class method
|
257
|
+
def self.non_empty_array(val)
|
258
|
+
non_blank = val.reject(&:blank?)
|
259
|
+
return if non_blank.empty?
|
260
|
+
|
261
|
+
non_blank
|
262
|
+
end
|
263
|
+
|
264
|
+
# and pass its name as a filter_with value
|
265
|
+
map :ids, filter_with: :non_empty_array do |ids:|
|
266
|
+
raw.where(id: ids)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Filtered values are used in rules
|
271
|
+
PostsProcessor.call(Post.all, {ids: ["1", ""]}) == Post.where(id: ["1"])
|
272
|
+
|
273
|
+
# When filter returns empty value, the rule is not applied
|
274
|
+
PostsProcessor.call(Post.all, {ids: [nil, ""]}) == Post.all
|
275
|
+
```
|
204
276
|
|
205
277
|
### Testing
|
206
278
|
|
@@ -209,7 +281,7 @@ One of the benefits of having modification logic contained in its own class is t
|
|
209
281
|
```ruby
|
210
282
|
# For example, with RSpec
|
211
283
|
RSpec.describe CourseSessionsProcessor do
|
212
|
-
let(:input
|
284
|
+
let(:input) { CourseSession.all }
|
213
285
|
let(:params) { {} }
|
214
286
|
|
215
287
|
subject { described_class.call(input, params) }
|
@@ -229,8 +301,8 @@ RSpec.describe CourseSessionController do
|
|
229
301
|
subject { get :index }
|
230
302
|
|
231
303
|
specify do
|
232
|
-
expect { subject }.to have_rubanok_processed(CourseSession.all)
|
233
|
-
with(CourseSessionsProcessor)
|
304
|
+
expect { subject }.to have_rubanok_processed(CourseSession.all)
|
305
|
+
.with(CourseSessionsProcessor)
|
234
306
|
end
|
235
307
|
end
|
236
308
|
```
|
data/lib/rubanok/dsl/mapping.rb
CHANGED
@@ -22,7 +22,18 @@ module Rubanok
|
|
22
22
|
|
23
23
|
module ClassMethods
|
24
24
|
def map(*fields, **options, &block)
|
25
|
-
|
25
|
+
filter = options[:filter_with]
|
26
|
+
|
27
|
+
if filter.is_a?(Symbol)
|
28
|
+
respond_to?(filter) || raise(
|
29
|
+
ArgumentError,
|
30
|
+
"Unknown class method #{filter} for #{self}. " \
|
31
|
+
"Make sure that a filter method is defined before the call to .map."
|
32
|
+
)
|
33
|
+
options[:filter_with] = method(filter)
|
34
|
+
end
|
35
|
+
|
36
|
+
rule = Rule.new(fields, **options)
|
26
37
|
|
27
38
|
define_method(rule.to_method_name, &block)
|
28
39
|
|
data/lib/rubanok/dsl/matching.rb
CHANGED
@@ -39,7 +39,7 @@ module Rubanok
|
|
39
39
|
|
40
40
|
attr_reader :clauses
|
41
41
|
|
42
|
-
def initialize(
|
42
|
+
def initialize(*, **)
|
43
43
|
super
|
44
44
|
@clauses = []
|
45
45
|
end
|
@@ -68,7 +68,7 @@ module Rubanok
|
|
68
68
|
|
69
69
|
module ClassMethods
|
70
70
|
def match(*fields, **options, &block)
|
71
|
-
rule = Rule.new(fields, options.slice(:activate_on, :activate_always))
|
71
|
+
rule = Rule.new(fields, **options.slice(:activate_on, :activate_always))
|
72
72
|
|
73
73
|
rule.instance_eval(&block)
|
74
74
|
|
@@ -76,7 +76,7 @@ module Rubanok
|
|
76
76
|
clause = rule.matching_clause(params)
|
77
77
|
next default_match_handler(rule, params, options[:fail_when_no_matches]) unless clause
|
78
78
|
|
79
|
-
apply_rule! clause
|
79
|
+
apply_rule! clause, params
|
80
80
|
end
|
81
81
|
|
82
82
|
rule.clauses.each do |clause|
|
data/lib/rubanok/processor.rb
CHANGED
@@ -7,9 +7,6 @@ require "rubanok/rule"
|
|
7
7
|
require "rubanok/dsl/mapping"
|
8
8
|
require "rubanok/dsl/matching"
|
9
9
|
|
10
|
-
require "rubanok/ext/symbolize_keys"
|
11
|
-
using Rubanok::SymbolizeKeys
|
12
|
-
|
13
10
|
module Rubanok
|
14
11
|
# Base class for processors (_planes_)
|
15
12
|
#
|
@@ -36,7 +33,14 @@ module Rubanok
|
|
36
33
|
include DSL::Mapping
|
37
34
|
|
38
35
|
class << self
|
39
|
-
def call(
|
36
|
+
def call(*args)
|
37
|
+
input, params =
|
38
|
+
if args.size == 1
|
39
|
+
[nil, args.first]
|
40
|
+
else
|
41
|
+
args
|
42
|
+
end
|
43
|
+
|
40
44
|
new(input).call(params)
|
41
45
|
end
|
42
46
|
|
@@ -70,9 +74,14 @@ module Rubanok
|
|
70
74
|
# Generates a `params` projection including only the keys used
|
71
75
|
# by the rules
|
72
76
|
def project(params)
|
73
|
-
params = params.
|
77
|
+
params = params.transform_keys(&:to_sym)
|
74
78
|
params.slice(*fields_set)
|
75
79
|
end
|
80
|
+
|
81
|
+
# DSL to define the #prepare method
|
82
|
+
def prepare(&block)
|
83
|
+
define_method(:prepare, &block)
|
84
|
+
end
|
76
85
|
end
|
77
86
|
|
78
87
|
def initialize(input)
|
@@ -80,12 +89,13 @@ module Rubanok
|
|
80
89
|
end
|
81
90
|
|
82
91
|
def call(params)
|
83
|
-
params = params.
|
92
|
+
params = params.transform_keys(&:to_sym)
|
84
93
|
|
85
94
|
rules.each do |rule|
|
86
95
|
next unless rule.applicable?(params)
|
87
96
|
|
88
|
-
|
97
|
+
prepare! unless prepared?
|
98
|
+
apply_rule! rule, params
|
89
99
|
end
|
90
100
|
|
91
101
|
input
|
@@ -93,11 +103,16 @@ module Rubanok
|
|
93
103
|
|
94
104
|
private
|
95
105
|
|
96
|
-
attr_accessor :input
|
106
|
+
attr_accessor :input, :prepared
|
97
107
|
|
98
108
|
alias raw input
|
109
|
+
alias prepared? prepared
|
110
|
+
|
111
|
+
def apply_rule!(rule, params)
|
112
|
+
method_name, data = rule.to_method_name, rule.project(params)
|
113
|
+
|
114
|
+
return unless data
|
99
115
|
|
100
|
-
def apply_rule!(method_name, data)
|
101
116
|
self.input =
|
102
117
|
if data.empty?
|
103
118
|
send(method_name)
|
@@ -106,6 +121,19 @@ module Rubanok
|
|
106
121
|
end
|
107
122
|
end
|
108
123
|
|
124
|
+
def prepare
|
125
|
+
# no-op
|
126
|
+
end
|
127
|
+
|
128
|
+
def prepare!
|
129
|
+
@prepared = true
|
130
|
+
|
131
|
+
prepared_input = prepare
|
132
|
+
return unless prepared_input
|
133
|
+
|
134
|
+
self.input = prepared_input
|
135
|
+
end
|
136
|
+
|
109
137
|
def rules
|
110
138
|
self.class.rules
|
111
139
|
end
|
data/lib/rubanok/rule.rb
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
|
3
3
|
module Rubanok
|
4
4
|
class Rule # :nodoc:
|
5
|
-
UNDEFINED =
|
5
|
+
UNDEFINED = Object.new
|
6
6
|
|
7
|
-
attr_reader :fields, :activate_on, :activate_always
|
7
|
+
attr_reader :owner, :fields, :activate_on, :activate_always, :ignore_empty_values, :filter_with
|
8
8
|
|
9
|
-
def initialize(fields, activate_on: fields, activate_always: false)
|
9
|
+
def initialize(fields, activate_on: fields, activate_always: false, ignore_empty_values: Rubanok.ignore_empty_values, filter_with: nil)
|
10
|
+
@owner = owner
|
10
11
|
@fields = fields.freeze
|
11
12
|
@activate_on = Array(activate_on).freeze
|
12
13
|
@activate_always = activate_always
|
14
|
+
@ignore_empty_values = ignore_empty_values
|
15
|
+
@filter_with = filter_with
|
13
16
|
end
|
14
17
|
|
15
18
|
def project(params)
|
@@ -25,7 +28,7 @@ module Rubanok
|
|
25
28
|
def applicable?(params)
|
26
29
|
return true if activate_always == true
|
27
30
|
|
28
|
-
activate_on.all? { |field| params
|
31
|
+
activate_on.all? { |field| fetch_value(params, field) != UNDEFINED }
|
29
32
|
end
|
30
33
|
|
31
34
|
def to_method_name
|
@@ -39,9 +42,15 @@ module Rubanok
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def fetch_value(params, field)
|
42
|
-
return UNDEFINED
|
45
|
+
return UNDEFINED unless params.key?(field)
|
43
46
|
|
44
|
-
params[field]
|
47
|
+
val = params[field]
|
48
|
+
|
49
|
+
val = filter_with.call(val) if filter_with
|
50
|
+
|
51
|
+
return UNDEFINED if empty?(val)
|
52
|
+
|
53
|
+
val
|
45
54
|
end
|
46
55
|
|
47
56
|
using(Module.new do
|
@@ -59,7 +68,7 @@ module Rubanok
|
|
59
68
|
end)
|
60
69
|
|
61
70
|
def empty?(val)
|
62
|
-
return false unless
|
71
|
+
return false unless ignore_empty_values
|
63
72
|
|
64
73
|
val.empty?
|
65
74
|
end
|
data/lib/rubanok/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubanok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionview
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,28 +56,28 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -94,34 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: standard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.0.39
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.0.39
|
125
97
|
description: Parameters-based transformation DSL
|
126
98
|
email:
|
127
99
|
- dementiev.vm@gmail.com
|
@@ -129,33 +101,18 @@ executables: []
|
|
129
101
|
extensions: []
|
130
102
|
extra_rdoc_files: []
|
131
103
|
files:
|
132
|
-
- ".gitignore"
|
133
|
-
- ".rspec"
|
134
|
-
- ".rubocop.yml"
|
135
|
-
- ".travis.yml"
|
136
104
|
- CHANGELOG.md
|
137
|
-
- Gemfile
|
138
|
-
- Gemfile.local
|
139
105
|
- LICENSE.txt
|
140
106
|
- README.md
|
141
|
-
- Rakefile
|
142
|
-
- bin/console
|
143
|
-
- bin/setup
|
144
|
-
- gemfiles/rails42.gemfile
|
145
|
-
- gemfiles/rails52.gemfile
|
146
|
-
- gemfiles/rails6.gemfile
|
147
|
-
- gemfiles/railsmaster.gemfile
|
148
107
|
- lib/rubanok.rb
|
149
108
|
- lib/rubanok/dsl/mapping.rb
|
150
109
|
- lib/rubanok/dsl/matching.rb
|
151
|
-
- lib/rubanok/ext/symbolize_keys.rb
|
152
110
|
- lib/rubanok/processor.rb
|
153
111
|
- lib/rubanok/rails/controller.rb
|
154
112
|
- lib/rubanok/railtie.rb
|
155
113
|
- lib/rubanok/rspec.rb
|
156
114
|
- lib/rubanok/rule.rb
|
157
115
|
- lib/rubanok/version.rb
|
158
|
-
- rubanok.gemspec
|
159
116
|
homepage: https://github.com/palkan/rubanok
|
160
117
|
licenses:
|
161
118
|
- MIT
|
@@ -180,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
137
|
- !ruby/object:Gem::Version
|
181
138
|
version: '0'
|
182
139
|
requirements: []
|
183
|
-
rubygems_version: 3.0.
|
140
|
+
rubygems_version: 3.0.6
|
184
141
|
signing_key:
|
185
142
|
specification_version: 4
|
186
143
|
summary: Parameters-based transformation DSL
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- standard/cop/semantic_blocks
|
3
|
-
- rubocop-rspec
|
4
|
-
|
5
|
-
inherit_gem:
|
6
|
-
standard: config/base.yml
|
7
|
-
|
8
|
-
AllCops:
|
9
|
-
Exclude:
|
10
|
-
- 'bin/*'
|
11
|
-
- 'tmp/**/*'
|
12
|
-
- 'Gemfile'
|
13
|
-
- 'vendor/**/*'
|
14
|
-
- 'gemfiles/**/*'
|
15
|
-
DisplayCopNames: true
|
16
|
-
|
17
|
-
Standard/SemanticBlocks:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/TrailingCommaInArrayLiteral:
|
21
|
-
EnforcedStyleForMultiline: no_comma
|
22
|
-
|
23
|
-
Style/TrailingCommaInHashLiteral:
|
24
|
-
EnforcedStyleForMultiline: no_comma
|
25
|
-
|
26
|
-
Style/SignalException:
|
27
|
-
Enabled: true
|
28
|
-
|
29
|
-
Style/FrozenStringLiteralComment:
|
30
|
-
Enabled: true
|
31
|
-
|
32
|
-
RSpec/Focus:
|
33
|
-
Enabled: true
|
34
|
-
|
35
|
-
RSpec/EmptyExampleGroup:
|
36
|
-
Enabled: true
|
37
|
-
|
38
|
-
RSpec/EmptyLineAfterExampleGroup:
|
39
|
-
Enabled: true
|
40
|
-
|
41
|
-
RSpec/EmptyLineAfterFinalLet:
|
42
|
-
Enabled: true
|
43
|
-
|
44
|
-
RSpec/EmptyLineAfterHook:
|
45
|
-
Enabled: true
|
46
|
-
|
47
|
-
RSpec/EmptyLineAfterSubject:
|
48
|
-
Enabled: true
|
49
|
-
|
50
|
-
RSpec/HooksBeforeExamples:
|
51
|
-
Enabled: true
|
52
|
-
|
53
|
-
RSpec/ImplicitExpect:
|
54
|
-
Enabled: true
|
55
|
-
|
56
|
-
RSpec/IteratedExpectation:
|
57
|
-
Enabled: true
|
58
|
-
|
59
|
-
RSpec/LetBeforeExamples:
|
60
|
-
Enabled: true
|
61
|
-
|
62
|
-
RSpec/MissingExampleGroupArgument:
|
63
|
-
Enabled: true
|
64
|
-
|
65
|
-
RSpec/ReceiveCounts:
|
66
|
-
Enabled: true
|
data/.travis.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.6.0
|
6
|
-
|
7
|
-
notifications:
|
8
|
-
email: false
|
9
|
-
|
10
|
-
before_install:
|
11
|
-
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
12
|
-
- gem install bundler -v '< 2'
|
13
|
-
|
14
|
-
matrix:
|
15
|
-
fast_finish: true
|
16
|
-
include:
|
17
|
-
- rvm: ruby-head
|
18
|
-
gemfile: gemfiles/railsmaster.gemfile
|
19
|
-
- rvm: 2.6.1
|
20
|
-
gemfile: gemfiles/rails6.gemfile
|
21
|
-
- rvm: 2.6.0
|
22
|
-
gemfile: gemfiles/rails52.gemfile
|
23
|
-
- rvm: 2.5.1
|
24
|
-
gemfile: gemfiles/rails42.gemfile
|
25
|
-
allow_failures:
|
26
|
-
- rvm: ruby-head
|
27
|
-
gemfile: gemfiles/railsmaster.gemfile
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in rubanok.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "pry-byebug", platform: :mri
|
7
|
-
gem "simplecov"
|
8
|
-
|
9
|
-
local_gemfile = 'Gemfile.local'
|
10
|
-
|
11
|
-
if File.exist?(local_gemfile)
|
12
|
-
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
|
13
|
-
end
|
data/Gemfile.local
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
data/bin/setup
DELETED
data/gemfiles/rails42.gemfile
DELETED
data/gemfiles/rails52.gemfile
DELETED
data/gemfiles/rails6.gemfile
DELETED
data/rubanok.gemspec
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "rubanok/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "rubanok"
|
9
|
-
spec.version = Rubanok::VERSION
|
10
|
-
spec.authors = ["Vladimir Dementyev"]
|
11
|
-
spec.email = ["dementiev.vm@gmail.com"]
|
12
|
-
|
13
|
-
spec.summary = "Parameters-based transformation DSL"
|
14
|
-
spec.description = "Parameters-based transformation DSL"
|
15
|
-
spec.homepage = "https://github.com/palkan/rubanok"
|
16
|
-
spec.license = "MIT"
|
17
|
-
spec.required_ruby_version = ">= 2.5.0"
|
18
|
-
|
19
|
-
# Specify which files should be added to the gem when it is released.
|
20
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
-
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
22
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
-
end
|
24
|
-
|
25
|
-
spec.metadata = {
|
26
|
-
"bug_tracker_uri" => "http://github.com/palkan/rubanok/issues",
|
27
|
-
"changelog_uri" => "https://github.com/palkan/rubanok/blob/master/CHANGELOG.md",
|
28
|
-
"documentation_uri" => "http://github.com/palkan/rubanok",
|
29
|
-
"homepage_uri" => "http://github.com/palkan/rubanok",
|
30
|
-
"source_code_uri" => "http://github.com/palkan/rubanok"
|
31
|
-
}
|
32
|
-
|
33
|
-
spec.require_paths = ["lib"]
|
34
|
-
|
35
|
-
spec.add_development_dependency "actionpack", ">= 4.2"
|
36
|
-
spec.add_development_dependency "actionview", ">= 4.2"
|
37
|
-
spec.add_development_dependency "bundler", ">= 1.16"
|
38
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
-
spec.add_development_dependency "rspec-rails"
|
41
|
-
spec.add_development_dependency "rubocop-rspec"
|
42
|
-
spec.add_development_dependency "standard", "~> 0.0.39"
|
43
|
-
end
|