git-commit-mailer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/doc/text/news.md +14 -0
- data/lib/git-commit-mailer/html-mail-body-formatter.rb +44 -4
- data/lib/git-commit-mailer/mail-body-formatter.rb +10 -5
- data/lib/git-commit-mailer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50d31e3b90e4835ed78e0fa0ce384d0a49923ec0
|
4
|
+
data.tar.gz: 2f1ed65269c3bb8ca435994a888e2a505e30000e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f16915e4b9a8110cff707dfec33a6f7bcc7a70cfd08085f8c8afd9a9f36a7644eba3bf2ff4ef2cd9cc626e709467f240a314c8777ad9df3d822326ecaa58161
|
7
|
+
data.tar.gz: 3ebf21638075b42e1c4b7d02bd2e4a00599ebb9f22b65b90c45d31345f6927b47d782aa633af36faf9982a255f422324e0117af5b00ad03347e242f562dda248
|
data/.gitignore
CHANGED
data/doc/text/news.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.0.2 - 2015-06-09 {#version-1-0-2}
|
4
|
+
|
5
|
+
GitHub support improvement release!
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Supported GitHub mention link by `@XXX` form in commit message.
|
10
|
+
* Supported GitHub commit link by `HHHHHHH` form in commit message.
|
11
|
+
|
12
|
+
### Fixes
|
13
|
+
|
14
|
+
* Fixed a bug that single quote in commit message is treated as
|
15
|
+
GitHub issue link.
|
16
|
+
|
3
17
|
## 1.0.1 - 2015-06-09 {#version-1-0-1}
|
4
18
|
|
5
19
|
GitHub support improvement release!
|
@@ -214,19 +214,59 @@ class GitCommitMailer
|
|
214
214
|
def format_summary(summary)
|
215
215
|
case @mailer.repository_browser
|
216
216
|
when "github"
|
217
|
-
|
218
|
-
%Q(<a href="#{github_issue_url($1)}">\##{$1}</a>)
|
219
|
-
end
|
220
|
-
pre(linked_summary)
|
217
|
+
format_summary_github(summary)
|
221
218
|
else
|
222
219
|
pre(h(summary))
|
223
220
|
end
|
224
221
|
end
|
225
222
|
|
223
|
+
GITHUB_MARKUP_PATTERN_ISSUE = /\#\d+/
|
224
|
+
GITHUB_MARKUP_PATTERN_COMMIT = /[\da-fA-F]{7,}/
|
225
|
+
GITHUB_MARKUP_PATTERN_MENTION = /@[\da-zA-Z\-]+/
|
226
|
+
def format_summary_github(summary)
|
227
|
+
formatted_summary = summary.gsub(/
|
228
|
+
['&\"<>]|
|
229
|
+
#{GITHUB_MARKUP_PATTERN_ISSUE}|
|
230
|
+
#{GITHUB_MARKUP_PATTERN_COMMIT}|
|
231
|
+
#{GITHUB_MARKUP_PATTERN_MENTION}
|
232
|
+
/x) do |matched|
|
233
|
+
case matched
|
234
|
+
when /\A#{GITHUB_MARKUP_PATTERN_ISSUE}\z/
|
235
|
+
issue_number = matched.gsub(/\A\#/, "")
|
236
|
+
tag("a",
|
237
|
+
{
|
238
|
+
"href" => github_issue_url(issue_number),
|
239
|
+
},
|
240
|
+
h(matched))
|
241
|
+
when /\A#{GITHUB_MARKUP_PATTERN_COMMIT}\z/
|
242
|
+
revision = matched
|
243
|
+
tag("a",
|
244
|
+
{
|
245
|
+
"href" => commit_url_github(revision),
|
246
|
+
},
|
247
|
+
h(matched))
|
248
|
+
when /\A#{GITHUB_MARKUP_PATTERN_MENTION}\z/
|
249
|
+
user_name = matched.gsub(/\A@/, "")
|
250
|
+
tag("a",
|
251
|
+
{
|
252
|
+
"href" => user_url_github(user_name),
|
253
|
+
},
|
254
|
+
h(matched))
|
255
|
+
else
|
256
|
+
h(matched)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
pre(formatted_summary)
|
260
|
+
end
|
261
|
+
|
226
262
|
def github_issue_url(id)
|
227
263
|
"#{@mailer.github_base_url}/#{@mailer.github_user}/#{@mailer.github_repository}/issues/#{id}"
|
228
264
|
end
|
229
265
|
|
266
|
+
def user_url_github(name)
|
267
|
+
"#{@mailer.github_base_url}/#{name}"
|
268
|
+
end
|
269
|
+
|
230
270
|
def tag_start(name, attributes)
|
231
271
|
start_tag = "<#{name}"
|
232
272
|
unless attributes.empty?
|
@@ -31,12 +31,8 @@ class GitCommitMailer
|
|
31
31
|
def commit_url
|
32
32
|
case @mailer.repository_browser
|
33
33
|
when "github"
|
34
|
-
user = @mailer.github_user
|
35
|
-
repository = @mailer.github_repository
|
36
|
-
return nil if user.nil? or repository.nil?
|
37
|
-
base_url = @mailer.github_base_url
|
38
34
|
revision = @info.revision
|
39
|
-
|
35
|
+
commit_url_github(revision)
|
40
36
|
when "github-wiki"
|
41
37
|
file = (@info.updated_files + @info.added_files).first
|
42
38
|
commit_file_url_github_wiki(file)
|
@@ -49,6 +45,15 @@ class GitCommitMailer
|
|
49
45
|
end
|
50
46
|
end
|
51
47
|
|
48
|
+
def commit_url_github(revision)
|
49
|
+
user = @mailer.github_user
|
50
|
+
repository = @mailer.github_repository
|
51
|
+
return nil if user.nil? or repository.nil?
|
52
|
+
|
53
|
+
base_url = @mailer.github_base_url
|
54
|
+
"#{base_url}/#{user}/#{repository}/commit/#{revision}"
|
55
|
+
end
|
56
|
+
|
52
57
|
def commit_file_url_github_wiki(file)
|
53
58
|
return nil if file.nil?
|
54
59
|
|