capistrano-slack_notification 0.2.0 → 0.2.1

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: 5a3751a9dbea2e8a4dc7f4aad0662930a71c50a1
4
- data.tar.gz: 2a5eff99e99f41fd0ed59a793ed787be3ec5ac45
3
+ metadata.gz: 3d0bc0aa6c554da193b7984daf527581b702591b
4
+ data.tar.gz: 2e1b4100c0b0b327e7a915bc7339046dc0c92e85
5
5
  SHA512:
6
- metadata.gz: 5d8241e1d74a8a6c4e5715a344e4ba6c8ee1b6739d80912e30fe75fb0acc9ff4cecb408ddc0ef950c0cbdd540c90c8a436dd1abd3fb53e52cf275a5be84e69c5
7
- data.tar.gz: 5614e1ddbf62d81c0a39ec31a93195fbcddf0cf2a5861ffa7e535bab92395f5fe7ca8b86068944e7be01e8c68a354e19ae69b7697160077eaaa90ed1d5b8e914
6
+ metadata.gz: 536f88d610936a7b6801107d4842b0d756659084c17a57b3e3c599566d3008a7639cedc811199cedae519b048b4ae698b91e9251336b144b0df573ba49a38407
7
+ data.tar.gz: b81a1bc786d16cb50b5ece701aee93a214bfdf8f1cf279d0d9af40fa9f836e61696cf193e5ca514c71901e8c95b28b86a29e5f52934dfdaabf8723b4dc65467d
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module SlackNotification
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -56,11 +56,7 @@ namespace :slack do
56
56
  mrkdwn_in: ['text']
57
57
  }]
58
58
 
59
- if fetch(:slack_token)
60
- fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
61
- else
62
- JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
63
- end
59
+ build_http_body attachments
64
60
  }
65
61
 
66
62
  set :slack_failure_body, -> {
@@ -75,11 +71,7 @@ namespace :slack do
75
71
  mrkdwn_in: ['text']
76
72
  }]
77
73
 
78
- if fetch(:slack_token)
79
- fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
80
- else
81
- JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
82
- end
74
+ build_http_body attachments
83
75
  }
84
76
 
85
77
  set :slack_success_body, -> {
@@ -95,11 +87,7 @@ namespace :slack do
95
87
  mrkdwn_in: ['text']
96
88
  }]
97
89
 
98
- if fetch(:slack_token)
99
- fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
100
- else
101
- JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
102
- end
90
+ build_http_body attachments
103
91
  }
104
92
 
105
93
  set :slack_client, -> {
@@ -115,6 +103,14 @@ namespace :slack do
115
103
  end
116
104
  }
117
105
 
106
+ def build_http_body(attachments)
107
+ if fetch(:slack_token)
108
+ fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
109
+ else
110
+ JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
111
+ end
112
+ end
113
+
118
114
  def post_to_slack_with(body)
119
115
  run_locally do
120
116
  res = fetch(:slack_client).post fetch(:slack_path), body
@@ -127,9 +123,10 @@ namespace :slack do
127
123
  end
128
124
  end
129
125
 
130
- desc 'Post message to Slack (ex. cap production "slack:notify[yo!])"'
126
+ desc 'Post message to Slack (ex. cap production "slack:post[yo!]")'
131
127
  task :post, :message do |t, args|
132
- post_to_slack_with fetch(:slack_default_body).merge(text: args[:message])
128
+ attachments = [{ text: args[:message] }]
129
+ post_to_slack_with build_http_body(attachments)
133
130
  end
134
131
 
135
132
  desc 'Get channel ID by channel name from Slack (ex. cap production "slack:channel[general])"'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slack_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday