horza 1.0.1 → 1.0.2
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 +5 -5
- data/lib/horza/dependency_loading.rb +22 -13
- data/lib/horza/version.rb +2 -2
- metadata +63 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 67ff389f7197d2155bf1870ee9de369a233886e33f1b1f46486e32db3f900cb4
|
4
|
+
data.tar.gz: 494f9d2017cd24a46b7f0f3a488f6b6232d65378715daf2e84a7b07828301cf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1096f7b13a9cdcca4ac23ad022646c2734371469adec295b5c55d221fb0f9b974dba5a03797c8e3cdde06f8bece63b2567826d5c89d46029db1bc67c14a0447f
|
7
|
+
data.tar.gz: 8617744b6fd584d1a4dd7ff834b0540066f01dc715b59cdfd6f6505caa97f32c5767529f68a9aeb44df708fe6f9e2e83f4c1dd0ab9ef50495bd14ba51746b554
|
@@ -7,28 +7,37 @@ module Horza
|
|
7
7
|
|
8
8
|
def resolve_dependency(entity_name)
|
9
9
|
file_name = entity_name.to_s.underscore
|
10
|
-
# Search for a matching filename in #constant_paths
|
10
|
+
# Search for a matching filename in #constant_paths
|
11
11
|
# and try to load a constant that matches.
|
12
12
|
resolve_from_file_paths(file_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def resolve_from_file_paths(entity_name)
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if Horza.constant_paths.empty?
|
17
|
+
# try in current scope, even with no lookup paths configured
|
18
|
+
begin
|
19
|
+
entity_name.capitalize.constantize
|
20
|
+
rescue NameError
|
21
|
+
raise ArgumentError.new("No file paths configured to lookup constants")
|
22
|
+
end
|
23
|
+
else
|
24
|
+
file_path = search_for_file(entity_name)
|
19
25
|
|
20
|
-
|
26
|
+
resolved_name = constant_name_for_path(file_path).first
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
if resolved_name.nil?
|
29
|
+
Error.new("No constant found for: #{entity_name.inspect}")
|
30
|
+
else
|
31
|
+
ActiveSupport::Dependencies::Reference.safe_get(resolved_name)
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
28
35
|
|
29
36
|
|
30
37
|
def constant_name_for_path(file_path)
|
31
|
-
ActiveSupport::Dependencies.loadable_constants_for_path(
|
38
|
+
ActiveSupport::Dependencies.loadable_constants_for_path(
|
39
|
+
file_path, Horza.constant_paths
|
40
|
+
).tap do |loadables|
|
32
41
|
if loadables.many?
|
33
42
|
raise "It seems that your registered constant file paths are not setup correctly " +
|
34
43
|
"and would cause Horza to try and load the following constants:\n\n #{loadables.map(&:inspect).join(', ')}"
|
@@ -42,12 +51,12 @@ module Horza
|
|
42
51
|
path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
|
43
52
|
|
44
53
|
Horza.constant_paths.each do |root|
|
45
|
-
Dir.glob(File.join(root, "**/")).each do |dir|
|
54
|
+
Dir.glob(File.join(root, "**/")).each do |dir|
|
46
55
|
path = File.join(dir, path_suffix)
|
47
56
|
return path if File.file? path
|
48
57
|
end
|
49
58
|
end
|
50
|
-
|
59
|
+
|
51
60
|
raise MissingFile.new(
|
52
61
|
"No matching file found for: '#{path_suffix.sub(/(\.rb)?$/, "")}'\n" +
|
53
62
|
"Searched in: (#{Horza.constant_paths.map(&:inspect).join(', ')})"
|
@@ -55,4 +64,4 @@ module Horza
|
|
55
64
|
end
|
56
65
|
|
57
66
|
end
|
58
|
-
end
|
67
|
+
end
|
data/lib/horza/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Horza
|
2
|
-
VERSION = '1.0.
|
3
|
-
end
|
2
|
+
VERSION = '1.0.2'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: horza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Turner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '4.0'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '9.1'
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- -
|
69
|
+
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '4.0'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '9.1'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: activerecord
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- -
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: '3.2'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- -
|
86
|
+
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '3.2'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: sqlite3
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- -
|
93
|
+
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
89
95
|
version: '0'
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- -
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: appraisal
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.1.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 2.1.0
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: bundler-audit
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
95
129
|
- !ruby/object:Gem::Version
|
96
130
|
version: '0'
|
97
131
|
description: Horza is a shapeshifter that provides common inputs and outputs for your
|
@@ -101,6 +135,9 @@ executables: []
|
|
101
135
|
extensions: []
|
102
136
|
extra_rdoc_files: []
|
103
137
|
files:
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.md
|
140
|
+
- lib/horza.rb
|
104
141
|
- lib/horza/adapters/abstract_adapter.rb
|
105
142
|
- lib/horza/adapters/active_record/active_record.rb
|
106
143
|
- lib/horza/adapters/active_record/arel_join.rb
|
@@ -110,16 +147,13 @@ files:
|
|
110
147
|
- lib/horza/configuration.rb
|
111
148
|
- lib/horza/core_extensions/string.rb
|
112
149
|
- lib/horza/dependency_loading.rb
|
150
|
+
- lib/horza/entities.rb
|
113
151
|
- lib/horza/entities/collection.rb
|
114
152
|
- lib/horza/entities/single.rb
|
115
153
|
- lib/horza/entities/single_with_active_model.rb
|
116
|
-
- lib/horza/entities.rb
|
117
154
|
- lib/horza/errors.rb
|
118
155
|
- lib/horza/shared_config.rb
|
119
156
|
- lib/horza/version.rb
|
120
|
-
- lib/horza.rb
|
121
|
-
- LICENSE.txt
|
122
|
-
- README.md
|
123
157
|
- spec/active_record_spec.rb
|
124
158
|
- spec/configuration_spec.rb
|
125
159
|
- spec/dependency_loading_spec.rb
|
@@ -143,31 +177,31 @@ require_paths:
|
|
143
177
|
- lib
|
144
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
179
|
requirements:
|
146
|
-
- -
|
180
|
+
- - ">="
|
147
181
|
- !ruby/object:Gem::Version
|
148
182
|
version: '0'
|
149
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
184
|
requirements:
|
151
|
-
- -
|
185
|
+
- - ">="
|
152
186
|
- !ruby/object:Gem::Version
|
153
187
|
version: '0'
|
154
188
|
requirements: []
|
155
189
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.7.3
|
157
191
|
signing_key:
|
158
192
|
specification_version: 4
|
159
193
|
summary: Keep your app ORM-agnostic
|
160
194
|
test_files:
|
161
|
-
- spec/active_record_spec.rb
|
162
|
-
- spec/configuration_spec.rb
|
163
|
-
- spec/dependency_loading_spec.rb
|
164
|
-
- spec/horza_spec.rb
|
165
|
-
- spec/shared_config_spec.rb
|
166
195
|
- spec/spec_helper.rb
|
167
|
-
- spec/
|
196
|
+
- spec/shared_config_spec.rb
|
197
|
+
- spec/dependency_loading_spec.rb
|
198
|
+
- spec/configuration_spec.rb
|
199
|
+
- spec/active_record_spec.rb
|
200
|
+
- spec/test_constants/other_dummy_model.rb
|
168
201
|
- spec/test_constants/dummy_model.rb
|
202
|
+
- spec/test_constants/customer.rb
|
169
203
|
- spec/test_constants/employer.rb
|
170
|
-
- spec/test_constants/other_dummy_model.rb
|
171
|
-
- spec/test_constants/sports_car.rb
|
172
204
|
- spec/test_constants/test_employer.rb
|
205
|
+
- spec/test_constants/sports_car.rb
|
173
206
|
- spec/test_constants/user.rb
|
207
|
+
- spec/horza_spec.rb
|