slack_notification_generator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +11 -3
- data/VERSION +1 -1
- data/lib/slack_notification_generator/main.rb +12 -4
- data/slack_notification_generator.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17b8366fb604ab0a1dc84392180ce94b862c7f12
|
4
|
+
data.tar.gz: df9200d1f27f6c81ca7f44e44997391a0810a387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 867209ce7836bc465047128e03e0fdc0ea6662aba434083a31fce41817cd45da1240aa995651180f6a3ce004e70402402f71983904e4739b10850628aecb726a
|
7
|
+
data.tar.gz: 0696334ceb2cf2dfe18efac70b83e5d91480afa98dc34c1f8176abe696c7dd95d173178ad4d604f00e006420fc4c6944da2c8731f1c67e0c9cf441b5251d31eb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.2.1](https://github.com/jasonhutchens/slack_notification_generator/tree/v0.2.1) (2015-08-29)
|
4
|
+
[Full Changelog](https://github.com/jasonhutchens/slack_notification_generator/compare/v0.2.0...v0.2.1)
|
5
|
+
|
3
6
|
## [v0.2.0](https://github.com/jasonhutchens/slack_notification_generator/tree/v0.2.0) (2015-08-29)
|
4
7
|
[Full Changelog](https://github.com/jasonhutchens/slack_notification_generator/compare/v0.1.1...v0.2.0)
|
5
8
|
|
data/README.md
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
Slack Notification Generator
|
5
5
|
============================
|
6
6
|
|
7
|
-
Sends a notification to a Slack channel to indicate that a branch of your
|
7
|
+
Sends a notification to a Slack channel to indicate that a branch of your
|
8
|
+
project has just been deployed by your CI system.
|
8
9
|
|
9
10
|
Usage
|
10
11
|
-----
|
@@ -23,10 +24,17 @@ Define the following environments in your CI system.
|
|
23
24
|
When your CI system deploys your project, run:
|
24
25
|
|
25
26
|
```
|
26
|
-
$ slack_notification_generator [HEAD]
|
27
|
+
$ slack_notification_generator <server> [HEAD]
|
27
28
|
```
|
28
29
|
|
29
|
-
Specify an argument of `HEAD` if you want to generate a notification relative to
|
30
|
+
Specify an argument of `HEAD` if you want to generate a notification relative to
|
31
|
+
the latest tag. Otherwise it will be assumed that you want to generate a
|
32
|
+
notification relative to the most recent pair of tags (for example, you may have
|
33
|
+
tagged `master` before triggering a deploy to production).
|
34
|
+
|
35
|
+
Specify a `server` URL if you'd like to include a link to the URL as part of the
|
36
|
+
notification title. This makes it easier for people reading the notification to
|
37
|
+
immediately click through to see the results of the deployment.
|
30
38
|
|
31
39
|
Assumptions
|
32
40
|
-----------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -28,11 +28,13 @@ class SlackNotificationGenerator
|
|
28
28
|
this_tag = 'HEAD'
|
29
29
|
prev_tag = `git describe --abbrev=0 --tags`.strip
|
30
30
|
|
31
|
-
|
31
|
+
if ARGV.select { |arg| arg == "HEAD" }.empty?
|
32
32
|
this_tag = prev_tag
|
33
33
|
prev_tag = `git describe --abbrev=0 --tags #{this_tag}^`.strip
|
34
34
|
end
|
35
35
|
|
36
|
+
server = ARGV.select { |arg| arg != "HEAD" }.first
|
37
|
+
|
36
38
|
commits = []
|
37
39
|
commit = nil
|
38
40
|
blob = `git log --merges #{this_tag} ^#{prev_tag}`
|
@@ -85,14 +87,20 @@ class SlackNotificationGenerator
|
|
85
87
|
attachments = []
|
86
88
|
add_attachment(attachments, "Pull Requests", pull_requests)
|
87
89
|
add_attachment(attachments, "Other Commits", other_commits)
|
88
|
-
|
90
|
+
return if attachments.length == 0
|
91
|
+
|
92
|
+
message = "*#{[ENV['SLACK_NAME'], env].compact.join(' ')} Release*"
|
93
|
+
if server
|
94
|
+
name = server.gsub(/^http.*\/\//, "").gsub(/\/$/, '')
|
95
|
+
message << " (<#{server}|#{name})>"
|
96
|
+
end
|
89
97
|
|
90
98
|
payload =
|
91
99
|
{
|
92
100
|
username: ENV['SLACK_USER'] || 'Notification',
|
93
101
|
icon_emoji: ENV['SLACK_ICON'] || ':bell:',
|
94
102
|
channel: ENV['SLACK_CHAN'] || '#general',
|
95
|
-
text:
|
103
|
+
text: message,
|
96
104
|
attachments: attachments
|
97
105
|
}
|
98
106
|
|
@@ -182,7 +190,7 @@ class SlackNotificationGenerator
|
|
182
190
|
commit[:message] = commit[:message][0, 50] + "..."
|
183
191
|
end
|
184
192
|
<<-eos
|
185
|
-
#{link} #{commit[:message]}
|
193
|
+
#{link} #{commit[:message]} (#{extras})
|
186
194
|
eos
|
187
195
|
end
|
188
196
|
end
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: slack_notification_generator 0.2.
|
5
|
+
# stub: slack_notification_generator 0.2.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "slack_notification_generator"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Jason Hutchens"]
|
14
|
-
s.date = "2015-08-
|
14
|
+
s.date = "2015-08-30"
|
15
15
|
s.description = "Does what it says on the tin."
|
16
16
|
s.email = "jasonhutchens@gmail.com"
|
17
17
|
s.executables = ["slack_notification_generator"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_notification_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hutchens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic_duration
|