kumo_keisei 3.0.4.pre.alpha1 → 3.0.4.pre.alpha2

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: a9f9da6e952e7fb49df49d4c9e401dd56ec2615c
4
- data.tar.gz: 13863deea165af416cea1e65b9d0e8b09cb39669
3
+ metadata.gz: 6d20310dc355e8295f37c2613f3e4c9c27109716
4
+ data.tar.gz: 073d42960ee1118df16dd1841757c93c551a021d
5
5
  SHA512:
6
- metadata.gz: f8c7eb06e6a431a2089a79ee94554a2d6c610362f6506de26353fb436e6350b0bc4a3cc4ecfbb80238a878fba0d858f58aaf9746a5cda505d85e69f7b4ed79b7
7
- data.tar.gz: b503f7296fdbb83ee35ef401afe75a1e4a52a226b345cf6e926e8cea84a18a90b9182fd970b258a0518d4c36de651a3166c226af0eeda10ebc0fc5d175c6ffb1
6
+ metadata.gz: 6ae2f7c6d66e22c8eaae52044954b1d6f539a0ca96ab5b5b84dc87694cfe4802ce49679f52cde32d9ce49f8accfe23ebdd973715844bbd1d003145242366d787
7
+ data.tar.gz: de1ce351850616e9ff96fcb5a5175d27add17fbeae051d49e1a185a47f3f9eaed94086d40371471868932b3e3fc210000aa8b0e30313dcd0e057cc23aef90719
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.4-alpha1
1
+ 3.0.4-alpha2
@@ -8,6 +8,8 @@ require_relative 'parameter_builder'
8
8
  module KumoKeisei
9
9
  # Environment Configuration for a cloud formation stack
10
10
  class EnvironmentConfig
11
+ class ConfigurationError < StandardError; end
12
+
11
13
  LOGGER = Logger.new(STDOUT)
12
14
 
13
15
  attr_reader :app_name, :env_name
@@ -16,9 +18,18 @@ module KumoKeisei
16
18
  @env_name = options[:env_name]
17
19
  @params_template_file_path = options[:params_template_file_path]
18
20
  @injected_config = options[:injected_config] || {}
19
- @config_file_loader = KumoKeisei::FileLoader.new(config_dir_path: options[:config_path])
20
-
21
21
  @log = logger
22
+
23
+ if options[:config_path]
24
+ @config_file_loader = KumoKeisei::FileLoader.new(config_dir_path: options[:config_path])
25
+ elsif options[:config_dir_path]
26
+ warn "[DEPRECATION] `:config_dir_path` is deprecated, please pass in `:config_path` instead"
27
+ @config_file_loader = KumoKeisei::FileLoader.new(config_dir_path: options[:config_dir_path])
28
+ else
29
+ @log.error "Please provide a :config_path"
30
+ raise ConfigurationError.new("Please provide a :config_path")
31
+ end
32
+
22
33
  end
23
34
 
24
35
  def production?
@@ -26,6 +26,58 @@ describe KumoKeisei::EnvironmentConfig do
26
26
  allow(File).to receive(:dirname).and_return('/tmp')
27
27
  end
28
28
 
29
+ context 'backward compatibility' do
30
+ context 'config_path' do
31
+ let(:options) do
32
+ {
33
+ env_name: env_name,
34
+ config_path: config_dir_path
35
+ }
36
+ end
37
+ it 'will be used without complaint' do
38
+ expect(KumoKeisei::FileLoader).to receive(:new).with(config_dir_path: config_dir_path).and_return(nil)
39
+ described_class.new(options)
40
+ end
41
+ end
42
+
43
+ context 'config_dir_path' do
44
+ let(:options) do
45
+ {
46
+ env_name: env_name,
47
+ config_dir_path: config_dir_path
48
+ }
49
+ end
50
+
51
+ before do
52
+ @orig_stderr = $stderr
53
+ $stderr = StringIO.new
54
+ end
55
+
56
+ after do
57
+ $stderr = @orig_stderr
58
+ end
59
+
60
+ it 'will be used if given and raise a deprecation warning' do
61
+ expect(KumoKeisei::FileLoader).to receive(:new).with(config_dir_path: config_dir_path).and_return(nil)
62
+ described_class.new(options)
63
+ $stderr.rewind
64
+ expect($stderr.string.chomp).to eq("[DEPRECATION] `:config_dir_path` is deprecated, please pass in `:config_path` instead")
65
+ end
66
+ end
67
+
68
+ context 'neither config_path nor config_dir_path' do
69
+ let(:options) do
70
+ {
71
+ env_name: env_name
72
+ }
73
+ end
74
+
75
+ it 'will raise an error' do
76
+ expect { described_class.new(options)}.to raise_error(KumoKeisei::EnvironmentConfig::ConfigurationError)
77
+ end
78
+ end
79
+ end
80
+
29
81
  context 'unit tests' do
30
82
  let(:fake_environment_binding) { binding }
31
83
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumo_keisei
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4.pre.alpha1
4
+ version: 3.0.4.pre.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Redbubble