envied 0.10.0.alpha1 → 0.10.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/envied.rb +15 -2
- data/lib/envied/env_proxy.rb +4 -4
- data/lib/envied/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc20ae0af7bca2b583c878ded0e20158ec97bf6083f5bd9ed87df439ccdbebcb
|
4
|
+
data.tar.gz: e0077f4db12320110b8bf27187e5ed159555aee466fae4db2d954f9405717e40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a11a5d9fe26fb430da05d832ca8df370f0ce08f1d455e6fc739d94d5d486777fd456f98257b69922c7f61a3bd9687a19ee4d74e8812009ffb186219520f216b0
|
7
|
+
data.tar.gz: da77c7a1f2753f961ae2806878b7189e4278367448b175dea9d03711899988c0ce721d47baf83967c26c319e7c8bd823a9bd6c5a2da20553ff69d0cd37453071
|
data/lib/envied.rb
CHANGED
@@ -16,6 +16,7 @@ class ENVied
|
|
16
16
|
def self.require(*args, **options)
|
17
17
|
requested_groups = (args && !args.empty?) ? args : ENV['ENVIED_GROUPS']
|
18
18
|
env!(requested_groups, options)
|
19
|
+
error_on_duplicate_variables!(options)
|
19
20
|
error_on_missing_variables!(options)
|
20
21
|
error_on_uncoercible_variables!(options)
|
21
22
|
|
@@ -28,8 +29,20 @@ class ENVied
|
|
28
29
|
@env = EnvProxy.new(@config, groups: required_groups(*requested_groups))
|
29
30
|
end
|
30
31
|
|
32
|
+
def self.error_on_duplicate_variables!(options)
|
33
|
+
var_types_by_name = env.variables.reduce({}) do |acc, v|
|
34
|
+
(acc[v.name] ||= []).push v.type
|
35
|
+
acc
|
36
|
+
end
|
37
|
+
dups = var_types_by_name.select {|name, types| types.uniq.count > 1 }
|
38
|
+
|
39
|
+
if dups.any?
|
40
|
+
raise "The following variables are defined more than once with different types: #{dups.keys.join(', ')}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
31
44
|
def self.error_on_missing_variables!(**options)
|
32
|
-
names = env.missing_variables.map(&:name)
|
45
|
+
names = env.missing_variables.map(&:name).uniq.sort
|
33
46
|
if names.any?
|
34
47
|
msg = "The following environment variables should be set: #{names.join(', ')}."
|
35
48
|
msg << "\nPlease make sure to stop Spring before retrying." if spring_enabled? && !options[:via_spring]
|
@@ -55,7 +68,7 @@ class ENVied
|
|
55
68
|
end
|
56
69
|
|
57
70
|
def self.env_keys_to_intercept
|
58
|
-
|
71
|
+
env.variables.select{|v| v.type == :env }.map{|var| var.name.to_s }
|
59
72
|
end
|
60
73
|
|
61
74
|
def self.intercept_env_vars!
|
data/lib/envied/env_proxy.rb
CHANGED
@@ -30,6 +30,10 @@ class ENVied
|
|
30
30
|
return env_value_of(var) unless env_value_of(var).nil?
|
31
31
|
end
|
32
32
|
|
33
|
+
def variables
|
34
|
+
@variables ||= config.variables.select {|v| groups.include?(v.group) }
|
35
|
+
end
|
36
|
+
|
33
37
|
private
|
34
38
|
|
35
39
|
def coerce(var)
|
@@ -62,10 +66,6 @@ class ENVied
|
|
62
66
|
value_to_coerce(var).nil?
|
63
67
|
end
|
64
68
|
|
65
|
-
def variables
|
66
|
-
@variables ||= config.variables.select {|v| groups.include?(v.group) }
|
67
|
-
end
|
68
|
-
|
69
69
|
def variables_by_name
|
70
70
|
@variables_by_name ||= variables.map {|v| [v.name, v] }.to_h
|
71
71
|
end
|
data/lib/envied/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envied
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.0.
|
4
|
+
version: 0.10.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gert Goet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|