capistrano-committed 0.0.4 → 0.0.5

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: 3f7e737f3941c42ba2a88694759a4c7bf520b1c3
4
- data.tar.gz: ec2aafa525e2a8d24d3c8b13aafb0e1b1fc196fa
3
+ metadata.gz: 7956dea8cdd9916c12ac47738e178f967aa6dd60
4
+ data.tar.gz: 72532339dbed78fc5472bc25ee2001680779ce71
5
5
  SHA512:
6
- metadata.gz: 4545760e6b244b887ca913f08ced4028494c6448da2735cba111dc75ce503799d593ea7a7fd9c6b00676d48fd67fc35da26d758170d29ecf19b4fa314ee12f1f
7
- data.tar.gz: 0dc9db86854d1860d3e75852169a1c0a87e96064884028c851f8d4d866385009c1692c6a16c0887ebd93e5790153807dc1e506e98f39030134d8295e7b6c1dbe
6
+ metadata.gz: 98f1eba991743031cd02660ad898f8c9b31bba89e1f4fee25aac3b45c55522779b815b8a01a35ea8d4b6af7ad371ad646110709d09e25d855c321719f4eaf518
7
+ data.tar.gz: 96a7a7717a3d734127af0b45c547605b96bfff79909b1567f40f66c753aaedd9074ec6a371a5d447605a5983cc8ec8e75df6cf42a5a98d08318d94087b2a378d
data/README.md CHANGED
@@ -103,7 +103,14 @@ set :committed_output_path, '%s/public/committed.txt'
103
103
  # Setting this to `nil` will disable issue matching altogether. Note that this
104
104
  # setting should specify a string, not a Ruby Regexp object. Specifying a Regexp
105
105
  # object might work, but it is not tested.
106
- set :committed_issue_match, '\[\s?([A-Z0-9]+\-[0-9]+)\s?\]'
106
+ set :committed_issue_match, '\[\s?([a-zA-Z0-9]+\-[0-9]+)\s?\]'
107
+
108
+ # This is an array of methods which should be applied to matched issue numbers
109
+ # before being formatted into the issue URL. An example might be to transform
110
+ # all matched issue numbers to uppercase, e.g. [project-123] to [PROJECT-123].
111
+ # The method names should be listed as symbols, e.g. [:upcase] and must be
112
+ # applicable to strings.
113
+ set :committed_issue_postprocess, -> { [] }
107
114
 
108
115
  # This is the URL structure for issues which are found. The default is for a
109
116
  # JIRA on Demand instance - e.g. https://example.jira.com/browse/ABC-12345
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Committed
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -5,13 +5,25 @@ require 'capistrano/committed/github_api'
5
5
  module Capistrano
6
6
  module Committed
7
7
  class << self
8
- def get_issue_urls(issue_pattern, url_pattern, message)
8
+ def get_issue_urls(issue_pattern, postprocess, url_pattern, message)
9
9
  fail TypeError, t('committed.error.helpers.valid_param',
10
10
  method: __callee__,
11
11
  param: 'issue_pattern') unless
12
12
  issue_pattern.is_a?(String) ||
13
13
  issue_pattern.is_a?(Regexp)
14
14
 
15
+ fail TypeError, t('committed.error.helpers.valid_param',
16
+ method: __callee__,
17
+ param: 'postprocess') unless
18
+ postprocess.is_a?(Array)
19
+
20
+ postprocess.each { |method|
21
+ fail TypeError, t('committed.error.helpers.valid_param',
22
+ method: __callee__,
23
+ param: format('postprocess[:%s]', method.to_s)) unless
24
+ method.is_a?(Symbol)
25
+ }
26
+
15
27
  fail TypeError, t('committed.error.helpers.valid_param',
16
28
  method: __callee__,
17
29
  param: 'url_pattern') unless
@@ -24,7 +36,13 @@ module Capistrano
24
36
 
25
37
  matches = message.scan(Regexp.new(issue_pattern))
26
38
  return [] unless matches
27
- matches.map { |m| format(url_pattern, m[0]) }
39
+ matches.map { |match|
40
+ issue = match[0]
41
+ postprocess.each { |method|
42
+ issue = issue.send(method)
43
+ }
44
+ format(url_pattern, issue)
45
+ }
28
46
  end
29
47
 
30
48
  def format_issue_urls(urls, pad = '')
@@ -287,6 +287,7 @@ namespace :committed do
287
287
  # Get any issue numbers referred to in the commit info and print
288
288
  # links to them
289
289
  urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
290
+ fetch(:committed_issue_postprocess),
290
291
  fetch(:committed_issue_url),
291
292
  entry[:info][:title] + entry[:info][:body])
292
293
  output += ::Capistrano::Committed.format_issue_urls(urls)
@@ -325,6 +326,7 @@ namespace :committed do
325
326
  # Get any issue numbers referred to in the commit message
326
327
  # and print links to them
327
328
  urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
329
+ fetch(:committed_issue_postprocess),
328
330
  fetch(:committed_issue_url),
329
331
  commit[:commit][:message])
330
332
  output += ::Capistrano::Committed.format_issue_urls(urls,
@@ -367,6 +369,7 @@ namespace :committed do
367
369
  # Get any issue numbers referred to in the commit message and
368
370
  # print links to them
369
371
  urls = ::Capistrano::Committed.get_issue_urls(fetch(:committed_issue_match),
372
+ fetch(:committed_issue_postprocess),
370
373
  fetch(:committed_issue_url),
371
374
  entry[:info][:commit][:message])
372
375
  output += ::Capistrano::Committed.format_issue_urls(urls)
@@ -414,16 +417,17 @@ end
414
417
  namespace :load do
415
418
  task :defaults do
416
419
  # See README for descriptions of each setting
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 }
420
+ set :committed_user, -> { nil }
421
+ set :committed_repo, -> { nil }
422
+ set :committed_revision_line, -> { t('revision_log_message') }
423
+ set :committed_github_config, -> { {} }
424
+ set :committed_revision_limit, -> { 10 }
425
+ set :committed_commit_buffer, -> { 1 }
426
+ set :committed_output_path, -> { '%s/public/committed.txt' }
427
+ set :committed_issue_match, -> { '\[\s?([a-zA-Z0-9]+\-[0-9]+)\s?\]' }
428
+ set :committed_issue_postprocess, -> { [] }
429
+ set :committed_issue_url, -> { 'https://example.jira.com/browse/%s' }
430
+ set :committed_deployments, -> { false }
431
+ set :committed_deployment_id, -> { nil }
428
432
  end
429
433
  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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano