fake_consul 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7b78a2bb0aeea58fb1eb765df461c4128791181
4
- data.tar.gz: 9ce57b032ab5fb6f24ab7724ad44b85fd39129a5
3
+ metadata.gz: aec9fecb3e908f1f6368c526b299a5e91477a27e
4
+ data.tar.gz: d675d00b4a11fa6da15652b7bded3eace8df83d7
5
5
  SHA512:
6
- metadata.gz: 2b83d6dca2529d8ac3cf0591f186d00bffcdcada6804f8467684ecfff71a158da4ac1d06b27b49bab846d6a623813654c7071131bfc50d355c947831cf7fdea3
7
- data.tar.gz: d74b6a05a8b417ff4cd034b44c1777fede110928a947023e86e0bd3d4b2953b3c707add448cc0928aad223a9afbb963c58780e301fead86ce8c57eb204a6f022
6
+ metadata.gz: 0c0157f6022d00f42615d8879fb6beac6af0e1dfe2c652a1bd5b024405534e0fe6b098740bc7b1f8732d94e296dbc1e01382af8b6ebfa3334aedd1538964a37d
7
+ data.tar.gz: c6640f6d9f06ba00ec67a6b6befd84721d112b3e262d93ad80c0b80bc7ed870abb1d9e09823c99cef47fb0419ba172f932f8d3a0574c7a3c663aeda67a7f2a60
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [v0.0.3] - 2015-11-27
6
+ - Fix double implementation of server
7
+
5
8
  ## [v0.0.2] - 2015-11-27
6
9
  - More open dependency on activesupport
7
10
 
data/lib/fake_consul.rb CHANGED
@@ -1,58 +1,6 @@
1
1
  require "fake_consul/version"
2
+ require "fake_consul/server"
2
3
 
3
4
  module FakeConsul
4
- class Server < HashWithIndifferentAccess
5
5
 
6
- # Fake get
7
- #
8
- # Performs no http requests but stores data in local hash
9
- #
10
- # @param key [String]
11
- # @param options [Hash]
12
- # @options recurse [Boolean] wether to list all keys starting with this prefix
13
- # @param not_found [Symbol] unused/unimplemented
14
- # @param found [Symbol] not unused/unimplemented
15
- # @return [Array<Hash>] e.g. [{key: 'foo', value: 'bar'}]
16
- def get(key, options = nil, not_found = :reject, found = :return)
17
- if options[:recurse]
18
- find_keys_recursive(key)
19
- else
20
- consul_export_format(key)
21
- end
22
- end
23
-
24
- # Fake put
25
- #
26
- # Performs no http requests but retrieves data from local hash
27
- #
28
- # @param key [String]
29
- # @param options [Hash] unused/unimplemented
30
- # @return [Boolean] true :trollface:
31
- def kv_put(key, value, options = nil)
32
- self[key] = value
33
- true
34
- end
35
-
36
- private
37
-
38
- # Returns the keys in the following format:
39
- # [{key: `key`, value: 'bar'}]
40
- # @return [Array<Hash>]
41
- def consul_export_format(keys)
42
- Array(keys).map do
43
- {'key' => key, 'value' => self[key]}
44
- end
45
- end
46
-
47
- # Returns all keys that begin with the supplied `key`.
48
- #
49
- # @return [Array<Hash>] e.g. [{key: 'foo', value: 'bar'}]
50
- def find_keys_recursive(key)
51
- keys.select? do |_key|
52
- _key.to_s.start_with?(key.to_s)
53
- end.map do |_key|
54
- consul_export_format(_key)
55
- end
56
- end
57
- end
58
6
  end
@@ -1,3 +1,3 @@
1
1
  module FakeConsul
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Moore