lite-query 1.0.3 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +22 -5
- data/.travis.yml +1 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +70 -65
- data/README.md +11 -9
- data/lib/generators/rails/query_generator.rb +0 -3
- data/lib/generators/rails/templates/query.rb.tt +3 -1
- data/lib/lite/query.rb +1 -5
- data/lib/lite/query/base.rb +2 -2
- data/lib/lite/query/version.rb +1 -1
- metadata +7 -13
- data/lib/generators/lite/query/install_generator.rb +0 -17
- data/lib/generators/lite/query/templates/install.rb +0 -4
- data/lib/generators/rspec/query_generator.rb +0 -29
- data/lib/generators/rspec/templates/query_spec.rb.tt +0 -5
- data/lib/generators/test_unit/query_generator.rb +0 -30
- data/lib/generators/test_unit/templates/query_test.rb.tt +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8efa1386163797719fc226d9794aae00ec243cbe512e50e5fde9014492517a4
|
4
|
+
data.tar.gz: 965575bd2be3941a81c15b9484764f3de32c414a7924e5160fc61daa0c2ddc84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c156e5a7d45c7e3a1e57425248e938bd579054c8f05eead18735e546dbea06f87c4fcb153761e2e75ce0d4016ca377e6e4942f25e4721cf407be173f1ba813c
|
7
|
+
data.tar.gz: d595f46fff00828f0709c0d7c0c5d9243a7dff4f9a5b72ce025482651603b41fca9e12e18b0bc2846191a56d0364fe75f6f1bb3d42863692f7acd16e1dddcf96
|
data/.rubocop.yml
CHANGED
@@ -2,11 +2,12 @@ require:
|
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
6
7
|
DisplayCopNames: true
|
7
8
|
DisplayStyleGuide: true
|
8
|
-
|
9
|
-
|
9
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
10
|
+
Enabled: true
|
10
11
|
Layout/EmptyLinesAroundBlockBody:
|
11
12
|
Exclude:
|
12
13
|
- 'spec/**/**/*'
|
@@ -14,6 +15,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
14
15
|
EnforcedStyle: empty_lines_except_namespace
|
15
16
|
Layout/EmptyLinesAroundModuleBody:
|
16
17
|
EnforcedStyle: empty_lines_except_namespace
|
18
|
+
Layout/LineLength:
|
19
|
+
Max: 100
|
20
|
+
Layout/SpaceAroundMethodCallOperator:
|
21
|
+
Enabled: true
|
22
|
+
Lint/RaiseException:
|
23
|
+
Enabled: true
|
24
|
+
Lint/StructNewOverride:
|
25
|
+
Enabled: true
|
17
26
|
Metrics/BlockLength:
|
18
27
|
Exclude:
|
19
28
|
- 'spec/**/**/*'
|
@@ -22,11 +31,19 @@ Naming/MemoizedInstanceVariableName:
|
|
22
31
|
Enabled: false
|
23
32
|
RSpec/ExampleLength:
|
24
33
|
Enabled: false
|
25
|
-
RSpec/FilePath:
|
26
|
-
Enabled: false
|
27
34
|
RSpec/MultipleExpectations:
|
28
35
|
Enabled: false
|
29
36
|
Style/Documentation:
|
30
37
|
Enabled: false
|
31
38
|
Style/ExpandPathArguments:
|
32
39
|
Enabled: false
|
40
|
+
Style/ExponentialNotation:
|
41
|
+
Enabled: true
|
42
|
+
Style/HashEachMethods:
|
43
|
+
Enabled: true
|
44
|
+
Style/HashTransformKeys:
|
45
|
+
Enabled: true
|
46
|
+
Style/HashTransformValues:
|
47
|
+
Enabled: true
|
48
|
+
Style/SlicingWithRange:
|
49
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.0.8] - 2020-07-03
|
10
|
+
### Removed
|
11
|
+
- Removed Ruby 2.7 deprecation warnings
|
12
|
+
|
13
|
+
## [1.0.7] - 2019-12-21
|
14
|
+
### Removed
|
15
|
+
- Removed generator empty directory check
|
16
|
+
|
17
|
+
## [1.0.6] - 2019-12-20
|
18
|
+
### Removed
|
19
|
+
- Removed lite-query generator
|
20
|
+
- Removed spec from rails generator
|
21
|
+
|
22
|
+
## [1.0.5] - 2019-09-02
|
23
|
+
### Changed
|
24
|
+
- Changed generator syntax
|
25
|
+
|
26
|
+
## [1.0.4] - 2019-09-02
|
27
|
+
### Changed
|
28
|
+
- Changed generator syntax
|
29
|
+
|
9
30
|
## [1.0.3] - 2019-09-02
|
10
31
|
### Changed
|
11
32
|
- Changed generator syntax
|
data/Gemfile.lock
CHANGED
@@ -1,114 +1,119 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-query (1.0.
|
4
|
+
lite-query (1.0.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (6.0.
|
10
|
-
actionview (= 6.0.
|
11
|
-
activesupport (= 6.0.
|
12
|
-
rack (~> 2.0)
|
9
|
+
actionpack (6.0.3.2)
|
10
|
+
actionview (= 6.0.3.2)
|
11
|
+
activesupport (= 6.0.3.2)
|
12
|
+
rack (~> 2.0, >= 2.0.8)
|
13
13
|
rack-test (>= 0.6.3)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
16
|
-
actionview (6.0.
|
17
|
-
activesupport (= 6.0.
|
16
|
+
actionview (6.0.3.2)
|
17
|
+
activesupport (= 6.0.3.2)
|
18
18
|
builder (~> 3.1)
|
19
19
|
erubi (~> 1.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
21
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
22
|
-
activemodel (6.0.
|
23
|
-
activesupport (= 6.0.
|
24
|
-
activerecord (6.0.
|
25
|
-
activemodel (= 6.0.
|
26
|
-
activesupport (= 6.0.
|
27
|
-
activesupport (6.0.
|
22
|
+
activemodel (6.0.3.2)
|
23
|
+
activesupport (= 6.0.3.2)
|
24
|
+
activerecord (6.0.3.2)
|
25
|
+
activemodel (= 6.0.3.2)
|
26
|
+
activesupport (= 6.0.3.2)
|
27
|
+
activesupport (6.0.3.2)
|
28
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
29
29
|
i18n (>= 0.7, < 2)
|
30
30
|
minitest (~> 5.1)
|
31
31
|
tzinfo (~> 1.1)
|
32
|
-
zeitwerk (~> 2.
|
33
|
-
ast (2.4.
|
34
|
-
builder (3.2.
|
32
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
33
|
+
ast (2.4.1)
|
34
|
+
builder (3.2.4)
|
35
35
|
colorize (0.8.1)
|
36
|
-
concurrent-ruby (1.1.
|
37
|
-
crass (1.0.
|
38
|
-
database_cleaner (1.
|
39
|
-
diff-lcs (1.
|
40
|
-
erubi (1.
|
41
|
-
fasterer (0.
|
36
|
+
concurrent-ruby (1.1.6)
|
37
|
+
crass (1.0.6)
|
38
|
+
database_cleaner (1.8.5)
|
39
|
+
diff-lcs (1.4.4)
|
40
|
+
erubi (1.9.0)
|
41
|
+
fasterer (0.8.3)
|
42
42
|
colorize (~> 0.7)
|
43
|
-
ruby_parser (>= 3.
|
43
|
+
ruby_parser (>= 3.14.1)
|
44
44
|
generator_spec (0.9.4)
|
45
45
|
activesupport (>= 3.0.0)
|
46
46
|
railties (>= 3.0.0)
|
47
|
-
i18n (1.
|
47
|
+
i18n (1.8.3)
|
48
48
|
concurrent-ruby (~> 1.0)
|
49
|
-
|
50
|
-
loofah (2.2.3)
|
49
|
+
loofah (2.6.0)
|
51
50
|
crass (~> 1.0.2)
|
52
51
|
nokogiri (>= 1.5.9)
|
53
|
-
method_source (0.
|
52
|
+
method_source (1.0.0)
|
54
53
|
mini_portile2 (2.4.0)
|
55
|
-
minitest (5.
|
56
|
-
nokogiri (1.10.
|
54
|
+
minitest (5.14.1)
|
55
|
+
nokogiri (1.10.9)
|
57
56
|
mini_portile2 (~> 2.4.0)
|
58
|
-
parallel (1.
|
59
|
-
parser (2.
|
60
|
-
ast (~> 2.4.
|
61
|
-
rack (2.
|
57
|
+
parallel (1.19.2)
|
58
|
+
parser (2.7.1.4)
|
59
|
+
ast (~> 2.4.1)
|
60
|
+
rack (2.2.3)
|
62
61
|
rack-test (1.1.0)
|
63
62
|
rack (>= 1.0, < 3)
|
64
63
|
rails-dom-testing (2.0.3)
|
65
64
|
activesupport (>= 4.2.0)
|
66
65
|
nokogiri (>= 1.6)
|
67
|
-
rails-html-sanitizer (1.
|
68
|
-
loofah (~> 2.
|
69
|
-
railties (6.0.
|
70
|
-
actionpack (= 6.0.
|
71
|
-
activesupport (= 6.0.
|
66
|
+
rails-html-sanitizer (1.3.0)
|
67
|
+
loofah (~> 2.3)
|
68
|
+
railties (6.0.3.2)
|
69
|
+
actionpack (= 6.0.3.2)
|
70
|
+
activesupport (= 6.0.3.2)
|
72
71
|
method_source
|
73
72
|
rake (>= 0.8.7)
|
74
73
|
thor (>= 0.20.3, < 2.0)
|
75
74
|
rainbow (3.0.0)
|
76
|
-
rake (
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
rspec-
|
81
|
-
|
82
|
-
rspec-
|
83
|
-
rspec-
|
75
|
+
rake (13.0.1)
|
76
|
+
regexp_parser (1.7.1)
|
77
|
+
rexml (3.2.4)
|
78
|
+
rspec (3.9.0)
|
79
|
+
rspec-core (~> 3.9.0)
|
80
|
+
rspec-expectations (~> 3.9.0)
|
81
|
+
rspec-mocks (~> 3.9.0)
|
82
|
+
rspec-core (3.9.2)
|
83
|
+
rspec-support (~> 3.9.3)
|
84
|
+
rspec-expectations (3.9.2)
|
84
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-mocks (3.
|
86
|
+
rspec-support (~> 3.9.0)
|
87
|
+
rspec-mocks (3.9.1)
|
87
88
|
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
-
rspec-support (~> 3.
|
89
|
-
rspec-support (3.
|
90
|
-
rubocop (0.
|
91
|
-
jaro_winkler (~> 1.5.1)
|
89
|
+
rspec-support (~> 3.9.0)
|
90
|
+
rspec-support (3.9.3)
|
91
|
+
rubocop (0.86.0)
|
92
92
|
parallel (~> 1.10)
|
93
|
-
parser (>= 2.
|
93
|
+
parser (>= 2.7.0.1)
|
94
94
|
rainbow (>= 2.2.2, < 4.0)
|
95
|
+
regexp_parser (>= 1.7)
|
96
|
+
rexml
|
97
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
95
98
|
ruby-progressbar (~> 1.7)
|
96
|
-
unicode-display_width (>= 1.4.0, <
|
97
|
-
rubocop-
|
99
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
100
|
+
rubocop-ast (0.1.0)
|
101
|
+
parser (>= 2.7.0.1)
|
102
|
+
rubocop-performance (1.6.1)
|
98
103
|
rubocop (>= 0.71.0)
|
99
|
-
rubocop-rspec (1.
|
100
|
-
rubocop (>= 0.
|
104
|
+
rubocop-rspec (1.41.0)
|
105
|
+
rubocop (>= 0.68.1)
|
101
106
|
ruby-progressbar (1.10.1)
|
102
|
-
ruby_parser (3.
|
107
|
+
ruby_parser (3.14.2)
|
103
108
|
sexp_processor (~> 4.9)
|
104
|
-
sexp_processor (4.
|
105
|
-
sqlite3 (1.4.
|
106
|
-
thor (0.
|
109
|
+
sexp_processor (4.15.0)
|
110
|
+
sqlite3 (1.4.2)
|
111
|
+
thor (1.0.1)
|
107
112
|
thread_safe (0.3.6)
|
108
|
-
tzinfo (1.2.
|
113
|
+
tzinfo (1.2.7)
|
109
114
|
thread_safe (~> 0.1)
|
110
|
-
unicode-display_width (1.
|
111
|
-
zeitwerk (2.1
|
115
|
+
unicode-display_width (1.7.0)
|
116
|
+
zeitwerk (2.3.1)
|
112
117
|
|
113
118
|
PLATFORMS
|
114
119
|
ruby
|
@@ -128,4 +133,4 @@ DEPENDENCIES
|
|
128
133
|
sqlite3
|
129
134
|
|
130
135
|
BUNDLED WITH
|
131
|
-
2.
|
136
|
+
2.1.4
|
data/README.md
CHANGED
@@ -29,24 +29,26 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
## Setup
|
31
31
|
|
32
|
-
|
33
|
-
`../app/queries/application_query.rb`
|
32
|
+
### Generators
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
Use `rails g query NAME` will generate the following files:
|
35
|
+
|
36
|
+
```erb
|
37
|
+
app/queries/[name]_query.rb
|
38
38
|
```
|
39
39
|
|
40
|
-
|
40
|
+
If a `ApplicationQuery` file in the `app/queries` directory is available, the
|
41
|
+
generator will create file that inherit from `ApplicationQuery` if not it will
|
42
|
+
fallback to `Lite::Query::Base`.
|
41
43
|
|
42
|
-
|
44
|
+
### Query
|
43
45
|
|
44
|
-
You will
|
46
|
+
You will need to fill this class with the required `execute` method as shown below:
|
45
47
|
|
46
48
|
```ruby
|
47
49
|
class AgeQuery < ApplicationQuery
|
48
50
|
|
49
|
-
# NOTE:
|
51
|
+
# NOTE: This instance method is required
|
50
52
|
def execute
|
51
53
|
return relation unless args[:age]
|
52
54
|
|
data/lib/lite/query.rb
CHANGED
data/lib/lite/query/base.rb
CHANGED
@@ -9,14 +9,14 @@ module Lite
|
|
9
9
|
|
10
10
|
class << self
|
11
11
|
|
12
|
-
def call(relation = nil,
|
12
|
+
def call(relation = nil, args = {})
|
13
13
|
klass = new(relation, args)
|
14
14
|
klass.call
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize(relation = nil,
|
19
|
+
def initialize(relation = nil, args = {})
|
20
20
|
@relation = relation || default_relation
|
21
21
|
@args = args
|
22
22
|
end
|
data/lib/lite/query/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
description:
|
167
|
+
description:
|
168
168
|
email:
|
169
169
|
- j.gomez@drexed.com
|
170
170
|
executables: []
|
@@ -186,15 +186,9 @@ files:
|
|
186
186
|
- _config.yml
|
187
187
|
- bin/console
|
188
188
|
- bin/setup
|
189
|
-
- lib/generators/lite/query/install_generator.rb
|
190
|
-
- lib/generators/lite/query/templates/install.rb
|
191
189
|
- lib/generators/rails/USAGE
|
192
190
|
- lib/generators/rails/query_generator.rb
|
193
191
|
- lib/generators/rails/templates/query.rb.tt
|
194
|
-
- lib/generators/rspec/query_generator.rb
|
195
|
-
- lib/generators/rspec/templates/query_spec.rb.tt
|
196
|
-
- lib/generators/test_unit/query_generator.rb
|
197
|
-
- lib/generators/test_unit/templates/query_test.rb.tt
|
198
192
|
- lib/lite/query.rb
|
199
193
|
- lib/lite/query/base.rb
|
200
194
|
- lib/lite/query/exceptions.rb
|
@@ -204,7 +198,7 @@ homepage: http://drexed.github.io/lite-query
|
|
204
198
|
licenses:
|
205
199
|
- MIT
|
206
200
|
metadata: {}
|
207
|
-
post_install_message:
|
201
|
+
post_install_message:
|
208
202
|
rdoc_options: []
|
209
203
|
require_paths:
|
210
204
|
- lib
|
@@ -219,8 +213,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
213
|
- !ruby/object:Gem::Version
|
220
214
|
version: '0'
|
221
215
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
223
|
-
signing_key:
|
216
|
+
rubygems_version: 3.1.4
|
217
|
+
signing_key:
|
224
218
|
specification_version: 4
|
225
219
|
summary: Ruby Query based framework (aka query objects)
|
226
220
|
test_files: []
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module Lite
|
6
|
-
module Query
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
8
|
-
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
10
|
-
|
11
|
-
def copy_application_query_file
|
12
|
-
copy_file('install.rb', 'app/queries/application_query.rb')
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module Rspec
|
6
|
-
module Generators
|
7
|
-
class QueryGenerator < Rails::Generators::NamedBase
|
8
|
-
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
10
|
-
|
11
|
-
def copy_files
|
12
|
-
path = File.join('spec', 'queries', class_path, "#{file_name}_query_spec.rb")
|
13
|
-
empty_directory('spec/queries')
|
14
|
-
template('query_spec.rb.tt', path)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def file_name
|
20
|
-
@_file_name ||= remove_possible_suffix(super)
|
21
|
-
end
|
22
|
-
|
23
|
-
def remove_possible_suffix(name)
|
24
|
-
name.sub(/_?query$/i, '')
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module TestUnit
|
6
|
-
module Generators
|
7
|
-
class QueryGenerator < Rails::Generators::NamedBase
|
8
|
-
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
10
|
-
check_class_collision suffix: 'QueryTest'
|
11
|
-
|
12
|
-
def copy_files
|
13
|
-
path = File.join('test', 'queries', class_path, "#{file_name}_query_test.rb")
|
14
|
-
empty_directory('test/queries')
|
15
|
-
template('query_test.rb.tt', path)
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def file_name
|
21
|
-
@_file_name ||= remove_possible_suffix(super)
|
22
|
-
end
|
23
|
-
|
24
|
-
def remove_possible_suffix(name)
|
25
|
-
name.sub(/_?query$/i, '')
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|