capistrano3-consul 0.3.5 → 0.3.6

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: 798809c6aed6cf2f034067dbaaa89c136b3054ee397d4ea850d4db4bb80a8834
4
- data.tar.gz: e066f85dd0e0af201e33152b91fa5b60c7133cabfcd48d9bce6374cf2a6952a7
3
+ metadata.gz: ec4fea00b59c2d6725add8812d33b5b29590113de30754cea87e2cc2e8cd79e4
4
+ data.tar.gz: 409cfb7199c9e81cd88f1486f6938f2f488b5cbe27e24c2fd07d3242cf85ee37
5
5
  SHA512:
6
- metadata.gz: 5913b8f2de638df458a86a66ee9e42ae014e4f78ad2cd5b45af4e9f34639eb05366922bbf2f2f33dbe8757caa5c181675a6c542995587bdc1a091dd85fd95336
7
- data.tar.gz: dedd36b0502a81750dfd94fde7116a6af311ef0388873cf139a5de3c1557b9e08aad39e2d73282c4fa6e11603afee0fb04660a068c9ab906658977641c30b0d9
6
+ metadata.gz: 667513bf87e8b78a699d5bb04be0d49eb69e41b686f30d4e405f6dc50c0a707c6f872fa5d15cc256ca56c369f45811a4ff1acbea385812be89971dc3335466bf
7
+ data.tar.gz: 8488f45a37a04f2596ead0d43df62bdf309976eef7ad4443ddc2abbd69771b127dd3da8fe98b446a8a0d7a521fa273d708120ba84198e84e918ab80ceeb92e5f
@@ -6,9 +6,11 @@ module Capistrano
6
6
  module Consul
7
7
  def self.setup
8
8
  return if @url
9
+
9
10
  @url = fetch(:consul_url)
10
11
  @token = fetch(:consul_token)
11
12
  return false unless @url
13
+
12
14
  @ssh_gateway = fetch(:consul_ssh_gateway)
13
15
  if @ssh_gateway
14
16
  @gateway = Net::SSH::Gateway.new(@ssh_gateway[:host], @ssh_gateway[:username] || @ssh_gateway[:user], @ssh_gateway[:options] || {})
@@ -28,16 +30,24 @@ module Capistrano
28
30
  def consul_all_nodes(properties = {})
29
31
  Consul.setup
30
32
  Diplomat::Node.get_all.each_with_index do |node, index|
31
- extra_properties = index.zero? ? { primary: true } : {}
32
- server(node['Address'], properties.merge(extra_properties))
33
+ if block_given?
34
+ yield(node)
35
+ else
36
+ extra_properties = index.zero? ? { primary: true } : {}
37
+ server(node['Address'], properties.merge(extra_properties))
38
+ end
33
39
  end
34
40
  end
35
41
 
36
42
  def consul_service(service_name, properties = {})
37
43
  Consul.setup
38
44
  Diplomat::Service.get(service_name, :all).each_with_index do |node, index|
39
- extra_properties = index.zero? ? { primary: true } : {}
40
- server(node['Address'], properties.merge(extra_properties))
45
+ if block_given?
46
+ yield(node)
47
+ else
48
+ extra_properties = index.zero? ? { primary: true } : {}
49
+ server(node['Address'], properties.merge(extra_properties))
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Consul
3
- VERSION = "0.3.5"
3
+ VERSION = "0.3.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-consul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Fernandez (magec)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2020-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano