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 +4 -4
- data/lib/teamistrano/notifier.rb +16 -1
- data/lib/teamistrano/settings.rb +10 -0
- data/lib/teamistrano/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb3672668ddde42c56f76aa270281469a74da15de2383b2bf6bede77f2bdb2a7
|
4
|
+
data.tar.gz: 6cb495239fbfaacdc3f2093ab4fca8b0f39e9c6bb1452546d1fb4117468dde4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4bb6058b4d56edb637b113136b05fbf0f49326ee471513584cbab75313e12db6e73212895945e78eb7a899500bc503e5c2f827ffeffb7bf30e366a40d705a60
|
7
|
+
data.tar.gz: 1eaaddbf352c75dcd48a0ce846c25d992f938e0f389b1102b31109bff79d7cab331992a62fad4c06483ef0a2b210e67c3a48894c89eaa93f96def591afd04511
|
data/lib/teamistrano/notifier.rb
CHANGED
@@ -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
|
data/lib/teamistrano/settings.rb
CHANGED
@@ -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']
|
data/lib/teamistrano/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|