json_to_env 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_to_env.rb +11 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99dbd0a251f8ffdc6b9a42dfee1b49d7f1525a34
|
4
|
+
data.tar.gz: 17baba1153f3b41220d0efcee2a208d4e965df7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3c25857b4aa65b5e14741057e973807ee1ed8224b2026a631166a24a95b21239d9e9b98299a30b785ab15431a96cf20e69d0d755fbdd6262907471373313e5
|
7
|
+
data.tar.gz: 79f964dd2bd0cfb48860360823c4ec40bdc64eb4962ed5b730ea6f52317c14ee6e5f3ecd7a8427d8f86adaef8ad1f23bad2fed1ded9821379091e5ecbb8a9eb0
|
data/lib/json_to_env.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
class JsonToEnv
|
2
|
-
VERSION = "0.
|
4
|
+
VERSION = "0.2.0"
|
3
5
|
|
4
6
|
def self.load(json)
|
5
7
|
hash = JSON.parse json
|
@@ -17,7 +19,14 @@ class JsonToEnv
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
envs.each { |k,v| ENV[k] = v unless ENV.has_key? k }
|
22
|
+
envs.each { |k,v| ENV[k] = self.stringify(v) unless ENV.has_key? k }
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.stringify(v)
|
26
|
+
str_value = v
|
27
|
+
str_value = JSON.dump(v) if v.is_a?(Array)
|
28
|
+
str_value = JSON.dump(v) if v.is_a?(Hash)
|
29
|
+
str_value.to_s
|
21
30
|
end
|
22
31
|
|
23
32
|
def self.load_file(file_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_to_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|