dry-config 1.2.5 → 1.2.6
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/lib/dry/config/base.rb +4 -4
- data/lib/dry/config/version.rb +1 -1
- data/spec/dry/config/base_spec.rb +15 -5
- data/spec/dry/config/docker-rails.yml +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1990adea4a24a82fc97e272746647443f7c6139
|
4
|
+
data.tar.gz: cda3cf6ba6aee62afa5d32f8c44a5926a5bf3150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11e050abd84ac329bc233f9e9f97402fda4d567ab1cf9a58155c6fd2a8f564b83a2982e4d6d3adedcafdae982be1f2809f9127970bb803ba5ae03d6fc746de5c
|
7
|
+
data.tar.gz: 1fe0a7980e19eb86899541641b29537489fdc1f26ba6c599b9e2a862072695d36d82a66fb33a345c0f70c944bdc02f8ed4a576671f0402b691b41dfa25038490
|
data/lib/dry/config/base.rb
CHANGED
@@ -117,9 +117,9 @@ module Dry
|
|
117
117
|
config
|
118
118
|
end
|
119
119
|
|
120
|
-
def to_yaml
|
120
|
+
def to_yaml(config = @configuration)
|
121
121
|
if unsymbolize_to_yaml?
|
122
|
-
config =
|
122
|
+
config = config.dup.deep_symbolize(true)
|
123
123
|
else
|
124
124
|
config = @configuration
|
125
125
|
end
|
@@ -127,9 +127,9 @@ module Dry
|
|
127
127
|
Psych.dump(config)
|
128
128
|
end
|
129
129
|
|
130
|
-
def write_yaml_file(filename)
|
130
|
+
def write_yaml_file(filename, config = @configuration)
|
131
131
|
File.open(filename, 'w') do |file|
|
132
|
-
file.write(to_yaml)
|
132
|
+
file.write(to_yaml(config))
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
data/lib/dry/config/version.rb
CHANGED
@@ -63,7 +63,7 @@ describe Dry::Config::Base do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'direct delegation' do
|
66
|
-
|
66
|
+
|
67
67
|
acmeConfig.load!(nil, config_file_path)
|
68
68
|
expect(acmeConfig.symbolize?).to be_truthy
|
69
69
|
|
@@ -78,6 +78,16 @@ describe Dry::Config::Base do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
it 'to_yaml sub context' do
|
82
|
+
acmeConfig.load!(nil, config_file_path)
|
83
|
+
expect(acmeConfig.symbolize?).to be_truthy
|
84
|
+
expect(acmeConfig.unsymbolize_to_yaml?).to be_truthy
|
85
|
+
|
86
|
+
yaml = acmeConfig.to_yaml(acmeConfig[:options])
|
87
|
+
# puts yaml
|
88
|
+
expect(yaml =~ /^---\naws\:elasticbeanstalk\:application\:environment\:$/).to be_truthy
|
89
|
+
end
|
90
|
+
|
81
91
|
context 'unsymbolize_to_yaml' do
|
82
92
|
it 'defaults to unsymbolized' do
|
83
93
|
acmeConfig.load!(nil, config_file_path)
|
@@ -94,7 +104,7 @@ describe Dry::Config::Base do
|
|
94
104
|
end
|
95
105
|
|
96
106
|
context 'symbolize: false' do
|
97
|
-
subject(:acmeConfig) { AcmeConfig.new(unsymbolize_to_yaml:false) }
|
107
|
+
subject(:acmeConfig) { AcmeConfig.new(unsymbolize_to_yaml: false) }
|
98
108
|
|
99
109
|
it 'should leave keys symbolized' do
|
100
110
|
acmeConfig.load!(nil, config_file_path)
|
@@ -112,7 +122,7 @@ describe Dry::Config::Base do
|
|
112
122
|
context 'when loading a single configuration file' do
|
113
123
|
|
114
124
|
it 'should read file with nil environment' do
|
115
|
-
|
125
|
+
|
116
126
|
acmeConfig.load!(nil, config_file_path)
|
117
127
|
|
118
128
|
assert_common_seed_settings
|
@@ -127,7 +137,7 @@ describe Dry::Config::Base do
|
|
127
137
|
end
|
128
138
|
|
129
139
|
it 'should override with development environment' do
|
130
|
-
|
140
|
+
|
131
141
|
acmeConfig.load!(:development, config_file_path)
|
132
142
|
|
133
143
|
# assert_common_seed_settings
|
@@ -144,7 +154,7 @@ describe Dry::Config::Base do
|
|
144
154
|
end
|
145
155
|
|
146
156
|
it 'should override with production environment' do
|
147
|
-
|
157
|
+
|
148
158
|
acmeConfig.load!(:production, config_file_path)
|
149
159
|
|
150
160
|
# assert_common_seed_settings
|
@@ -6,14 +6,11 @@ elasticsearch: &elasticsearch
|
|
6
6
|
image: library/elasticsearch:1.7
|
7
7
|
ports:
|
8
8
|
- "9200:9200"
|
9
|
-
links:
|
10
|
-
- elasticsearch
|
11
9
|
|
12
10
|
development:
|
13
11
|
docker-compose:
|
12
|
+
<<: *elasticsearch
|
14
13
|
web:
|
15
|
-
<<: *elasticsearch
|
16
|
-
|
17
14
|
command: >
|
18
15
|
bash -c "
|
19
16
|
echo 'Bundling gems'
|
@@ -39,6 +36,8 @@ development:
|
|
39
36
|
&& foreman start
|
40
37
|
"
|
41
38
|
|
39
|
+
links:
|
40
|
+
- elasticsearch # standard yaml doesn't merge arrays so we have to add this explicitly
|
42
41
|
docker-compose:
|
43
42
|
web:
|
44
43
|
build: .
|