eql 0.0.4 → 0.1.0

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
  SHA1:
3
- metadata.gz: 66fb4278a980fcd7f7e5b847dd3a63307dff72c7
4
- data.tar.gz: cd95b8e03f2fc3b22736b80cac798241e03cff1f
3
+ metadata.gz: 6643d26606fd2a4cb8db4aca24a135011f59ba79
4
+ data.tar.gz: 8041b8f8da26a83346f01f5df4639f7bd0b541a7
5
5
  SHA512:
6
- metadata.gz: 16e8023d31c859e25b4c216e6d464138df5f3c1030c6cbd8e4147814a0f3f2a36ea3269d4eee827443db1a43f0dde8fea725e5e665ef56575a159e20fe836028
7
- data.tar.gz: b0b2f2636666281c710148ac9523cc7b8531f350f243167e73fcdd8e5cd15e77aeeb20dcb5739549d9efc52bbfe12dea18b612c537c482523d086e27a3e6ceae
6
+ metadata.gz: 10efaee6d2e49b855583dba20a204d6239b94c63adbbbce3887fdda6ee70e99e1baa8531c279678557dda48340e0dcfe839f357ccdac05b3939c3828832a6a4e
7
+ data.tar.gz: e6927c0b72bfbfab019cab6247a52cd609b6ce97ce6d4071bf9a40765657317d0da6454e0c4c6bdca8b3f542ce4c8f434dcfbfbfcd65cc72cbaedefc1bce5a8a
data/README.md CHANGED
@@ -53,6 +53,7 @@ b.execute_params(id: 74)
53
53
  Eql.configure do |config|
54
54
  config.path = Rails.root.join('app/queries')
55
55
  config.adapter = :active_record
56
+ config.cache_templates = !Rails.env.development?
56
57
  end
57
58
  ```
58
59
 
data/lib/eql.rb CHANGED
@@ -9,7 +9,7 @@ module Eql
9
9
  #
10
10
  # Create new builder
11
11
  #
12
- # @param [String, nil] path template's root folder
12
+ # @param [Array<String>, String, nil] path template's root folder
13
13
  # @param [Object, nil] conn DB connection or cursor
14
14
  #
15
15
  def new(path = nil, conn = nil)
@@ -9,11 +9,11 @@ module Eql
9
9
  attr_reader :conn
10
10
 
11
11
  #
12
- # @param [String] path path to a root folder with templates
12
+ # @param [Array<String>, String] path path to a root folder with templates
13
13
  # @param [String] conn DB connection or a cursor
14
14
  #
15
15
  def initialize(path, conn)
16
- @path = path
16
+ @path = Array.wrap(path)
17
17
  @conn = conn
18
18
  end
19
19
 
@@ -50,13 +50,12 @@ module Eql
50
50
  #
51
51
  # @param [String, Symbol] file template's name
52
52
  #
53
- # @return [String] returns file path pattern
53
+ # @return [Array<String>] returns file path pattern
54
54
  #
55
55
  def template_path(file)
56
- [
57
- File.join(@builder.path.to_s, file.to_s),
58
- @builder.adapter.extension
59
- ].join
56
+ @builder.path.map do |path|
57
+ [File.join(path, file.to_s), @builder.adapter.extension].join
58
+ end
60
59
  end
61
60
 
62
61
  #
@@ -71,10 +70,14 @@ module Eql
71
70
  # @return [String] returns template's path
72
71
  #
73
72
  def resolve_path(file)
74
- path = template_path(file)
75
- Dir.glob(path).first.tap do |f|
76
- raise "Unable to find query template with #{path.inspect} location" unless f
73
+ paths = template_path(file)
74
+
75
+ paths.each do |path|
76
+ filepath = Dir.glob(path).first
77
+ return filepath if filepath.present?
77
78
  end
79
+
80
+ raise "Unable to find query template with #{paths.inspect} location"
78
81
  end
79
82
 
80
83
  #
@@ -1,4 +1,4 @@
1
1
  module Eql
2
2
  # @return [String] returns gem version
3
- VERSION = '0.0.4'
3
+ VERSION = '0.1.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Yashchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2018-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.6.8
121
+ rubygems_version: 2.6.11
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Eql Query Language