capistrano-committed 0.0.3 → 0.0.4
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/.codeclimate.yml +20 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +1168 -0
- data/.travis.yml +8 -2
- data/Gemfile +4 -0
- data/README.md +25 -0
- data/icons/capricorn.png +0 -0
- data/icons/capricorn_equation.png +0 -0
- data/icons/capricorn_full.png +0 -0
- data/lib/capistrano/committed/github_api.rb +93 -36
- data/lib/capistrano/committed/i18n.rb +5 -0
- data/lib/capistrano/committed/version.rb +1 -1
- data/lib/capistrano/committed.rb +32 -11
- data/lib/capistrano/tasks/committed.rake +207 -168
- metadata +7 -2
|
@@ -1,32 +1,92 @@
|
|
|
1
1
|
namespace :committed do
|
|
2
2
|
task :check_prerequisites do
|
|
3
3
|
# Checks all the settings to make sure they are OK - mostly just checks type
|
|
4
|
-
{:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
{ committed_user: 'user',
|
|
5
|
+
committed_repo: 'repository' }.each do |variable, name|
|
|
6
|
+
fail TypeError, t('committed.error.prerequisites.nil',
|
|
7
|
+
variable: variable,
|
|
8
|
+
name: name) if
|
|
9
|
+
fetch(variable).nil?
|
|
10
|
+
|
|
11
|
+
fail ArgumentError, t('committed.error.prerequisites.empty',
|
|
12
|
+
variable: variable,
|
|
13
|
+
name: name) if
|
|
14
|
+
fetch(variable).empty?
|
|
9
15
|
end
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
I18n.t('capistrano.committed.error.prerequisites.hash', variable: 'committed_github_config') unless fetch(:committed_github_config).is_a?(Hash)
|
|
15
|
-
raise TypeError,
|
|
16
|
-
I18n.t('capistrano.committed.error.prerequisites.integer', variable: 'committed_revision_limit') unless fetch(:committed_revision_limit).is_a?(Integer)
|
|
17
|
-
raise TypeError,
|
|
18
|
-
I18n.t('capistrano.committed.error.prerequisites.integer', variable: 'committed_commit_buffer') unless fetch(:committed_commit_buffer).is_a?(Integer)
|
|
19
|
-
raise TypeError,
|
|
20
|
-
I18n.t('capistrano.committed.error.prerequisites.string_or_nil', variable: 'committed_output_path') unless fetch(:committed_output_path).is_a?(String) || fetch(:committed_output_path).nil?
|
|
21
|
-
raise TypeError,
|
|
22
|
-
I18n.t('capistrano.committed.error.prerequisites.string_or_regexp_or_nil', variable: 'committed_issue_match') unless fetch(:committed_issue_match).is_a?(String) || fetch(:committed_issue_match).is_a?(Regexp) || fetch(:committed_issue_match).nil?
|
|
23
|
-
raise TypeError,
|
|
24
|
-
I18n.t('capistrano.committed.error.prerequisites.string_or_nil', variable: 'committed_issue_url') unless fetch(:committed_issue_url).is_a?(String) || fetch(:committed_issue_url).nil?
|
|
17
|
+
fail TypeError, t('committed.error.prerequisites.hash',
|
|
18
|
+
variable: 'committed_github_config') unless
|
|
19
|
+
fetch(:committed_github_config).is_a?(Hash)
|
|
25
20
|
end
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
task :check_report_prerequisites do
|
|
23
|
+
# Checks all the settings to make sure they are OK - mostly just checks type
|
|
24
|
+
fail TypeError, t('committed.error.prerequisites.string',
|
|
25
|
+
variable: 'committed_revision_line') unless
|
|
26
|
+
fetch(:committed_revision_line).is_a?(String)
|
|
27
|
+
|
|
28
|
+
fail TypeError, t('committed.error.prerequisites.integer',
|
|
29
|
+
variable: 'committed_revision_limit') unless
|
|
30
|
+
fetch(:committed_revision_limit).is_a?(Integer)
|
|
31
|
+
|
|
32
|
+
fail TypeError, t('committed.error.prerequisites.integer',
|
|
33
|
+
variable: 'committed_commit_buffer') unless
|
|
34
|
+
fetch(:committed_commit_buffer).is_a?(Integer)
|
|
35
|
+
|
|
36
|
+
fail TypeError, t('committed.error.prerequisites.string_or_nil',
|
|
37
|
+
variable: 'committed_output_path') unless
|
|
38
|
+
fetch(:committed_output_path).is_a?(String) ||
|
|
39
|
+
fetch(:committed_output_path).nil?
|
|
40
|
+
|
|
41
|
+
fail TypeError, t('committed.error.prerequisites.string_or_regexp_or_nil',
|
|
42
|
+
variable: 'committed_issue_match') unless
|
|
43
|
+
fetch(:committed_issue_match).is_a?(String) ||
|
|
44
|
+
fetch(:committed_issue_match).is_a?(Regexp) ||
|
|
45
|
+
fetch(:committed_issue_match).nil?
|
|
46
|
+
|
|
47
|
+
fail TypeError, t('committed.error.prerequisites.string_or_nil',
|
|
48
|
+
variable: 'committed_issue_url') unless
|
|
49
|
+
fetch(:committed_issue_url).is_a?(String) ||
|
|
50
|
+
fetch(:committed_issue_url).nil?
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# task :register_deployment_pending do
|
|
54
|
+
# invoke 'committed:check_prerequisites'
|
|
55
|
+
|
|
56
|
+
# github = ::Capistrano::Committed::GithubApi.new(fetch(:committed_github_config))
|
|
57
|
+
# deployment = github.register_deployment(fetch(:committed_user),
|
|
58
|
+
# fetch(:committed_repo),
|
|
59
|
+
# fetch(:stage).to_s,
|
|
60
|
+
# fetch(:branch).to_s)
|
|
61
|
+
|
|
62
|
+
# return if deployment.nil?
|
|
63
|
+
|
|
64
|
+
# github.register_status(fetch(:committed_user),
|
|
65
|
+
# fetch(:committed_repo),
|
|
66
|
+
# deployment[:id],
|
|
67
|
+
# 'pending')
|
|
68
|
+
|
|
69
|
+
# set :committed_deployment_id, deployment[:id]
|
|
70
|
+
# end
|
|
71
|
+
|
|
72
|
+
# task :register_deployment_success do
|
|
73
|
+
# invoke 'committed:check_prerequisites'
|
|
74
|
+
|
|
75
|
+
# id = fetch(:committed_deployment_id)
|
|
76
|
+
# return if id.nil?
|
|
77
|
+
# end
|
|
78
|
+
|
|
79
|
+
# task :register_deployment_failure do
|
|
80
|
+
# invoke 'committed:check_prerequisites'
|
|
81
|
+
|
|
82
|
+
# id = fetch(:committed_deployment_id)
|
|
83
|
+
# return if id.nil?
|
|
84
|
+
# end
|
|
85
|
+
|
|
86
|
+
desc 'Generetes a report of commits and pull requests on the current stage'
|
|
28
87
|
task :generate do
|
|
29
88
|
invoke 'committed:check_prerequisites'
|
|
89
|
+
invoke 'committed:check_report_prerequisites'
|
|
30
90
|
|
|
31
91
|
# Only do this on the primary web server
|
|
32
92
|
on primary :web do
|
|
@@ -46,11 +106,11 @@ namespace :committed do
|
|
|
46
106
|
matches = search.match(line)
|
|
47
107
|
next unless matches[:branch].to_s == fetch(:branch).to_s
|
|
48
108
|
revisions[matches[:sha]] = {
|
|
49
|
-
:
|
|
50
|
-
:
|
|
51
|
-
:
|
|
52
|
-
:
|
|
53
|
-
:
|
|
109
|
+
branch: matches[:branch],
|
|
110
|
+
sha: matches[:sha],
|
|
111
|
+
release: matches[:release],
|
|
112
|
+
user: matches[:user],
|
|
113
|
+
entries: {}
|
|
54
114
|
}
|
|
55
115
|
# Only store a certain number of revisions
|
|
56
116
|
break if revisions.count == fetch(:committed_revision_limit)
|
|
@@ -58,36 +118,30 @@ namespace :committed do
|
|
|
58
118
|
|
|
59
119
|
# No revisions, no log
|
|
60
120
|
if revisions.empty?
|
|
61
|
-
info
|
|
62
|
-
|
|
63
|
-
|
|
121
|
+
info t('committed.error.runtime.revisions_empty',
|
|
122
|
+
branch: fetch(:branch).to_s,
|
|
123
|
+
stage: fetch(:stage).to_s)
|
|
64
124
|
return
|
|
65
125
|
end
|
|
66
126
|
|
|
67
127
|
# Sort revisions by release date
|
|
68
|
-
revisions = revisions.sort_by{|
|
|
128
|
+
revisions = revisions.sort_by { |_sha, matches| matches[:release] }.to_h
|
|
69
129
|
# Add the "next" revision
|
|
70
|
-
revisions.merge!({
|
|
71
|
-
:next => {
|
|
72
|
-
:entries => {}
|
|
73
|
-
}
|
|
74
|
-
})
|
|
130
|
+
revisions.merge!(next: { entries: {} })
|
|
75
131
|
# Reverse the order of revisions in the hash (most recent first)
|
|
76
132
|
revisions = revisions.to_a.reverse.to_h
|
|
77
|
-
revisions.merge!({
|
|
78
|
-
:previous => {
|
|
79
|
-
:entries => {}
|
|
80
|
-
}
|
|
81
|
-
})
|
|
133
|
+
revisions.merge!(previous: { entries: {} })
|
|
82
134
|
|
|
83
135
|
# Initialize the GitHub API client
|
|
84
136
|
github = ::Capistrano::Committed::GithubApi.new(fetch(:committed_github_config))
|
|
85
137
|
|
|
86
138
|
# Get the actual date of the commit referenced to by the revision
|
|
87
139
|
earliest_date = nil
|
|
88
|
-
revisions.each do |sha,
|
|
140
|
+
revisions.each do |sha, _revision|
|
|
89
141
|
next if sha == :next || sha == :previous
|
|
90
|
-
commit = github.get_commit(fetch(:committed_user),
|
|
142
|
+
commit = github.get_commit(fetch(:committed_user),
|
|
143
|
+
fetch(:committed_repo),
|
|
144
|
+
sha)
|
|
91
145
|
unless commit.nil?
|
|
92
146
|
earliest_date = commit[:commit][:committer][:date]
|
|
93
147
|
revisions[sha][:date] = earliest_date
|
|
@@ -96,14 +150,15 @@ namespace :committed do
|
|
|
96
150
|
|
|
97
151
|
# No commit data on revisions, no log
|
|
98
152
|
if earliest_date.nil?
|
|
99
|
-
info
|
|
100
|
-
|
|
101
|
-
|
|
153
|
+
info t('committed.error.runtime.revision_commit_missing',
|
|
154
|
+
branch: fetch(:branch).to_s,
|
|
155
|
+
stage: fetch(:stage).to_s)
|
|
102
156
|
return
|
|
103
157
|
end
|
|
104
158
|
|
|
105
159
|
# Go back an extra N day
|
|
106
|
-
|
|
160
|
+
buffer = fetch(:committed_commit_buffer) * 24 * 60 * 60
|
|
161
|
+
earliest_date = (Time.parse(earliest_date) - buffer).iso8601
|
|
107
162
|
revisions[:previous][:date] = earliest_date
|
|
108
163
|
|
|
109
164
|
# Get all the commits on this branch
|
|
@@ -114,10 +169,10 @@ namespace :committed do
|
|
|
114
169
|
|
|
115
170
|
# No commits, no log
|
|
116
171
|
if commits.empty?
|
|
117
|
-
info
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
172
|
+
info t('committed.error.runtime.commits_empty',
|
|
173
|
+
branch: fetch(:branch).to_s,
|
|
174
|
+
stage: fetch(:stage).to_s,
|
|
175
|
+
time: earliest_date)
|
|
121
176
|
return
|
|
122
177
|
end
|
|
123
178
|
|
|
@@ -128,7 +183,8 @@ namespace :committed do
|
|
|
128
183
|
revision_index = 0
|
|
129
184
|
commits.each do |sha, commit|
|
|
130
185
|
# Match to GitHub generated commit message, or don't
|
|
131
|
-
|
|
186
|
+
message = /^Merge pull request \#([0-9]+)/
|
|
187
|
+
matches = message.match(commit[:commit][:message])
|
|
132
188
|
next unless matches && matches[1]
|
|
133
189
|
|
|
134
190
|
# Get the pull request from GitHub
|
|
@@ -136,22 +192,25 @@ namespace :committed do
|
|
|
136
192
|
fetch(:committed_repo),
|
|
137
193
|
matches[1].to_i)
|
|
138
194
|
|
|
139
|
-
# Get the previous revisions commit time and the merge time of the pull
|
|
195
|
+
# Get the previous revisions commit time and the merge time of the pull
|
|
196
|
+
# request
|
|
140
197
|
previous_revision = revisions[revisions.keys[revision_index + 1]]
|
|
141
198
|
previous_revision_date = Time.parse(previous_revision[:date])
|
|
142
199
|
merged_at = Time.parse(pull_request[:info][:merged_at])
|
|
143
200
|
|
|
144
|
-
# Unless this pull request was merged before the previous release
|
|
201
|
+
# Unless this pull request was merged before the previous release
|
|
202
|
+
# reference was committed
|
|
145
203
|
unless merged_at > previous_revision_date
|
|
146
204
|
# Move to the previous revision
|
|
147
205
|
revision_index += 1
|
|
148
206
|
end
|
|
149
207
|
|
|
150
208
|
# Push pull request data in to the revision entries hash
|
|
151
|
-
revisions
|
|
152
|
-
|
|
153
|
-
:
|
|
154
|
-
:
|
|
209
|
+
key = revisions.keys[revision_index]
|
|
210
|
+
revisions[key][:entries][pull_request[:info][:merged_at]] = [{
|
|
211
|
+
type: :pull_request,
|
|
212
|
+
info: pull_request[:info],
|
|
213
|
+
commits: pull_request[:commits]
|
|
155
214
|
}]
|
|
156
215
|
|
|
157
216
|
# Delete commits which are in this pull request from the hash of commits
|
|
@@ -162,194 +221,172 @@ namespace :committed do
|
|
|
162
221
|
end
|
|
163
222
|
end
|
|
164
223
|
|
|
165
|
-
# Loop through remaining commits and push them into
|
|
224
|
+
# Loop through remaining commits and push them into the revision entries
|
|
225
|
+
# hash
|
|
166
226
|
revision_index = 0
|
|
167
|
-
commits.each do |
|
|
227
|
+
commits.each do |_sha, commit|
|
|
168
228
|
previous_revision = revisions[revisions.keys[revision_index + 1]]
|
|
169
229
|
previous_revision_date = Time.parse(previous_revision[:date])
|
|
170
|
-
|
|
230
|
+
date = commit[:commit][:committer][:date]
|
|
231
|
+
committed_at = Time.parse(date)
|
|
171
232
|
|
|
172
|
-
unless committed_at > previous_revision_date
|
|
173
|
-
revision_index += 1
|
|
174
|
-
end
|
|
233
|
+
revision_index += 1 unless committed_at > previous_revision_date
|
|
175
234
|
|
|
176
|
-
|
|
177
|
-
|
|
235
|
+
key = revisions.keys[revision_index]
|
|
236
|
+
if revisions[key][:entries][date].nil?
|
|
237
|
+
revisions[key][:entries][date] = []
|
|
178
238
|
end
|
|
179
|
-
revisions[
|
|
180
|
-
:
|
|
181
|
-
:
|
|
239
|
+
revisions[key][:entries][date] << {
|
|
240
|
+
type: :commit,
|
|
241
|
+
info: commit
|
|
182
242
|
}
|
|
183
243
|
end
|
|
184
244
|
|
|
185
245
|
# Loop through the revisions to create the output
|
|
186
246
|
output = []
|
|
187
247
|
revisions.each do |sha, revision|
|
|
188
|
-
|
|
189
248
|
# Build the revision header
|
|
190
249
|
output << ''
|
|
191
|
-
output << '
|
|
250
|
+
output << ('=' * 94)
|
|
192
251
|
case sha
|
|
193
252
|
when :next
|
|
194
|
-
output <<
|
|
253
|
+
output << t('committed.output.next_release')
|
|
195
254
|
when :previous
|
|
196
|
-
output <<
|
|
197
|
-
|
|
255
|
+
output << t('committed.output.previous_release',
|
|
256
|
+
time: revision[:date])
|
|
198
257
|
else
|
|
199
|
-
output <<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
258
|
+
output << t('committed.output.current_release',
|
|
259
|
+
release_time: Time.parse(revision[:release]).iso8601,
|
|
260
|
+
sha: revision[:sha],
|
|
261
|
+
commit_time: revision[:date])
|
|
203
262
|
end
|
|
204
|
-
output << '
|
|
263
|
+
output << ('=' * 94)
|
|
205
264
|
output << ''
|
|
206
265
|
|
|
207
266
|
# Loop through the entries in this revision
|
|
208
|
-
revision[:entries].sort_by{|date,
|
|
267
|
+
revision[:entries].sort_by { |date, _entries| date }.reverse.to_h.each do |_date, entries|
|
|
209
268
|
entries.each do |entry|
|
|
210
269
|
case entry[:type]
|
|
211
270
|
when :pull_request
|
|
212
271
|
# These are pull requests that are included in this revision
|
|
213
272
|
|
|
214
273
|
# Print out the pull request number and title
|
|
215
|
-
output <<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
output <<
|
|
274
|
+
output << format(' * %s',
|
|
275
|
+
t('committed.output.pull_request_number',
|
|
276
|
+
number: entry[:info][:number]))
|
|
277
|
+
output << format(' %s', entry[:info][:title])
|
|
219
278
|
output << ''
|
|
220
279
|
|
|
221
280
|
# Print out each line of the pull request description
|
|
222
281
|
lines = entry[:info][:body].chomp.split("\n")
|
|
223
282
|
unless lines.empty?
|
|
224
|
-
output <<
|
|
283
|
+
output << format(' %s', lines.join("\n "))
|
|
225
284
|
output << ''
|
|
226
285
|
end
|
|
227
286
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
I18n.t('capistrano.committed.output.issue_links'))
|
|
235
|
-
issues.each do |issue|
|
|
236
|
-
url = sprintf(fetch(:committed_issue_url), issue)
|
|
237
|
-
output << sprintf(' - %s', url)
|
|
238
|
-
end
|
|
239
|
-
output << ''
|
|
240
|
-
end
|
|
241
|
-
end
|
|
287
|
+
# Get any issue numbers referred to in the commit info and print
|
|
288
|
+
# links to them
|
|
289
|
+
urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
|
|
290
|
+
fetch(:committed_issue_url),
|
|
291
|
+
entry[:info][:title] + entry[:info][:body])
|
|
292
|
+
output += ::Capistrano::Committed.format_issue_urls(urls)
|
|
242
293
|
|
|
243
294
|
# Merger details
|
|
244
|
-
output <<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
output <<
|
|
248
|
-
|
|
249
|
-
|
|
295
|
+
output << format(' %s',
|
|
296
|
+
t('committed.output.merged_on',
|
|
297
|
+
time: entry[:info][:merged_at]))
|
|
298
|
+
output << format(' %s',
|
|
299
|
+
t('committed.output.merged_by',
|
|
300
|
+
login: entry[:info][:merged_by][:login]))
|
|
250
301
|
output << ''
|
|
251
302
|
|
|
252
303
|
# Print a link to the pull request on GitHub
|
|
253
|
-
output <<
|
|
304
|
+
output << format(' %s', entry[:info][:html_url])
|
|
254
305
|
output << ''
|
|
255
306
|
|
|
256
307
|
# Loop through the commits in this pull request
|
|
257
308
|
unless entry[:commits].nil?
|
|
258
309
|
entry[:commits].each do |commit|
|
|
259
|
-
output << '
|
|
310
|
+
output << (' ' + ('-' * 90))
|
|
260
311
|
output << ' |'
|
|
261
312
|
|
|
262
313
|
# Print the commit ref
|
|
263
|
-
output <<
|
|
264
|
-
|
|
265
|
-
|
|
314
|
+
output << format(' | * %s',
|
|
315
|
+
t('committed.output.commit_sha',
|
|
316
|
+
sha: commit[:sha]))
|
|
266
317
|
output << ' |'
|
|
267
318
|
|
|
268
319
|
# Print the commit message
|
|
269
320
|
lines = commit[:commit][:message].chomp.split("\n")
|
|
270
321
|
unless lines.empty?
|
|
271
|
-
output <<
|
|
322
|
+
output << format(' | > %s', lines.join("\n | > "))
|
|
272
323
|
output << ' |'
|
|
273
324
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
issues.each do |issue|
|
|
282
|
-
url = sprintf(fetch(:committed_issue_url), issue)
|
|
283
|
-
output << sprintf(' | - %s' , url)
|
|
284
|
-
end
|
|
285
|
-
output << ' |'
|
|
286
|
-
end
|
|
287
|
-
end
|
|
325
|
+
# Get any issue numbers referred to in the commit message
|
|
326
|
+
# and print links to them
|
|
327
|
+
urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
|
|
328
|
+
fetch(:committed_issue_url),
|
|
329
|
+
commit[:commit][:message])
|
|
330
|
+
output += ::Capistrano::Committed.format_issue_urls(urls,
|
|
331
|
+
' |')
|
|
288
332
|
end
|
|
289
333
|
|
|
290
334
|
# Committer details
|
|
291
|
-
output <<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
output <<
|
|
295
|
-
|
|
296
|
-
|
|
335
|
+
output << format(' | %s',
|
|
336
|
+
t('committed.output.committed_on',
|
|
337
|
+
time: commit[:commit][:committer][:date]))
|
|
338
|
+
output << format(' | %s',
|
|
339
|
+
t('committed.output.committed_by',
|
|
340
|
+
login: commit[:committer][:login]))
|
|
297
341
|
output << ' |'
|
|
298
342
|
|
|
299
343
|
# Print a link to the commit in GitHub
|
|
300
|
-
output <<
|
|
344
|
+
output << format(' | %s', commit[:html_url])
|
|
301
345
|
output << ' |'
|
|
302
346
|
end
|
|
303
|
-
output << '
|
|
347
|
+
output << (' ' + ('-' * 90))
|
|
304
348
|
output << ''
|
|
305
349
|
end
|
|
306
350
|
|
|
307
351
|
when :commit
|
|
308
|
-
# These are commits that are included in this revision, but are
|
|
352
|
+
# These are commits that are included in this revision, but are
|
|
353
|
+
# not in any pull requests
|
|
309
354
|
|
|
310
355
|
# Print the commit ref
|
|
311
|
-
output <<
|
|
312
|
-
|
|
313
|
-
|
|
356
|
+
output << format(' * %s',
|
|
357
|
+
t('committed.output.commit_sha',
|
|
358
|
+
sha: entry[:info][:sha]))
|
|
314
359
|
output << ''
|
|
315
360
|
|
|
316
361
|
# Print the commit message
|
|
317
362
|
lines = entry[:info][:commit][:message].chomp.split("\n")
|
|
318
363
|
unless lines.empty?
|
|
319
|
-
output <<
|
|
364
|
+
output << format(' > %s', lines.join("\n > "))
|
|
320
365
|
output << ''
|
|
321
366
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
I18n.t('capistrano.committed.output.issue_links'))
|
|
329
|
-
issues.each do |issue|
|
|
330
|
-
url = sprintf(fetch(:committed_issue_url), issue)
|
|
331
|
-
output << sprintf(' - %s', url)
|
|
332
|
-
end
|
|
333
|
-
output << ''
|
|
334
|
-
end
|
|
335
|
-
end
|
|
367
|
+
# Get any issue numbers referred to in the commit message and
|
|
368
|
+
# print links to them
|
|
369
|
+
urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
|
|
370
|
+
fetch(:committed_issue_url),
|
|
371
|
+
entry[:info][:commit][:message])
|
|
372
|
+
output += ::Capistrano::Committed.format_issue_urls(urls)
|
|
336
373
|
end
|
|
337
374
|
|
|
338
375
|
# Committer details
|
|
339
|
-
output <<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
output <<
|
|
343
|
-
|
|
344
|
-
|
|
376
|
+
output << format(' %s',
|
|
377
|
+
t('committed.output.committed_on',
|
|
378
|
+
time: entry[:info][:commit][:committer][:date]))
|
|
379
|
+
output << format(' %s',
|
|
380
|
+
t('committed.output.committed_by',
|
|
381
|
+
login: entry[:info][:committer][:login]))
|
|
345
382
|
output << ''
|
|
346
383
|
|
|
347
384
|
# Print a link to the commit in GitHub
|
|
348
|
-
output <<
|
|
385
|
+
output << format(' %s', entry[:info][:html_url])
|
|
349
386
|
output << ''
|
|
350
387
|
end
|
|
351
388
|
|
|
352
|
-
output << '
|
|
389
|
+
output << ('-' * 94)
|
|
353
390
|
output << ''
|
|
354
391
|
end
|
|
355
392
|
end
|
|
@@ -363,7 +400,7 @@ namespace :committed do
|
|
|
363
400
|
puts output
|
|
364
401
|
else
|
|
365
402
|
# Determine the output path and upload the output there
|
|
366
|
-
output_path =
|
|
403
|
+
output_path = format(fetch(:committed_output_path), current_path)
|
|
367
404
|
upload! StringIO.new(output.join("\n")), output_path
|
|
368
405
|
|
|
369
406
|
# Make sure the report is world readable
|
|
@@ -377,14 +414,16 @@ end
|
|
|
377
414
|
namespace :load do
|
|
378
415
|
task :defaults do
|
|
379
416
|
# See README for descriptions of each setting
|
|
380
|
-
set :committed_user, ->{ nil }
|
|
381
|
-
set :committed_repo, ->{ nil }
|
|
382
|
-
set :committed_revision_line, ->{
|
|
383
|
-
set :committed_github_config, ->{ {} }
|
|
384
|
-
set :committed_revision_limit, ->{ 10 }
|
|
385
|
-
set :committed_commit_buffer, ->{ 1 }
|
|
386
|
-
set :committed_output_path, ->{ '%s/public/committed.txt' }
|
|
387
|
-
set :committed_issue_match, ->{ '\[\s?([A-Z0-9]+\-[0-9]+)\s?\]' }
|
|
388
|
-
set :committed_issue_url, ->{ 'https://example.jira.com/browse/%s' }
|
|
417
|
+
set :committed_user, -> { nil }
|
|
418
|
+
set :committed_repo, -> { nil }
|
|
419
|
+
set :committed_revision_line, -> { t('revision_log_message') }
|
|
420
|
+
set :committed_github_config, -> { {} }
|
|
421
|
+
set :committed_revision_limit, -> { 10 }
|
|
422
|
+
set :committed_commit_buffer, -> { 1 }
|
|
423
|
+
set :committed_output_path, -> { '%s/public/committed.txt' }
|
|
424
|
+
set :committed_issue_match, -> { '\[\s?([A-Z0-9]+\-[0-9]+)\s?\]' }
|
|
425
|
+
set :committed_issue_url, -> { 'https://example.jira.com/browse/%s' }
|
|
426
|
+
set :committed_deployments, -> { false }
|
|
427
|
+
set :committed_deployment_id, -> { nil }
|
|
389
428
|
end
|
|
390
429
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-committed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Bauers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capistrano
|
|
@@ -88,8 +88,10 @@ executables: []
|
|
|
88
88
|
extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
|
90
90
|
files:
|
|
91
|
+
- ".codeclimate.yml"
|
|
91
92
|
- ".gitignore"
|
|
92
93
|
- ".rspec"
|
|
94
|
+
- ".rubocop.yml"
|
|
93
95
|
- ".travis.yml"
|
|
94
96
|
- Gemfile
|
|
95
97
|
- LICENSE
|
|
@@ -98,6 +100,9 @@ files:
|
|
|
98
100
|
- bin/console
|
|
99
101
|
- bin/setup
|
|
100
102
|
- capistrano-committed.gemspec
|
|
103
|
+
- icons/capricorn.png
|
|
104
|
+
- icons/capricorn_equation.png
|
|
105
|
+
- icons/capricorn_full.png
|
|
101
106
|
- lib/capistrano/committed.rb
|
|
102
107
|
- lib/capistrano/committed/github_api.rb
|
|
103
108
|
- lib/capistrano/committed/i18n.rb
|