etcdist 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +3 -0
- data/etcdist.gemspec +2 -2
- data/lib/etcdist/reader.rb +9 -1
- data/lib/etcdist/version.rb +1 -1
- data/spec/data/etcdist/foo/two.config +2 -0
- data/spec/etcdist/reader_spec.rb +5 -2
- data/spec/etcdist/writer_spec.rb +2 -2
- data/spec/etcdist_spec.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc73b8eda4ee9eacfc54779da11566353567b730
|
4
|
+
data.tar.gz: beaa73eba18000bb19dc1bd26763497b33589311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96a096d9ef040a2225d88a00540195fa750a89d9c5006fc61a207ef9a78fa75423380de7de7d6bd43c00b08e6b898be84781850459e51b208669c96a7dab4c7c
|
7
|
+
data.tar.gz: 8e6ab134d965683b6bdf47bb8e04fe1daa2f4fa9618420870b08446f0c64b24a3b3ab0185042d135a3cf18c49da423dc51154582bc000fe8d05805018cca140b
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/etcdist.svg)](http://badge.fury.io/rb/etcdist)
|
2
|
+
[![Build Status](https://travis-ci.org/SpringerSBM/etcdist.svg?branch=master)](https://travis-ci.org/SpringerSBM/etcdist)
|
3
|
+
|
1
4
|
# Etcdist
|
2
5
|
|
3
6
|
This is a small gem that helps you manage your etcd keys and values in a way that's easy to version control.
|
data/etcdist.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency 'etcd', '~> 0.2.4'
|
21
21
|
spec.add_runtime_dependency 'mixlib-log'
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler'
|
24
|
-
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
26
|
spec.add_development_dependency 'rspec-mocks', '~> 3.0'
|
27
27
|
spec.add_development_dependency 'guard-rspec'
|
data/lib/etcdist/reader.rb
CHANGED
@@ -16,11 +16,19 @@ module Etcdist
|
|
16
16
|
|
17
17
|
files.reduce(Hash.new { |h, k| h[k] = {} }) do |h, f|
|
18
18
|
directory = File.dirname(f).gsub(@dir, '')
|
19
|
-
entries = Hash[IO.readlines(f).map { |e| e.chomp.split('=') }]
|
19
|
+
entries = Hash[IO.readlines(f).map { |e| e.chomp.split('=', 2) }.select { |k, _| valid_key?(k) }]
|
20
20
|
Log.debug("found #{entries.length} entries in #{f.gsub(@dir, '')}: #{entries}")
|
21
21
|
h[directory].merge!(entries)
|
22
22
|
h
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def valid_key?(key)
|
29
|
+
is_valid = !(key.include? '/')
|
30
|
+
Log.warn("ignoring invalid key #{key}") unless is_valid
|
31
|
+
is_valid
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
data/lib/etcdist/version.rb
CHANGED
data/spec/etcdist/reader_spec.rb
CHANGED
@@ -8,7 +8,10 @@ describe Etcdist::Reader do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should return directories pointing to key/values' do
|
11
|
-
expect(reader.read).to match('/etcdist/foo' => {
|
11
|
+
expect(reader.read).to match('/etcdist/foo' => {
|
12
|
+
'fish' => 'plankton',
|
13
|
+
'cows' => 'grass',
|
14
|
+
'dogs' => 'bones',
|
15
|
+
'equation' => 'e=mc^2' })
|
12
16
|
end
|
13
|
-
|
14
17
|
end
|
data/spec/etcdist/writer_spec.rb
CHANGED
@@ -39,7 +39,7 @@ describe Etcdist::Writer do
|
|
39
39
|
it 'should not put entries in etcd' do
|
40
40
|
pretend_etcd_contains(nothing)
|
41
41
|
expect(etcd).not_to receive(:set)
|
42
|
-
writer.write(
|
42
|
+
writer.write('/foo/bar' => { 'fish' => 'plankton' })
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -74,7 +74,7 @@ describe Etcdist::Writer do
|
|
74
74
|
it 'should not delete entries' do
|
75
75
|
pretend_etcd_contains('/foo' => { 'fish' => 'plankton' })
|
76
76
|
expect(etcd).not_to receive(:delete)
|
77
|
-
writer.write(
|
77
|
+
writer.write('/foo' => { 'cows' => 'grass' })
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
data/spec/etcdist_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etcdist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Springer, Part of Springer Science+Business Media
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: etcd
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +130,7 @@ extra_rdoc_files: []
|
|
130
130
|
files:
|
131
131
|
- .gitignore
|
132
132
|
- .rubocop.yml
|
133
|
+
- .travis.yml
|
133
134
|
- Gemfile
|
134
135
|
- Guardfile
|
135
136
|
- LICENSE.txt
|