unenviable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/unenviable/env_wrapper.rb +20 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adbf42f9de156c23366902a3e3ba53acb74a608a
|
4
|
+
data.tar.gz: d0a37d8500eba9e833ffa782653919c8476e2d66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa2e667820351e0d082a11a4f82145b48445db8b12c013b8b581706507bb4782e753d1b451fb96a2546a6901a5bd0d97161b7d85982f51b1012b46ced2854f07
|
7
|
+
data.tar.gz: 7dca9612f7558a1ba4048ff2920f6fba34016bdb9645f046fcc9eeecbc24c5c497e9d18a82a05743524a16b34344aad8b2f56c5eaab45c2ec67949ac13094f35
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Unenviable
|
2
|
+
# Wraps the ENV variable to catch calls to ENV where the value
|
3
|
+
# is missing or not specified in Unenviable's YAML file.
|
4
|
+
class ENVWrapper
|
5
|
+
def initialize
|
6
|
+
@saved_env = ENV
|
7
|
+
end
|
8
|
+
|
9
|
+
def [](key)
|
10
|
+
value = @saved_env[key]
|
11
|
+
fail "Requested ENV[#{key}] which has not been described!" unless Unenviable.described?(key)
|
12
|
+
return value unless value.nil?
|
13
|
+
'MISSING VALUE'
|
14
|
+
end
|
15
|
+
|
16
|
+
def []=(key, value)
|
17
|
+
@saved_env[key] = value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unenviable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- K M Lawrence
|
@@ -14,14 +14,14 @@ dependencies:
|
|
14
14
|
name: dotenv
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.11.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.11.1
|
27
27
|
description: Makes ENV vars easier to keep track of in distributed development
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- bin/unenviable
|
35
35
|
- lib/unenviable.rb
|
36
|
+
- lib/unenviable/env_wrapper.rb
|
36
37
|
homepage: http://rubygems.org/gems/unenviable
|
37
38
|
licenses:
|
38
39
|
- MIT
|