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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31d1efd6790453a5cc15c0c2400d7e3d6c629865
4
- data.tar.gz: ad13049f8d7a5c640a1be8e52db5888af619c870
3
+ metadata.gz: dc73b8eda4ee9eacfc54779da11566353567b730
4
+ data.tar.gz: beaa73eba18000bb19dc1bd26763497b33589311
5
5
  SHA512:
6
- metadata.gz: 7f638b9482640267f0b4f0e5172568705d7c1fea319613c981f737afc3d8c11adcf786782d1d5a2b578fde43708a78f906a6aa88455d6cbfef16e44c427e89e2
7
- data.tar.gz: a8f872b5fd43654733b24db3b4e76e7e7e3d9f210ad21f309c6ef01b2ece0251aae412fa1d5c8e04602bb4cce461acf5605a48a76cf73a2e5192f052d9aa48bc
6
+ metadata.gz: 96a096d9ef040a2225d88a00540195fa750a89d9c5006fc61a207ef9a78fa75423380de7de7d6bd43c00b08e6b898be84781850459e51b208669c96a7dab4c7c
7
+ data.tar.gz: 8e6ab134d965683b6bdf47bb8e04fe1daa2f4fa9618420870b08446f0c64b24a3b3ab0185042d135a3cf18c49da423dc51154582bc000fe8d05805018cca140b
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.0
5
+
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', '~> 1.7'
24
- spec.add_development_dependency 'rake', '~> 10.0'
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'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Etcdist
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -1 +1,3 @@
1
1
  dogs=bones
2
+ no/slashes=allowed
3
+ equation=e=mc^2
@@ -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' => { 'fish' => 'plankton', 'cows' => 'grass', 'dogs' => 'bones' })
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
@@ -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( '/foo/bar' => { 'fish' => 'plankton' } )
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( '/foo' => { 'cows' => 'grass'} )
77
+ writer.write('/foo' => { 'cows' => 'grass' })
78
78
  end
79
79
 
80
80
  end
data/spec/etcdist_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Etcdist do
4
4
 
5
- describe 'acceptance test - expects etcd running on localhost:4001' do
5
+ skip 'acceptance test - expects etcd running on localhost:4001' do
6
6
 
7
7
  let(:etcd_opts) do
8
8
  { host: 'localhost', port: 4001 }
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.3
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-03 00:00:00.000000000 Z
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: '1.7'
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: '1.7'
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: '10.0'
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: '10.0'
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