slack_notification_generator 0.2.7 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5735b8ed3188c334a265071c046453d43cf4cfef
4
- data.tar.gz: 2410ce943e9f767ff7fd823164d5482332e2335b
3
+ metadata.gz: d057d9a75b3fdac90324442db68299bc4ac39957
4
+ data.tar.gz: e5e79fbeffa931bbebc38f1bc1a44caccf11c5d2
5
5
  SHA512:
6
- metadata.gz: c10af1627c21a5d88de4511bc5de45543492133d98bbc57483484e3cab502ea3e4980423459e259480ce97150ce91272f9128f6f4d8e95a250978b1dd935e7b2
7
- data.tar.gz: 4f9a7597dcf5a7341429dbb588352ffa469f100959e96f10925011c7c52a06a54e4dd0ffb1d9cc5f1d154df8dc09b7af6a8611da6ff6cd0efc3c1aba5f5fcd4e
6
+ metadata.gz: a380cc7474eef0b9b8de915fdb94c47ba2cb250bebdc360403ba7ab779799c5a0e8b20bdfe1b0ac6dae9a006159d39cbdf5d68a07f150a25eaff5356010057fc
7
+ data.tar.gz: 492b1bf1bf2b0abc557a719ec510b5800e72d3aa4f9eec3282c098c6474818687ee585ff5b2bdd151ec29890b4a94491fa54b4fb83df4cd3583c5d526fc8410a
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.2.8](https://github.com/jasonhutchens/slack_notification_generator/tree/v0.2.8) (2016-07-18)
4
+ [Full Changelog](https://github.com/jasonhutchens/slack_notification_generator/compare/v0.2.7...v0.2.8)
5
+
6
+ ## [v0.2.7](https://github.com/jasonhutchens/slack_notification_generator/tree/v0.2.7) (2015-09-23)
7
+ [Full Changelog](https://github.com/jasonhutchens/slack_notification_generator/compare/v0.2.6...v0.2.7)
8
+
3
9
  ## [v0.2.6](https://github.com/jasonhutchens/slack_notification_generator/tree/v0.2.6) (2015-09-12)
4
10
  [Full Changelog](https://github.com/jasonhutchens/slack_notification_generator/compare/v0.2.5...v0.2.6)
5
11
 
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :development do
6
6
  gem 'yard', '~> 0.8'
7
7
  gem 'rdoc', '~> 4.1'
8
8
  gem 'jeweler', '~> 2.0'
9
- gem 'byebug', '~> 5.0'
9
+ gem 'byebug', '~> 9.0'
10
10
  gem 'awesome_print', '~> 1.6'
11
11
  gem 'github_changelog_generator', '~> 1.6'
12
12
  end
@@ -1,68 +1,94 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- addressable (2.3.8)
5
- awesome_print (1.6.1)
6
- builder (3.2.2)
7
- byebug (5.0.0)
8
- columnize (= 0.9.0)
4
+ activesupport (5.1.4)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (~> 0.7)
7
+ minitest (~> 5.1)
8
+ tzinfo (~> 1.1)
9
+ addressable (2.4.0)
10
+ awesome_print (1.8.0)
11
+ builder (3.2.3)
12
+ byebug (9.1.0)
9
13
  chronic_duration (0.10.6)
10
14
  numerizer (~> 0.1.1)
11
- colorize (0.7.7)
12
- columnize (0.9.0)
15
+ concurrent-ruby (1.0.5)
13
16
  descendants_tracker (0.0.4)
14
17
  thread_safe (~> 0.3, >= 0.3.1)
15
- faraday (0.9.1)
18
+ faraday (0.9.2)
16
19
  multipart-post (>= 1.2, < 3)
17
- git (1.2.9.1)
18
- github_api (0.12.4)
19
- addressable (~> 2.3)
20
+ faraday-http-cache (2.0.0)
21
+ faraday (~> 0.8)
22
+ git (1.3.0)
23
+ github_api (0.16.0)
24
+ addressable (~> 2.4.0)
20
25
  descendants_tracker (~> 0.0.4)
21
26
  faraday (~> 0.8, < 0.10)
22
27
  hashie (>= 3.4)
23
- multi_json (>= 1.7.5, < 2.0)
24
- nokogiri (~> 1.6.6)
25
- oauth2
26
- github_changelog_generator (1.8.2)
27
- colorize (~> 0.7)
28
- github_api (~> 0.12)
29
- hashie (3.4.2)
30
- highline (1.7.3)
31
- jeweler (2.0.1)
28
+ mime-types (>= 1.16, < 3.0)
29
+ oauth2 (~> 1.0)
30
+ github_changelog_generator (1.14.3)
31
+ activesupport
32
+ faraday-http-cache
33
+ multi_json
34
+ octokit (~> 4.6)
35
+ rainbow (>= 2.1)
36
+ rake (>= 10.0)
37
+ retriable (~> 2.1)
38
+ hashie (3.5.6)
39
+ highline (1.7.8)
40
+ i18n (0.8.6)
41
+ jeweler (2.3.7)
32
42
  builder
33
- bundler (>= 1.0)
43
+ bundler (>= 1)
34
44
  git (>= 1.2.5)
35
- github_api
45
+ github_api (~> 0.16.0)
36
46
  highline (>= 1.6.15)
37
47
  nokogiri (>= 1.5.10)
48
+ psych (~> 2.2)
38
49
  rake
39
50
  rdoc
40
- jwt (1.5.1)
41
- mini_portile (0.6.2)
42
- multi_json (1.11.2)
43
- multi_xml (0.5.5)
51
+ semver2
52
+ jwt (1.5.6)
53
+ mime-types (2.99.3)
54
+ mini_portile2 (2.2.0)
55
+ minitest (5.10.3)
56
+ multi_json (1.12.2)
57
+ multi_xml (0.6.0)
44
58
  multipart-post (2.0.0)
45
- nokogiri (1.6.6.2)
46
- mini_portile (~> 0.6.0)
59
+ nokogiri (1.8.0)
60
+ mini_portile2 (~> 2.2.0)
47
61
  numerizer (0.1.1)
48
- oauth2 (1.0.0)
49
- faraday (>= 0.8, < 0.10)
62
+ oauth2 (1.4.0)
63
+ faraday (>= 0.8, < 0.13)
50
64
  jwt (~> 1.0)
51
65
  multi_json (~> 1.3)
52
66
  multi_xml (~> 0.5)
53
- rack (~> 1.2)
54
- rack (1.6.4)
55
- rake (10.4.2)
56
- rdoc (4.2.0)
57
- thread_safe (0.3.5)
58
- yard (0.8.7.6)
67
+ rack (>= 1.2, < 3)
68
+ octokit (4.7.0)
69
+ sawyer (~> 0.8.0, >= 0.5.3)
70
+ psych (2.2.4)
71
+ rack (2.0.3)
72
+ rainbow (2.2.2)
73
+ rake
74
+ rake (12.1.0)
75
+ rdoc (4.3.0)
76
+ retriable (2.1.0)
77
+ sawyer (0.8.1)
78
+ addressable (>= 2.3.5, < 2.6)
79
+ faraday (~> 0.8, < 1.0)
80
+ semver2 (3.4.2)
81
+ thread_safe (0.3.6)
82
+ tzinfo (1.2.3)
83
+ thread_safe (~> 0.1)
84
+ yard (0.9.9)
59
85
 
60
86
  PLATFORMS
61
87
  ruby
62
88
 
63
89
  DEPENDENCIES
64
90
  awesome_print (~> 1.6)
65
- byebug (~> 5.0)
91
+ byebug (~> 9.0)
66
92
  chronic_duration (~> 0.10)
67
93
  github_changelog_generator (~> 1.6)
68
94
  jeweler (~> 2.0)
@@ -70,4 +96,4 @@ DEPENDENCIES
70
96
  yard (~> 0.8)
71
97
 
72
98
  BUNDLED WITH
73
- 1.10.5
99
+ 1.14.6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.9
@@ -23,6 +23,21 @@ class SlackNotificationGenerator
23
23
  'Development'
24
24
  end
25
25
 
26
+ attachments = []
27
+
28
+ if ARGV[0] =~ /^:/
29
+ payload =
30
+ {
31
+ username: ENV['SLACK_USER'] || 'Notification',
32
+ icon_emoji: ARGV[0],
33
+ channel: ENV['SLACK_CHAN'] || '#general',
34
+ text: ARGV[1..-1].join(' '),
35
+ attachments: attachments
36
+ }
37
+ retval = `curl -X POST --data-urlencode 'payload=#{payload.to_json.gsub("'", "'\"'\"'")}' #{ENV['SLACK_HOOK']}`
38
+ return retval
39
+ end
40
+
26
41
  changelog = []
27
42
 
28
43
  this_tag = 'HEAD'
@@ -84,7 +99,6 @@ class SlackNotificationGenerator
84
99
  end
85
100
  other_commits.map! { |commit| format(commit) }
86
101
 
87
- attachments = []
88
102
  add_attachment(attachments, "Pull Requests", pull_requests)
89
103
  add_attachment(attachments, "Other Commits", other_commits)
90
104
  return if attachments.length == 0
@@ -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.7 ruby lib
5
+ # stub: slack_notification_generator 0.2.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "slack_notification_generator"
9
- s.version = "0.2.7"
9
+ s.version = "0.2.9"
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-09-23"
14
+ s.date = "2017-09-19"
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"]
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "UNLICENSE",
31
31
  "VERSION",
32
32
  "bin/slack_notification_generator",
33
- "hack.rb",
34
33
  "lib/slack_notification_generator.rb",
35
34
  "lib/slack_notification_generator/main.rb",
36
35
  "slack_notification_generator.gemspec"
@@ -49,7 +48,7 @@ Gem::Specification.new do |s|
49
48
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
50
49
  s.add_development_dependency(%q<rdoc>, ["~> 4.1"])
51
50
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
52
- s.add_development_dependency(%q<byebug>, ["~> 5.0"])
51
+ s.add_development_dependency(%q<byebug>, ["~> 9.0"])
53
52
  s.add_development_dependency(%q<awesome_print>, ["~> 1.6"])
54
53
  s.add_development_dependency(%q<github_changelog_generator>, ["~> 1.6"])
55
54
  else
@@ -57,7 +56,7 @@ Gem::Specification.new do |s|
57
56
  s.add_dependency(%q<yard>, ["~> 0.8"])
58
57
  s.add_dependency(%q<rdoc>, ["~> 4.1"])
59
58
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
60
- s.add_dependency(%q<byebug>, ["~> 5.0"])
59
+ s.add_dependency(%q<byebug>, ["~> 9.0"])
61
60
  s.add_dependency(%q<awesome_print>, ["~> 1.6"])
62
61
  s.add_dependency(%q<github_changelog_generator>, ["~> 1.6"])
63
62
  end
@@ -66,7 +65,7 @@ Gem::Specification.new do |s|
66
65
  s.add_dependency(%q<yard>, ["~> 0.8"])
67
66
  s.add_dependency(%q<rdoc>, ["~> 4.1"])
68
67
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
69
- s.add_dependency(%q<byebug>, ["~> 5.0"])
68
+ s.add_dependency(%q<byebug>, ["~> 9.0"])
70
69
  s.add_dependency(%q<awesome_print>, ["~> 1.6"])
71
70
  s.add_dependency(%q<github_changelog_generator>, ["~> 1.6"])
72
71
  end
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.7
4
+ version: 0.2.9
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-09-23 00:00:00.000000000 Z
11
+ date: 2017-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '5.0'
75
+ version: '9.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '5.0'
82
+ version: '9.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: awesome_print
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +127,6 @@ files:
127
127
  - UNLICENSE
128
128
  - VERSION
129
129
  - bin/slack_notification_generator
130
- - hack.rb
131
130
  - lib/slack_notification_generator.rb
132
131
  - lib/slack_notification_generator/main.rb
133
132
  - slack_notification_generator.gemspec
data/hack.rb DELETED
@@ -1,169 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'date'
4
- require 'json'
5
-
6
- # TODO: fail unless ENV['SLACK_HOOK'] is defined
7
-
8
- env =
9
- case ENV['CI_BRANCH']
10
- when 'master'
11
- 'Production'
12
- when 'develop'
13
- 'Staging'
14
- when /^release/
15
- 'Release'
16
- else
17
- 'Development'
18
- end
19
-
20
- changelog = []
21
-
22
- # get the most recent tag in the current branch
23
- this_tag = 'HEAD'
24
- prev_tag = `git describe --abbrev=0 --tags`.strip
25
-
26
- # use the previous tag if we've told it to
27
- if false
28
- this_tag = prev_tag
29
- prev_tag = `git describe --abbrev=0 --tags #{this_tag}^`.strip
30
- end
31
-
32
- def extract_commits(blob)
33
- commits = []
34
- commit = nil
35
- blob.split("\n").map(&:strip).each do |line|
36
- case line
37
- when /^commit ([0-9a-f]+)$/
38
- commits << commit unless commit.nil?
39
- commit = { hash: $1[0..6], skip: false }
40
- when /^Author: ([a-zA-Z]+)/
41
- commit[:author] = $1.downcase
42
- when /^Date: +(.*)$/
43
- commit[:date] = Date.parse($1)
44
- when /^([A-Z]+-[0-9]+)/
45
- commit[:issue] = $1
46
- if line =~ /#time +([0-9][^\s]*)/
47
- commit[:time] = $1
48
- end
49
- else
50
- commit[:message] ||= line unless line.empty?
51
- commit[:skip] = true if line =~ /\[skip ci\]/
52
- end
53
- end
54
- commits << commit unless commit.nil?
55
- commits
56
- end
57
-
58
- def add_attachment(store, title, data)
59
- return if data.nil? || data.length == 0
60
- # TODO: use UTF symbol for bullet point
61
- data.map! do |line|
62
- line.split("\n").map(&:strip).join("\n ")
63
- end
64
- store <<
65
- {
66
- title: title,
67
- text: data.map { |l| "* #{l}" }.join("\n")
68
- }
69
- end
70
-
71
- def format(commit)
72
- commit[:authors] ||= [commit[:author]].compact
73
- commit[:issues] ||= [commit[:issue]].compact
74
- commit[:times] ||= [commit[:time]].compact
75
- link =
76
- if commit[:pull]
77
- if ENV['SLACK_REPO']
78
- "<[#{ENV['SLACK_REPO']}/pull/#{commit[:pull]}|##{commit[:pull]}>"
79
- else
80
- "##{commit[:pull]}"
81
- end
82
- else
83
- if ENV['SLACK_REPO']
84
- "<[#{ENV['SLACK_REPO']}/commit/#{commit[:hash]}|##{commit[:hash]}>"
85
- else
86
- "##{commit[:hash]}"
87
- end
88
- end
89
- issues =
90
- commit[:issues].map do |issue|
91
- if ENV['SLACK_JIRA']
92
- "<[#{ENV['SLACK_JIRA']}/browse/#{issue}|#{issue}"
93
- else
94
- issue
95
- end
96
- end.join(', ')
97
- issues ||= "(no issues)"
98
- time = "(no time)"
99
- <<-eos
100
- #{commit[:date]} #{commit[:message]} (#{link})
101
- #{issues} | #{commit[:authors].join(', ')} | #{time}
102
- eos
103
- end
104
-
105
- commits = []
106
- commit = nil
107
- blob = `git log --merges #{this_tag} ^#{prev_tag}`
108
- blob.split("\n").map(&:strip).each do |line|
109
- case line
110
- when /^commit ([0-9a-f]+)$/
111
- commits << commit unless commit.nil?
112
- commit = { hash: $1[0..6] }
113
- when /^Merge: ([a-f0-9]+) ([a-f0-9]+)/
114
- commit[:range] = ($1..$2)
115
- when /^Author: ([a-zA-Z]+)/
116
- when /^Date: +(.*)$/
117
- commit[:date] = Date.parse($1)
118
- when /^Merge pull request #([0-9]*) /
119
- commit[:pull] = $1
120
- else
121
- commit[:message] ||= line unless line.empty?
122
- end
123
- end
124
- commits << commit unless commit.nil?
125
-
126
- pull_requests = []
127
- commit_filter = {}
128
- commits.each do |commit|
129
- next unless commit[:pull]
130
- blob = `git log --no-merges #{commit[:range].last} ^#{commit[:range].first}`
131
- commit[:authors] = []
132
- commit[:issues] = []
133
- commit[:times] = []
134
- extract_commits(blob).each do |child|
135
- commit_filter[child[:hash]] = true
136
- commit[:authors] << child[:author]
137
- commit[:issues] << child[:issue] if child[:issue]
138
- commit[:times] << child[:time] if child[:time]
139
- end
140
- commit[:authors].sort!.uniq!
141
- commit[:issues].sort!.uniq!
142
- pull_requests << commit
143
- end
144
- pull_requests.map! { |commit| format(commit) }
145
-
146
- blob = `git log --no-merges #{this_tag} ^#{prev_tag}`
147
- other_commits = []
148
- extract_commits(blob).each do |commit|
149
- next if commit_filter[commit[:hash]] || commit[:skip]
150
- other_commits << commit
151
- end
152
- other_commits.map! { |commit| format(commit) }
153
-
154
- attachments = []
155
- add_attachment(attachments, "Pull Requests", pull_requests)
156
- add_attachment(attachments, "Other Commits", other_commits)
157
- exit if attachments.length == 0
158
-
159
- payload =
160
- {
161
- username: ENV['SLACK_USER'] || 'Notification',
162
- icon_emoji: ENV['SLACK_ICON'] || ':bell:',
163
- channel: ENV['SLACK_CHAN'] || '#general',
164
- text: "*#{[ENV['SLACK_NAME'], env].compact.join(' ')} Release*",
165
- attachments: attachments
166
- }
167
-
168
- # submit payload to Slack
169
- puts payload.to_json