lite-query 1.0.3 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd95c4ff3c5191d97c37ab8e737e1c80cf08e9a0708a7c4b351a68a3b5546670
4
- data.tar.gz: ff3ff5c6cf0dfe87a0ae33d2bad88c1974f5ef927dfb393cc5d148cabd1dcae2
3
+ metadata.gz: a8efa1386163797719fc226d9794aae00ec243cbe512e50e5fde9014492517a4
4
+ data.tar.gz: 965575bd2be3941a81c15b9484764f3de32c414a7924e5160fc61daa0c2ddc84
5
5
  SHA512:
6
- metadata.gz: dab3b35c73b7394fd180793eec7b5d288004d5d46e065cb8977be66fe8e50d6d2abec4f1ec002d0a76a0cf42fc3676576497957f54feb797447f491afca174a5
7
- data.tar.gz: 186610afe7add973513ef975e999a77fa108d94dbb87db5b2ad627701686e13e63cd88bf4682d94af478fc821d66ff8492a0415a3758cd9fd93d1fb8dff664b2
6
+ metadata.gz: 6c156e5a7d45c7e3a1e57425248e938bd579054c8f05eead18735e546dbea06f87c4fcb153761e2e75ce0d4016ca377e6e4942f25e4721cf407be173f1ba813c
7
+ data.tar.gz: d595f46fff00828f0709c0d7c0c5d9243a7dff4f9a5b72ce025482651603b41fca9e12e18b0bc2846191a56d0364fe75f6f1bb3d42863692f7acd16e1dddcf96
@@ -2,11 +2,12 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
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
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
@@ -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
@@ -1,114 +1,119 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-query (1.0.3)
4
+ lite-query (1.0.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (6.0.0)
10
- actionview (= 6.0.0)
11
- activesupport (= 6.0.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.0)
17
- activesupport (= 6.0.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.0)
23
- activesupport (= 6.0.0)
24
- activerecord (6.0.0)
25
- activemodel (= 6.0.0)
26
- activesupport (= 6.0.0)
27
- activesupport (6.0.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.1, >= 2.1.8)
33
- ast (2.4.0)
34
- builder (3.2.3)
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.5)
37
- crass (1.0.4)
38
- database_cleaner (1.7.0)
39
- diff-lcs (1.3)
40
- erubi (1.8.0)
41
- fasterer (0.6.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.13.0)
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.6.0)
47
+ i18n (1.8.3)
48
48
  concurrent-ruby (~> 1.0)
49
- jaro_winkler (1.5.3)
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.9.2)
52
+ method_source (1.0.0)
54
53
  mini_portile2 (2.4.0)
55
- minitest (5.11.3)
56
- nokogiri (1.10.4)
54
+ minitest (5.14.1)
55
+ nokogiri (1.10.9)
57
56
  mini_portile2 (~> 2.4.0)
58
- parallel (1.17.0)
59
- parser (2.6.4.0)
60
- ast (~> 2.4.0)
61
- rack (2.0.7)
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.2.0)
68
- loofah (~> 2.2, >= 2.2.2)
69
- railties (6.0.0)
70
- actionpack (= 6.0.0)
71
- activesupport (= 6.0.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 (12.3.3)
77
- rspec (3.8.0)
78
- rspec-core (~> 3.8.0)
79
- rspec-expectations (~> 3.8.0)
80
- rspec-mocks (~> 3.8.0)
81
- rspec-core (3.8.2)
82
- rspec-support (~> 3.8.0)
83
- rspec-expectations (3.8.4)
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.8.0)
86
- rspec-mocks (3.8.1)
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.8.0)
89
- rspec-support (3.8.2)
90
- rubocop (0.74.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.6)
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, < 1.7)
97
- rubocop-performance (1.4.1)
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.35.0)
100
- rubocop (>= 0.60.0)
104
+ rubocop-rspec (1.41.0)
105
+ rubocop (>= 0.68.1)
101
106
  ruby-progressbar (1.10.1)
102
- ruby_parser (3.13.1)
107
+ ruby_parser (3.14.2)
103
108
  sexp_processor (~> 4.9)
104
- sexp_processor (4.12.1)
105
- sqlite3 (1.4.1)
106
- thor (0.20.3)
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.5)
113
+ tzinfo (1.2.7)
109
114
  thread_safe (~> 0.1)
110
- unicode-display_width (1.6.0)
111
- zeitwerk (2.1.9)
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.0.1
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
- `rails g lite:query:install` will generate the following file:
33
- `../app/queries/application_query.rb`
32
+ ### Generators
34
33
 
35
- ```ruby
36
- class ApplicationQuery < Lite::Query::Base
37
- end
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
- Use `rails g query NAME` will generate the following file: `../app/queries/[name]_query.rb`
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
- *(This will also add available test framework files if detected)*
44
+ ### Query
43
45
 
44
- You will then need to fill this class with the required `execute` method
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: this method is required
51
+ # NOTE: This instance method is required
50
52
  def execute
51
53
  return relation unless args[:age]
52
54
 
@@ -10,12 +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
- hook_for :test_framework
18
-
19
16
  private
20
17
 
21
18
  def file_name
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  <% module_namespacing do -%>
2
- class <%= class_name %>Query < ApplicationQuery
4
+ class <%= class_name %>Query < <%= ApplicationQuery.to_s rescue 'Lite::Query::Base' %>
3
5
  end
4
6
  <% end -%>
@@ -4,8 +4,4 @@
4
4
  require "lite/query/#{name}"
5
5
  end
6
6
 
7
- require 'generators/lite/query/install_generator'
8
-
9
- %w[rails rspec test_unit].each do |name|
10
- require "generators/#{name}/query_generator"
11
- end
7
+ require 'generators/rails/query_generator'
@@ -9,14 +9,14 @@ module Lite
9
9
 
10
10
  class << self
11
11
 
12
- def call(relation = nil, **args)
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, **args)
19
+ def initialize(relation = nil, args = {})
20
20
  @relation = relation || default_relation
21
21
  @args = args
22
22
  end
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Query
5
5
 
6
- VERSION ||= '1.0.3'
6
+ VERSION ||= '1.0.8'
7
7
 
8
8
  end
9
9
  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.3
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: 2019-09-03 00:00:00.000000000 Z
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.0.4
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,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationQuery < Lite::Query::Base
4
- 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,5 +0,0 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe <%= class_name %>Query, type: :query do
4
- pending "add some examples to (or delete) #{__FILE__}"
5
- 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
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- <% module_namespacing do -%>
4
- class <%= class_name %>QueryTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- <% end -%>