capistrano-slack 1.1.7 → 1.1.8

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: ac1c75e1572fbed90f8636c9f3c679422eb65e71
4
- data.tar.gz: f379418954ac4ee1be7642eeb95c26770d6b9837
3
+ metadata.gz: 26a6130cf204867a9f2dde0ff9e2d8997d0f4b38
4
+ data.tar.gz: 23b447fe47a9ac65e6584021456ee74b2e9afcb6
5
5
  SHA512:
6
- metadata.gz: b7471df7f8f4063928bf647b970c8a6c63d0629e7a5d5d8ee4c142575e30b986e9e677df169c9778210fae977844644933cb7f6dabf9bb20ce31c94c23b327a3
7
- data.tar.gz: 15cdd97c3cd12e2ce47bc79b151b183ae5682537cc2616952fe4adbc83e178a52ca829566e564a5a8dca33c64eafe1e4641d80ba1ef4c04fb74563ebf62c9bd9
6
+ metadata.gz: 4a0f967286203627f05be9b1656a7db4ce0fee69bbfa0db6f33b9bab7f97c0638dc2782328d597aea3f5964e7329fc19365b8751c0c740075be9efe1da6822d4
7
+ data.tar.gz: b1153cc552f22d36a1eba9fb3a578489aad4a1ee2aa417c228f2ea98c221dde395791fcad3d14b583101f35cc6a09d926c3ef7281a886d2084c69521783ba76c
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-slack"
8
- s.version = "1.1.7"
8
+ s.version = "1.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joshua Nichols", "Justin McNally"]
@@ -31,8 +31,21 @@ module Capistrano
31
31
  else
32
32
  "#{announced_deployer} is deploying #{application} to #{announced_stage}"
33
33
  end
34
- uri = URI("https://#{slack_subdomain}.slack.com/services/hooks/incoming-webhook?token=#{slack_token}")
35
- res = Net::HTTP.post_form(uri, :payload => {'channel' => slack_room, 'username' => 'deploybot', 'text' => announcement, "icon_emoji" => ":ghost:"}.to_json)
34
+
35
+
36
+ # Parse the API url and create an SSL connection
37
+ uri = URI.parse("https://#{slack_subdomain}.slack.com/services/hooks/incoming-webhook?token=#{slack_token}")
38
+ http = Net::HTTP.new(uri.host, uri.port)
39
+ http.use_ssl = true
40
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
41
+
42
+ # Create the post request and setup the form data
43
+ request = Net::HTTP::Post.new(uri.request_uri)
44
+ request.set_form_data(:payload => {'channel' => slack_room, 'username' => 'deploybot', 'text' => announcement, "icon_emoji" => ":ghost:"}.to_json)
45
+
46
+ # Make the actual request to the API
47
+ response = http.request(request)
48
+
36
49
  set(:start_time, Time.now)
37
50
  end
38
51
 
@@ -47,9 +60,22 @@ module Capistrano
47
60
  end_time = Time.now
48
61
  start_time = fetch(:start_time)
49
62
  elapsed = end_time.to_i - start_time.to_i
63
+
50
64
  msg = "#{announced_deployer} deployed #{application} successfully in #{elapsed} seconds."
51
- uri = URI("https://#{slack_subdomain}.slack.com/services/hooks/incoming-webhook?token=#{slack_token}")
52
- res = Net::HTTP.post_form(uri, :payload => {'channel' => slack_room, 'username' => 'deploybot', 'text' => msg, "icon_emoji" => ":ghost:"}.to_json)
65
+
66
+ # Parse the URI and handle the https connection
67
+ uri = URI.parse("https://#{slack_subdomain}.slack.com/services/hooks/incoming-webhook?token=#{slack_token}")
68
+ http = Net::HTTP.new(uri.host, uri.port)
69
+ http.use_ssl = true
70
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
71
+
72
+ # Create the post request and setup the form data
73
+ request = Net::HTTP::Post.new(uri.request_uri)
74
+ request.set_form_data(:payload => {'channel' => slack_room, 'username' => 'deploybot', 'text' => msg, "icon_emoji" => ":ghost:"}.to_json)
75
+
76
+ # Make the actual request to the API
77
+ response = http.request(request)
78
+
53
79
  rescue Faraday::Error::ParsingError
54
80
  # FIXME deal with crazy color output instead of rescuing
55
81
  # it's stuff like: ^[[0;33m and ^[[0m
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Nichols