dryad-consul 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 18ba39b82bec489a26cf303fe475a8af6b813e1e40ea3a97a1f510274c60a6ed
4
- data.tar.gz: 2f1d1c5c4d49e6ea8ddcd538f3e4fa98200544ac1255b05d021ad9021b19d4d1
3
+ metadata.gz: 2701d5efd60a687bd75565f917f7a35ef50b602189fb5e2d28ca4c7bee42c1d9
4
+ data.tar.gz: b8d4746b122dd6f08571649cad7f1659322042f8a668cc3c1f0713754613756e
5
5
  SHA512:
6
- metadata.gz: bee95523f20a4e59de3f131ef9aa91ddaf8b9ceaae2124c887f6ef245f6e0e419a8b4487652c341dfcded726c799a6cb295653c2612f6e81874fe9536d9b5d0c
7
- data.tar.gz: 154eec07bc0eebc8b4e38d4e474c0f3174c7673846d54c280e7c4be1db3f4fda02e1b02eb2db2012db0cbdd9d17b687c63fb7427df8a6cdd5f594253877fcfa0
6
+ metadata.gz: 339174599854c19e0a5c309949dcc3c20b3edc7d4ba46e143b2a5f6d13981fac86d9d6c82fa1cecda1a249ba33f62ad7c5f3a17f813466992fe7c8b55ef17e93
7
+ data.tar.gz: 355bb3667656cd5dad05072aa08b7da36801a3e574d8af4601b8f0b2dc0b49884b00c6a06415cc7f109786233f8d38a6c2c7dafa70c482e61f7ec8c30e8f31bd
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dryad-consul (0.1.0.alpha)
5
- diplomat
6
- dryad-core (= 0.1.0.alpha)
4
+ dryad-consul (0.1.1)
5
+ diplomat (~> 2.2, >= 2.2.4)
6
+ dryad-core (= 0.1.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -13,10 +13,10 @@ GEM
13
13
  diplomat (2.2.4)
14
14
  deep_merge (~> 1.0, >= 1.0.1)
15
15
  faraday (~> 0.9)
16
- dryad-core (0.1.0.alpha)
16
+ dryad-core (0.1.1)
17
17
  faraday (0.15.4)
18
18
  multipart-post (>= 1.2, < 3)
19
- multipart-post (2.1.0)
19
+ multipart-post (2.1.1)
20
20
  rake (10.5.0)
21
21
  rspec (3.8.0)
22
22
  rspec-core (~> 3.8.0)
data/dryad-consul.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency "dryad-core", Dryad::Consul::VERSION
25
- spec.add_dependency "diplomat"
25
+ spec.add_dependency "diplomat", "~> 2.2", ">= 2.2.4"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 2.0"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -15,19 +15,28 @@ module Dryad
15
15
  end
16
16
 
17
17
  def service_instances(name, schema, groups)
18
- all_services = ServiceClient.get(Dryad::Core::Service.full_name(schema, name), :all)
19
- services = []
18
+ all_services = ::Diplomat::Health.service(Dryad::Core::Service.full_name(schema, name))
19
+ service_instances = []
20
20
  all_services.each do |service|
21
- groups.each do |group|
22
- services << service if service.ServiceTags.include?("group = \"#{group}\"")
21
+ service_hash = service.Service
22
+ if !service_hash["Meta"].nil? && service_hash["Meta"].has_key?("group") &&
23
+ groups.include?(service_hash["Meta"]["group"])
24
+ service_instances << service_hash
25
+ else
26
+ groups.each do |group|
27
+ if service_hash["Tags"].include?("group = \"#{group}\"")
28
+ service_instances << service_hash
29
+ break
30
+ end
31
+ end
23
32
  end
24
33
  end
25
- services.map do |service|
34
+ service_instances.map do |service|
26
35
  Dryad::Core::ServiceInstance.new(
27
36
  name: name,
28
37
  schema: schema,
29
- address: service.ServiceAddress,
30
- port: service.ServicePort
38
+ address: service["Address"],
39
+ port: service["Port"]
31
40
  )
32
41
  end
33
42
  end
@@ -2,7 +2,7 @@ module Dryad
2
2
  module Consul
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dryad-consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pan Jie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dryad-core
@@ -16,28 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.0
19
+ version: 0.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.0
26
+ version: 0.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: diplomat
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.2'
31
34
  - - ">="
32
35
  - !ruby/object:Gem::Version
33
- version: '0'
36
+ version: 2.2.4
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.2'
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: 2.2.4
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement