lite-query 1.0.3 → 1.0.4
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -3
- data/lib/generators/rails/query_generator.rb +7 -1
- data/lib/generators/rails/templates/query.rb.tt +2 -0
- data/lib/generators/{rspec/templates/query_spec.rb.tt → rails/templates/spec.rb.tt} +2 -0
- data/lib/lite/query/version.rb +1 -1
- data/lib/lite/query.rb +1 -4
- metadata +2 -5
- data/lib/generators/rspec/query_generator.rb +0 -29
- 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: 6e3dfe1a485ad4a6a5886f1d83e8569410b92d46d394a6b3a13671c1c0e94689
|
4
|
+
data.tar.gz: bde018db4b76b6126a15e799cda50ff1d2db51160a37eb379e65879c15725c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b1b27a42809e122d2994bb65748922da7fc4b2fe07b4ed7a4f3d10cd897a5cb64188921fa757e17273daf086938b5afcccefa01b03c3276304e56824aba757f
|
7
|
+
data.tar.gz: dd7fd542d4bff2a592f9084735b8fcd5ee2fd2210e037df8319a237127ea5fd680390bc0811f57496031f0c1d8a95af3cd944e45e4b11f635cbf84dc9676a598
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -39,9 +39,7 @@ end
|
|
39
39
|
|
40
40
|
Use `rails g query NAME` will generate the following file: `../app/queries/[name]_query.rb`
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
You will then need to fill this class with the required `execute` method
|
42
|
+
You will then need to fill this class with the required `execute` method as shown below:
|
45
43
|
|
46
44
|
```ruby
|
47
45
|
class AgeQuery < ApplicationQuery
|
@@ -14,7 +14,13 @@ module Rails
|
|
14
14
|
template('query.rb.tt', path)
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
def copy_specs
|
18
|
+
return unless defined?(RSpec)
|
19
|
+
|
20
|
+
path = File.join('spec', 'queries', class_path, "#{file_name}_query_spec.rb")
|
21
|
+
empty_directory('spec/queries')
|
22
|
+
template('spec.rb.tt', path)
|
23
|
+
end
|
18
24
|
|
19
25
|
private
|
20
26
|
|
data/lib/lite/query/version.rb
CHANGED
data/lib/lite/query.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -191,10 +191,7 @@ files:
|
|
191
191
|
- lib/generators/rails/USAGE
|
192
192
|
- lib/generators/rails/query_generator.rb
|
193
193
|
- lib/generators/rails/templates/query.rb.tt
|
194
|
-
- lib/generators/
|
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
|
194
|
+
- lib/generators/rails/templates/spec.rb.tt
|
198
195
|
- lib/lite/query.rb
|
199
196
|
- lib/lite/query/base.rb
|
200
197
|
- lib/lite/query/exceptions.rb
|
@@ -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
|