dry-config 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c1737b29253538d7bf15cd0e02bc7f2d34c4b33
4
- data.tar.gz: 051fd285d4b11930896fb44fe2c331bdc61630a2
3
+ metadata.gz: c1990adea4a24a82fc97e272746647443f7c6139
4
+ data.tar.gz: cda3cf6ba6aee62afa5d32f8c44a5926a5bf3150
5
5
  SHA512:
6
- metadata.gz: 237dec289c8886e1c80f7437bd9d03554f93706bb6c5576544a0fd4fdb9e0869c895e8f6d1355c34fdcf5bb1fac95fa7caee665055928284b70c10f108250c82
7
- data.tar.gz: 0c0229fbbbc42e414959bd70433cdeeec726a3382ba0c5a4308102444718fc96a78d2af0464e5b7a614071dea87dc56bc2a2c61393e63e343658d9a05e46ce8d
6
+ metadata.gz: 11e050abd84ac329bc233f9e9f97402fda4d567ab1cf9a58155c6fd2a8f564b83a2982e4d6d3adedcafdae982be1f2809f9127970bb803ba5ae03d6fc746de5c
7
+ data.tar.gz: 1fe0a7980e19eb86899541641b29537489fdc1f26ba6c599b9e2a862072695d36d82a66fb33a345c0f70c944bdc02f8ed4a576671f0402b691b41dfa25038490
@@ -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 = @configuration.dup.deep_symbolize(true)
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
 
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Config
3
- VERSION = '1.2.5'
3
+ VERSION = '1.2.6'
4
4
  end
5
5
  end
@@ -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: .
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ross