envme 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/envme/version.rb +1 -1
- data/lib/envme.rb +10 -4
- data/spec/configuration_spec.rb +5 -2
- data/spec/envme_spec.rb +24 -2
- data/spec/spec_helper.rb +4 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690076c90dc0a7f9746e1d9b2d75ea9dfc9195e4
|
4
|
+
data.tar.gz: 0526e5d85cae8a8bc6f4ea3e47138968665cea5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32e92ecf5327c7281c14f32b1a50f72fb8258ce06019ed8602c4eaf6135e9f129a474db5d56186928ed001bc9b71d322fafaa8ac527ef6070b7d6d05fc5d222e
|
7
|
+
data.tar.gz: e2863d0d1d144cbe04bb2bbd051dd5ed0be40eddc42161616d0e73bd90a448361b7153c4e39c1b6e2affb91f478c0e89a185b51cb92d17232b710afbd4583ec4
|
data/lib/envme/version.rb
CHANGED
data/lib/envme.rb
CHANGED
@@ -59,12 +59,18 @@ module Envme
|
|
59
59
|
var_collection.collect{ |var| "echo #{var} >> #{filename}"}.join("\n")
|
60
60
|
end
|
61
61
|
|
62
|
+
def get_cmd(prefix)
|
63
|
+
[
|
64
|
+
"envconsul -once",
|
65
|
+
"-consul #{self.configuration.url}",
|
66
|
+
"-prefix #{prefix} -upcase",
|
67
|
+
"-token #{self.configuration.acl_token} -sanitize env"
|
68
|
+
].join(' ')
|
69
|
+
end
|
70
|
+
|
62
71
|
private
|
63
72
|
def run_cmd(prefix)
|
64
|
-
`
|
65
|
-
-consul #{self.configuration.url} \
|
66
|
-
-prefix #{prefix} -upcase \
|
67
|
-
-token #{self.configuration.acl_token} -sanitize env`
|
73
|
+
`#{get_cmd(prefix)}`
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Envme" do
|
4
4
|
describe "configuration" do
|
@@ -8,6 +8,10 @@ describe "Envme" do
|
|
8
8
|
Envme.configuration = Envme::Configuration.new
|
9
9
|
end
|
10
10
|
|
11
|
+
after(:each) do
|
12
|
+
Envme.configuration = Envme::Configuration.new
|
13
|
+
end
|
14
|
+
|
11
15
|
it "has configuration block" do
|
12
16
|
expect { |b| Envme.configure(&b) }.to yield_control
|
13
17
|
end
|
@@ -40,7 +44,6 @@ describe "Envme" do
|
|
40
44
|
Envme.configure do |config|
|
41
45
|
config.url = "google.com"
|
42
46
|
config.acl_token = "f45cbd0b-5022-47ab-8640-4eaa7c1f40f1"
|
43
|
-
config.options = {ssl: { verify: true }}
|
44
47
|
end
|
45
48
|
|
46
49
|
expect(Envme.configuration.url).to eq("google.com")
|
data/spec/envme_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Envme do
|
4
4
|
before(:each) do
|
@@ -60,7 +60,6 @@ describe Envme do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
context "#sanitize_vars" do
|
63
|
-
|
64
63
|
it "santitizes vars" do
|
65
64
|
vars = [ 'VAR_ONE=one',
|
66
65
|
'VAR_TWO=two',
|
@@ -80,4 +79,27 @@ describe Envme do
|
|
80
79
|
expect(results[0]).to eq('ONE=one')
|
81
80
|
end
|
82
81
|
end
|
82
|
+
|
83
|
+
context "#build_exports" do
|
84
|
+
it "should take a collection and build a list of exports" do
|
85
|
+
data = [ 'VAR_ONE=one', 'VAR_TWO=two', 'VARTHREE=three' ]
|
86
|
+
expected = "export VAR_ONE=one\nexport VAR_TWO=two\nexport VARTHREE=three"
|
87
|
+
|
88
|
+
expect(Envme.build_exports(data)).to eq(expected)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "#get_cmd" do
|
93
|
+
it "returns a the expected command" do
|
94
|
+
command = Envme.get_cmd('test/prefix')
|
95
|
+
expected = "envconsul -once -consul localhost:8500 -prefix test/prefix -upcase -token anonymous -sanitize env"
|
96
|
+
|
97
|
+
expect(command).to eq(expected)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "#configure" do
|
102
|
+
it "returns a configuration" do
|
103
|
+
end
|
104
|
+
end
|
83
105
|
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'Reppard Walker '
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
69
83
|
description: Envme is a Ruby wrapper for envconsul with a few extras.
|
70
84
|
email:
|
71
85
|
- reppardwalker@gmail.com
|
@@ -79,6 +93,7 @@ files:
|
|
79
93
|
- lib/envme/version.rb
|
80
94
|
- spec/configuration_spec.rb
|
81
95
|
- spec/envme_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
82
97
|
homepage: https://github.com/reppard/envme
|
83
98
|
licenses:
|
84
99
|
- MIT
|