teamistrano 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: b260fec1139a27f5461d577ba91af51a8aa653bf4cdeecb4520562f7e8463885
4
- data.tar.gz: ef2f1f3d7124c4974b03dd6df15f40df8f67f106989808496256f525ec8418ca
3
+ metadata.gz: bb3672668ddde42c56f76aa270281469a74da15de2383b2bf6bede77f2bdb2a7
4
+ data.tar.gz: 6cb495239fbfaacdc3f2093ab4fca8b0f39e9c6bb1452546d1fb4117468dde4b
5
5
  SHA512:
6
- metadata.gz: c1aa103c9454f50e176dbf8af3e048d8c968a79bffcd6df649bfa35d64b02b8d36cd21174824e8053b3a27f1ac3488e010b11849a232d0c94c42ae219789a400
7
- data.tar.gz: 2555e32000d65b66d6a4152e3be0293c3815ffd6e884b067405a6d16406a107fe553ddf92ce7ae5772ea517b3098ab68a99d65a904878868e39e23611811d8f4
6
+ metadata.gz: d4bb6058b4d56edb637b113136b05fbf0f49326ee471513584cbab75313e12db6e73212895945e78eb7a899500bc503e5c2f827ffeffb7bf30e366a40d705a60
7
+ data.tar.gz: 1eaaddbf352c75dcd48a0ce846c25d992f938e0f389b1102b31109bff79d7cab331992a62fad4c06483ef0a2b210e67c3a48894c89eaa93f96def591afd04511
@@ -67,9 +67,18 @@ module Teamistrano
67
67
  'themeColor' => @color
68
68
  }.to_json
69
69
  end
70
-
70
+
71
71
  # Post to Teams.
72
72
  def post
73
+ if @settings.use_curl?
74
+ post_with_curl
75
+ else
76
+ post_with_ruby
77
+ end
78
+ end
79
+
80
+ # Post to Teams.
81
+ def post_with_ruby
73
82
  uri = URI.parse( @settings.webhook_url )
74
83
  request = Net::HTTP::Post.new( uri.path )
75
84
  request.content_type = 'application/json'
@@ -80,6 +89,12 @@ module Teamistrano
80
89
  # Send the payload to the endpoint.
81
90
  n.start { |http| http.request( request ) }
82
91
  end
92
+
93
+ # Post to Teams with curl command.
94
+ def post_with_curl
95
+ url = @settings.webhook_url
96
+ `curl -is -X POST -H "Content-Type:application/json" -d '#{get_body}' '#{url}'`
97
+ end
83
98
 
84
99
  end
85
100
  end
@@ -14,6 +14,16 @@ module Teamistrano
14
14
  return @config[ :webhook ]
15
15
  end
16
16
 
17
+ # Should we use curl to post the message to teams?
18
+ def use_curl?
19
+ o = @config[ :curl ]
20
+ if o
21
+ return true
22
+ else
23
+ return false
24
+ end
25
+ end
26
+
17
27
  # Get the local user name.
18
28
  def get_local_user
19
29
  return ENV['USER'] || ENV['USERNAME']
@@ -1,3 +1,3 @@
1
1
  module Teamistrano
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano