appfuel 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/appfuel.gemspec +1 -0
- data/lib/appfuel/configuration/definition_dsl.rb +1 -1
- data/lib/appfuel/configuration/file_loader.rb +12 -5
- data/lib/appfuel/configuration/populate.rb +4 -7
- data/lib/appfuel/configuration/search.rb +1 -1
- data/lib/appfuel/version.rb +1 -1
- data/lib/appfuel.rb +6 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54becd18e0c5c644ef511055cbea0387fb3a9358
|
4
|
+
data.tar.gz: 6ee40a006ed3074fbb4a9507d89c6c2c6f3ae825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e97e9094b6360bc89c3567f9d3a262d5269d46a28f963e1bd3433370a53a5341ee02bed4e55a75407128ea8f08fef83296ce31db08dfe709be824bfc244859ae
|
7
|
+
data.tar.gz: 88dcc7b47c0393b965b0e52a75cae551afe8f0a2683375781a7bea0708d82e8063ddb27159765d7ec9e07bb3f6d634da2f8a7fa73bde7e3dc59a7c3cb08853fa
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,12 @@ All notable changes to this project will be documented in this file. (Pending ap
|
|
3
3
|
|
4
4
|
# [Unreleased]
|
5
5
|
|
6
|
+
|
6
7
|
# Releases
|
8
|
+
## [[0.2.9]](https://github.com/rsb/appfuel/releases/tag/0.2.8) 2017-06-14
|
9
|
+
### Changed
|
10
|
+
- configuration now resolve to symbols as keys, children included
|
11
|
+
|
7
12
|
## [[0.2.8]](https://github.com/rsb/appfuel/releases/tag/0.2.8) 2017-06-07
|
8
13
|
### Fixed
|
9
14
|
- searching configuration definitions with a symbol was failing because key was
|
data/appfuel.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
# when dynamically creating form validators. Not sure if it is the library
|
25
25
|
# or the way I am using it.
|
26
26
|
spec.add_dependency "activerecord", "~> 5.1.0"
|
27
|
+
spec.add_dependency "pg", "~> 0.20"
|
27
28
|
spec.add_dependency "dry-types", "0.9.2"
|
28
29
|
spec.add_dependency "dry-container", "~> 0.6"
|
29
30
|
spec.add_dependency "dry-validation", "~> 0.10.5"
|
@@ -29,6 +29,7 @@ module Appfuel
|
|
29
29
|
def parse_yaml(path)
|
30
30
|
yaml_module.load_file(path)
|
31
31
|
end
|
32
|
+
alias_method :parse_yml, :parse_yaml
|
32
33
|
|
33
34
|
# Load file will search through a configuration's definition file
|
34
35
|
# paths and use the first on that exists. It parse it based on
|
@@ -40,21 +41,27 @@ module Appfuel
|
|
40
41
|
# @return [Hash]
|
41
42
|
def load_file(definition)
|
42
43
|
paths = definition.file
|
43
|
-
key = definition.key
|
44
44
|
|
45
45
|
paths.each do |path|
|
46
46
|
ext = file_module.extname(path).strip.downcase[1..-1]
|
47
47
|
parse_method = "parse_#{ext}"
|
48
48
|
unless respond_to?(parse_method)
|
49
|
-
fail "extension (#{ext}), for (#{key}: #{path})
|
50
|
-
"only yaml and json are supported"
|
49
|
+
fail "extension (#{ext}), for (#{definition.key}: #{path}) " +
|
50
|
+
"is not valid, only yaml and json are supported"
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
if file_module.exists?(path)
|
54
|
+
config = public_send(parse_method, path)
|
55
|
+
unless config.is_a?(Hash)
|
56
|
+
fail "[config #{parse_method}] config must be a hash"
|
57
|
+
end
|
58
|
+
config.deep_symbolize_keys!
|
59
|
+
return config[definition.key]
|
60
|
+
end
|
54
61
|
end
|
55
62
|
|
56
63
|
list = paths.join(',')
|
57
|
-
fail "none of :#{key} config files exist at (#{list})"
|
64
|
+
fail "none of :#{definition.key} config files exist at (#{list})"
|
58
65
|
end
|
59
66
|
end
|
60
67
|
end
|
@@ -25,15 +25,11 @@ module Appfuel
|
|
25
25
|
|
26
26
|
if file?
|
27
27
|
config = load_file(self)
|
28
|
-
|
29
|
-
fail "[config populate] Failed :load_file did not " +
|
30
|
-
"return a hash (#{file})"
|
31
|
-
end
|
28
|
+
else
|
32
29
|
config = config[key]
|
33
30
|
end
|
34
31
|
|
35
32
|
config ||= {}
|
36
|
-
|
37
33
|
config = defaults.deep_merge(config)
|
38
34
|
config = config.deep_merge(load_env(env_data, self))
|
39
35
|
config = config.deep_merge(overrides || {})
|
@@ -60,9 +56,10 @@ module Appfuel
|
|
60
56
|
|
61
57
|
def populate_children(child_hash, data, env_data = {})
|
62
58
|
child_hash.each do |(def_key, definition)|
|
63
|
-
|
59
|
+
if definition.file?
|
60
|
+
data[def_key] = load_file(definition)
|
61
|
+
end
|
64
62
|
data[def_key] ||= {}
|
65
|
-
data[def_key] = load_file(definition) if definition.file?
|
66
63
|
data[def_key] = definition.defaults.deep_merge(data[def_key])
|
67
64
|
data[def_key] = data[def_key].deep_merge(load_env(env_data, definition))
|
68
65
|
unless definition.children.empty?
|
@@ -29,7 +29,7 @@ module Appfuel
|
|
29
29
|
# @param terms Array of definition keys
|
30
30
|
def find(child_list, terms)
|
31
31
|
while term = terms.shift
|
32
|
-
term = term.
|
32
|
+
term = term.to_sym
|
33
33
|
child_list.each do |(definition_key, definition)|
|
34
34
|
next unless definition_key == term
|
35
35
|
result = if terms.empty?
|
data/lib/appfuel/version.rb
CHANGED
data/lib/appfuel.rb
CHANGED
@@ -146,7 +146,12 @@ module Appfuel
|
|
146
146
|
runlist_key = "#{namespace}.run"
|
147
147
|
env = container['env']
|
148
148
|
config = container['config']
|
149
|
-
|
149
|
+
|
150
|
+
runlist = []
|
151
|
+
if container.key?(runlist_key)
|
152
|
+
runlist = container[runlist_key]
|
153
|
+
end
|
154
|
+
|
150
155
|
unless runlist.respond_to?(:each)
|
151
156
|
fail "[initialize] runlist (#{runlist_key}) must implement :each"
|
152
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Scott-Buccleuch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pg
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.20'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.20'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: dry-types
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|