lite-query 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -5
- data/.travis.yml +1 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +93 -77
- data/README.md +12 -8
- data/lib/generators/rails/query_generator.rb +0 -7
- data/lib/generators/rails/templates/query.rb.tt +1 -1
- data/lib/lite/query.rb +0 -1
- data/lib/lite/query/base.rb +2 -2
- data/lib/lite/query/version.rb +1 -1
- data/lite-query.gemspec +2 -1
- metadata +21 -10
- data/lib/generators/lite/query/install_generator.rb +0 -17
- data/lib/generators/lite/query/templates/install.rb +0 -4
- data/lib/generators/rails/templates/spec.rb.tt +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f2835fd2e7eb71fe7e803340066fd45a583fa0f166ec076b191ee5995fe385
|
4
|
+
data.tar.gz: 96e47feaacb92baa6ea11aff0143b619a0b0a423e1df9cc84c20217312334e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ba41ce1c43e94f248e6e171cc5b4d7cd3003f98bf1e439579570ac07e513a0c592b34fbc6995948a5c4a197cce2040e11c03dc1a4268bee1f7f9daae067185f
|
7
|
+
data.tar.gz: a603bb1729f80ef471f2063b738591cb6f8c63618e752efc15a00780e9a112161e0d91c07a649b66bcbc274f1db9a04076dcf6a11bfde819bed1310bbdc5440c
|
data/.rubocop.yml
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-performance
|
3
|
+
- rubocop-rake
|
3
4
|
- rubocop-rspec
|
4
5
|
AllCops:
|
5
|
-
TargetRubyVersion:
|
6
|
+
TargetRubyVersion: 3.0
|
7
|
+
NewCops: enable
|
6
8
|
DisplayCopNames: true
|
7
9
|
DisplayStyleGuide: true
|
8
|
-
|
9
|
-
|
10
|
+
Gemspec/RequiredRubyVersion:
|
11
|
+
Enabled: false
|
12
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
13
|
+
Enabled: true
|
10
14
|
Layout/EmptyLinesAroundBlockBody:
|
11
15
|
Exclude:
|
12
16
|
- 'spec/**/**/*'
|
@@ -14,6 +18,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
14
18
|
EnforcedStyle: empty_lines_except_namespace
|
15
19
|
Layout/EmptyLinesAroundModuleBody:
|
16
20
|
EnforcedStyle: empty_lines_except_namespace
|
21
|
+
Layout/LineLength:
|
22
|
+
Max: 100
|
23
|
+
Layout/SpaceAroundMethodCallOperator:
|
24
|
+
Enabled: true
|
25
|
+
Lint/RaiseException:
|
26
|
+
Enabled: true
|
27
|
+
Lint/StructNewOverride:
|
28
|
+
Enabled: true
|
17
29
|
Metrics/BlockLength:
|
18
30
|
Exclude:
|
19
31
|
- 'spec/**/**/*'
|
@@ -22,10 +34,10 @@ Naming/MemoizedInstanceVariableName:
|
|
22
34
|
Enabled: false
|
23
35
|
RSpec/ExampleLength:
|
24
36
|
Enabled: false
|
25
|
-
RSpec/FilePath:
|
26
|
-
Enabled: false
|
27
37
|
RSpec/MultipleExpectations:
|
28
38
|
Enabled: false
|
39
|
+
Style/ArgumentsForwarding:
|
40
|
+
Enabled: false
|
29
41
|
Style/Documentation:
|
30
42
|
Enabled: false
|
31
43
|
Style/ExpandPathArguments:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.1.0] - 2021-07-19
|
10
|
+
### Added
|
11
|
+
- Added Ruby 3.0 support
|
12
|
+
|
13
|
+
## [1.0.8] - 2020-07-03
|
14
|
+
### Added
|
15
|
+
- Added Ruby 2.7 support
|
16
|
+
|
17
|
+
## [1.0.7] - 2019-12-21
|
18
|
+
### Removed
|
19
|
+
- Removed generator empty directory check
|
20
|
+
|
21
|
+
## [1.0.6] - 2019-12-20
|
22
|
+
### Removed
|
23
|
+
- Removed lite-query generator
|
24
|
+
- Removed spec from rails generator
|
25
|
+
|
9
26
|
## [1.0.5] - 2019-09-02
|
10
27
|
### Changed
|
11
28
|
- Changed generator syntax
|
data/Gemfile.lock
CHANGED
@@ -1,114 +1,129 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-query (1.0
|
4
|
+
lite-query (1.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (6.
|
10
|
-
actionview (= 6.
|
11
|
-
activesupport (= 6.
|
12
|
-
rack (~> 2.0)
|
9
|
+
actionpack (6.1.4)
|
10
|
+
actionview (= 6.1.4)
|
11
|
+
activesupport (= 6.1.4)
|
12
|
+
rack (~> 2.0, >= 2.0.9)
|
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.
|
17
|
-
activesupport (= 6.
|
16
|
+
actionview (6.1.4)
|
17
|
+
activesupport (= 6.1.4)
|
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.
|
23
|
-
activesupport (= 6.
|
24
|
-
activerecord (6.
|
25
|
-
activemodel (= 6.
|
26
|
-
activesupport (= 6.
|
27
|
-
activesupport (6.
|
22
|
+
activemodel (6.1.4)
|
23
|
+
activesupport (= 6.1.4)
|
24
|
+
activerecord (6.1.4)
|
25
|
+
activemodel (= 6.1.4)
|
26
|
+
activesupport (= 6.1.4)
|
27
|
+
activesupport (6.1.4)
|
28
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
29
|
-
i18n (>=
|
30
|
-
minitest (
|
31
|
-
tzinfo (~>
|
32
|
-
zeitwerk (~> 2.
|
33
|
-
ast (2.4.
|
34
|
-
builder (3.2.
|
29
|
+
i18n (>= 1.6, < 2)
|
30
|
+
minitest (>= 5.1)
|
31
|
+
tzinfo (~> 2.0)
|
32
|
+
zeitwerk (~> 2.3)
|
33
|
+
ast (2.4.2)
|
34
|
+
builder (3.2.4)
|
35
35
|
colorize (0.8.1)
|
36
|
-
concurrent-ruby (1.1.
|
37
|
-
crass (1.0.
|
38
|
-
database_cleaner (
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
concurrent-ruby (1.1.9)
|
37
|
+
crass (1.0.6)
|
38
|
+
database_cleaner (2.0.1)
|
39
|
+
database_cleaner-active_record (~> 2.0.0)
|
40
|
+
database_cleaner-active_record (2.0.1)
|
41
|
+
activerecord (>= 5.a)
|
42
|
+
database_cleaner-core (~> 2.0.0)
|
43
|
+
database_cleaner-core (2.0.1)
|
44
|
+
diff-lcs (1.4.4)
|
45
|
+
erubi (1.10.0)
|
46
|
+
fasterer (0.9.0)
|
42
47
|
colorize (~> 0.7)
|
43
|
-
ruby_parser (>= 3.
|
48
|
+
ruby_parser (>= 3.14.1)
|
44
49
|
generator_spec (0.9.4)
|
45
50
|
activesupport (>= 3.0.0)
|
46
51
|
railties (>= 3.0.0)
|
47
|
-
i18n (1.
|
52
|
+
i18n (1.8.10)
|
48
53
|
concurrent-ruby (~> 1.0)
|
49
|
-
|
50
|
-
loofah (2.2.3)
|
54
|
+
loofah (2.10.0)
|
51
55
|
crass (~> 1.0.2)
|
52
56
|
nokogiri (>= 1.5.9)
|
53
|
-
method_source (0.
|
54
|
-
mini_portile2 (2.
|
55
|
-
minitest (5.
|
56
|
-
nokogiri (1.
|
57
|
-
mini_portile2 (~> 2.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
method_source (1.0.0)
|
58
|
+
mini_portile2 (2.5.3)
|
59
|
+
minitest (5.14.4)
|
60
|
+
nokogiri (1.11.7)
|
61
|
+
mini_portile2 (~> 2.5.0)
|
62
|
+
racc (~> 1.4)
|
63
|
+
parallel (1.20.1)
|
64
|
+
parser (3.0.2.0)
|
65
|
+
ast (~> 2.4.1)
|
66
|
+
racc (1.5.2)
|
67
|
+
rack (2.2.3)
|
62
68
|
rack-test (1.1.0)
|
63
69
|
rack (>= 1.0, < 3)
|
64
70
|
rails-dom-testing (2.0.3)
|
65
71
|
activesupport (>= 4.2.0)
|
66
72
|
nokogiri (>= 1.6)
|
67
|
-
rails-html-sanitizer (1.
|
68
|
-
loofah (~> 2.
|
69
|
-
railties (6.
|
70
|
-
actionpack (= 6.
|
71
|
-
activesupport (= 6.
|
73
|
+
rails-html-sanitizer (1.3.0)
|
74
|
+
loofah (~> 2.3)
|
75
|
+
railties (6.1.4)
|
76
|
+
actionpack (= 6.1.4)
|
77
|
+
activesupport (= 6.1.4)
|
72
78
|
method_source
|
73
|
-
rake (>= 0.
|
74
|
-
thor (
|
79
|
+
rake (>= 0.13)
|
80
|
+
thor (~> 1.0)
|
75
81
|
rainbow (3.0.0)
|
76
|
-
rake (
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
rspec-
|
81
|
-
|
82
|
-
rspec-
|
83
|
-
rspec-
|
82
|
+
rake (13.0.6)
|
83
|
+
regexp_parser (2.1.1)
|
84
|
+
rexml (3.2.5)
|
85
|
+
rspec (3.10.0)
|
86
|
+
rspec-core (~> 3.10.0)
|
87
|
+
rspec-expectations (~> 3.10.0)
|
88
|
+
rspec-mocks (~> 3.10.0)
|
89
|
+
rspec-core (3.10.1)
|
90
|
+
rspec-support (~> 3.10.0)
|
91
|
+
rspec-expectations (3.10.1)
|
84
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-mocks (3.
|
93
|
+
rspec-support (~> 3.10.0)
|
94
|
+
rspec-mocks (3.10.2)
|
87
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
-
rspec-support (~> 3.
|
89
|
-
rspec-support (3.
|
90
|
-
rubocop (
|
91
|
-
jaro_winkler (~> 1.5.1)
|
96
|
+
rspec-support (~> 3.10.0)
|
97
|
+
rspec-support (3.10.2)
|
98
|
+
rubocop (1.18.3)
|
92
99
|
parallel (~> 1.10)
|
93
|
-
parser (>=
|
100
|
+
parser (>= 3.0.0.0)
|
94
101
|
rainbow (>= 2.2.2, < 4.0)
|
102
|
+
regexp_parser (>= 1.8, < 3.0)
|
103
|
+
rexml
|
104
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
95
105
|
ruby-progressbar (~> 1.7)
|
96
|
-
unicode-display_width (>= 1.4.0, <
|
97
|
-
rubocop-
|
98
|
-
|
99
|
-
rubocop-
|
100
|
-
rubocop (>=
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
107
|
+
rubocop-ast (1.8.0)
|
108
|
+
parser (>= 3.0.1.1)
|
109
|
+
rubocop-performance (1.11.4)
|
110
|
+
rubocop (>= 1.7.0, < 2.0)
|
111
|
+
rubocop-ast (>= 0.4.0)
|
112
|
+
rubocop-rake (0.6.0)
|
113
|
+
rubocop (~> 1.0)
|
114
|
+
rubocop-rspec (2.4.0)
|
115
|
+
rubocop (~> 1.0)
|
116
|
+
rubocop-ast (>= 1.1.0)
|
117
|
+
ruby-progressbar (1.11.0)
|
118
|
+
ruby_parser (3.16.0)
|
119
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
120
|
+
sexp_processor (4.15.3)
|
121
|
+
sqlite3 (1.4.2)
|
122
|
+
thor (1.1.0)
|
123
|
+
tzinfo (2.0.4)
|
124
|
+
concurrent-ruby (~> 1.0)
|
125
|
+
unicode-display_width (2.0.0)
|
126
|
+
zeitwerk (2.4.2)
|
112
127
|
|
113
128
|
PLATFORMS
|
114
129
|
ruby
|
@@ -124,8 +139,9 @@ DEPENDENCIES
|
|
124
139
|
rspec
|
125
140
|
rubocop
|
126
141
|
rubocop-performance
|
142
|
+
rubocop-rake
|
127
143
|
rubocop-rspec
|
128
144
|
sqlite3
|
129
145
|
|
130
146
|
BUNDLED WITH
|
131
|
-
2.
|
147
|
+
2.2.24
|
data/README.md
CHANGED
@@ -29,22 +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`.
|
43
|
+
|
44
|
+
### Query
|
41
45
|
|
42
|
-
You will
|
46
|
+
You will need to fill this class with the required `execute` method as shown below:
|
43
47
|
|
44
48
|
```ruby
|
45
49
|
class AgeQuery < ApplicationQuery
|
46
50
|
|
47
|
-
# NOTE:
|
51
|
+
# NOTE: This instance method is required
|
48
52
|
def execute
|
49
53
|
return relation unless args[:age]
|
50
54
|
|
@@ -10,16 +10,9 @@ module Rails
|
|
10
10
|
|
11
11
|
def copy_files
|
12
12
|
path = File.join('app', 'queries', class_path, "#{file_name}_query.rb")
|
13
|
-
empty_directory('app/queries')
|
14
13
|
template('query.rb.tt', path)
|
15
14
|
end
|
16
15
|
|
17
|
-
def copy_specs
|
18
|
-
path = File.join('spec', 'queries', class_path, "#{file_name}_query_spec.rb")
|
19
|
-
empty_directory('spec/queries')
|
20
|
-
template('spec.rb.tt', path)
|
21
|
-
end
|
22
|
-
|
23
16
|
private
|
24
17
|
|
25
18
|
def file_name
|
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
data/lite-query.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
)
|
26
26
|
else
|
27
27
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
28
|
-
|
28
|
+
'public gem pushes.'
|
29
29
|
end
|
30
30
|
|
31
31
|
# Specify which files should be added to the gem when it is released.
|
@@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency 'rspec'
|
47
47
|
spec.add_development_dependency 'rubocop'
|
48
48
|
spec.add_development_dependency 'rubocop-performance'
|
49
|
+
spec.add_development_dependency 'rubocop-rake'
|
49
50
|
spec.add_development_dependency 'rubocop-rspec'
|
50
51
|
spec.add_development_dependency 'sqlite3'
|
51
52
|
end
|
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.1.0
|
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: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rubocop-rspec
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +178,7 @@ dependencies:
|
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
|
-
description:
|
181
|
+
description:
|
168
182
|
email:
|
169
183
|
- j.gomez@drexed.com
|
170
184
|
executables: []
|
@@ -186,12 +200,9 @@ files:
|
|
186
200
|
- _config.yml
|
187
201
|
- bin/console
|
188
202
|
- bin/setup
|
189
|
-
- lib/generators/lite/query/install_generator.rb
|
190
|
-
- lib/generators/lite/query/templates/install.rb
|
191
203
|
- lib/generators/rails/USAGE
|
192
204
|
- lib/generators/rails/query_generator.rb
|
193
205
|
- lib/generators/rails/templates/query.rb.tt
|
194
|
-
- lib/generators/rails/templates/spec.rb.tt
|
195
206
|
- lib/lite/query.rb
|
196
207
|
- lib/lite/query/base.rb
|
197
208
|
- lib/lite/query/exceptions.rb
|
@@ -201,7 +212,7 @@ homepage: http://drexed.github.io/lite-query
|
|
201
212
|
licenses:
|
202
213
|
- MIT
|
203
214
|
metadata: {}
|
204
|
-
post_install_message:
|
215
|
+
post_install_message:
|
205
216
|
rdoc_options: []
|
206
217
|
require_paths:
|
207
218
|
- lib
|
@@ -216,8 +227,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
227
|
- !ruby/object:Gem::Version
|
217
228
|
version: '0'
|
218
229
|
requirements: []
|
219
|
-
rubygems_version: 3.
|
220
|
-
signing_key:
|
230
|
+
rubygems_version: 3.2.24
|
231
|
+
signing_key:
|
221
232
|
specification_version: 4
|
222
233
|
summary: Ruby Query based framework (aka query objects)
|
223
234
|
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
|