git-commit-notifier 0.11.10 → 0.11.11
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.
- data/CHANGES.md +10 -1
- data/Gemfile +3 -1
- data/README.md +6 -2
- data/VERSION +1 -1
- data/config/git-notifier-config.example.yml +15 -1
- data/lib/git_commit_notifier/commit_hook.rb +22 -5
- data/lib/git_commit_notifier/diff_to_html.rb +3 -0
- data/lib/git_commit_notifier/git.rb +4 -0
- data/spec/spec_helper.rb +3 -0
- metadata +3 -3
data/CHANGES.md
CHANGED
@@ -2,10 +2,19 @@
|
|
2
2
|
|
3
3
|
## Not yet released
|
4
4
|
|
5
|
+
## Version 0.11.11
|
6
|
+
|
7
|
+
* Allow per branch mailing lists.
|
8
|
+
* Support for github option for link_files setting.
|
9
|
+
* Added possibility to automatically send a mail to the committer.
|
10
|
+
* Allow short_commit_id in subject template
|
11
|
+
|
12
|
+
## Version 0.11.10
|
13
|
+
|
5
14
|
* Display info message if the config.yml specified is not found.
|
6
15
|
* Strip whitespace after splitting emails for SMTP.
|
7
16
|
* Added prefer_git_config_mailinglist config variable.
|
8
|
-
* Allow to use one
|
17
|
+
* Allow to use one configuration file per all cgit projects.
|
9
18
|
* Support for Gitalist.
|
10
19
|
|
11
20
|
## Version 0.11.9
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
@@ -6,3 +6,5 @@ gem "rcov", :group => :test, :platforms => :mri_18
|
|
6
6
|
gem "erubis", "~> 2.7"
|
7
7
|
gem "ripper", :group => :development, :platforms => :mri_18
|
8
8
|
|
9
|
+
gem "coveralls", :require => false, :platforms => [:mri_19, :mri_20], :group => :development
|
10
|
+
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Git Commit Notifier
|
2
2
|
|
3
|
-
[](https://travis-ci.org/git-commit-notifier/git-commit-notifier)
|
4
|
+
[](https://codeclimate.com/github/git-commit-notifier/git-commit-notifier)
|
5
|
+
[](https://coveralls.io/r/git-commit-notifier/git-commit-notifier)
|
4
6
|
|
5
|
-
|
7
|
+
## Description
|
6
8
|
|
7
9
|
This gem sends email commit messages splitting commits that were pushed in one step.
|
8
10
|
The Email is delivered as text or HTML with changes refined per word. Emails
|
@@ -26,6 +28,8 @@ Example email:
|
|
26
28
|
|
27
29
|

|
28
30
|
|
31
|
+
__by Bodo Tasche (bodo 'at' wannawork 'dot' de), Akzhan Abdulin (akzhan 'dot' abdulin 'at' gmail 'dot' com), Csoma Zoltan (info 'at' railsprogrammer 'dot' net)__
|
32
|
+
|
29
33
|
## Requirements
|
30
34
|
|
31
35
|
* Ruby 1.8.7 or higher.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.11
|
@@ -32,6 +32,7 @@ show_summary: true
|
|
32
32
|
# branch_name - Name of the git branch
|
33
33
|
# slash_branch_name - /branch_name (master is "" unless show_master_branch_name)
|
34
34
|
# commit_id - The git commit id (hash)
|
35
|
+
# short_commit_id - The abbreviated git commit id (first 7 digits of the hash)
|
35
36
|
# description - The git description tag ("git describe --always")
|
36
37
|
# message - The commit message
|
37
38
|
# commit_number - The commit number within the push; 1-based
|
@@ -55,6 +56,13 @@ show_summary: true
|
|
55
56
|
# The recipient (or newsgroup for nntp) for the commit
|
56
57
|
# It can send to multiple destinations, just separate email addresses by ",".
|
57
58
|
mailinglist: developers@example.com,dev2@example.com,dev3@example.com,cto@example.com
|
59
|
+
# or setup mailing list per branch
|
60
|
+
# mailinglist:
|
61
|
+
# master: developers@example.com,dev2@example.com,dev3@example.com,cto@example.com
|
62
|
+
# default: otherbranches@example.com
|
63
|
+
|
64
|
+
# If set to true, the committer (author) will receive the commit mail as well.
|
65
|
+
send_mail_to_committer: false
|
58
66
|
|
59
67
|
# If set to true, the notifier will check first for a git config hooks.mailinglist
|
60
68
|
# variable and use the recipients listed there before checking for the recipient(s)
|
@@ -115,7 +123,7 @@ nntp_settings:
|
|
115
123
|
port: 119
|
116
124
|
|
117
125
|
# Decorate files and commit ids with link to a webview. Possible values: none, gitweb,
|
118
|
-
# gitorious, cgit, trac, gitlabhq, gitalist or redmine
|
126
|
+
# gitorious, cgit, trac, gitlabhq, gitalist, github or redmine
|
119
127
|
link_files: none
|
120
128
|
|
121
129
|
# If link_files is set to "gitweb", you need to configure the path to your gitweb
|
@@ -155,6 +163,12 @@ gitalist:
|
|
155
163
|
path: http://gitalist.example.com
|
156
164
|
project: test.git
|
157
165
|
|
166
|
+
# If link_files is set to "github", you need to configure the project name of
|
167
|
+
# your GitHub account
|
168
|
+
github:
|
169
|
+
path: https://github.com
|
170
|
+
project: project-name
|
171
|
+
|
158
172
|
# If link_files is set to "redmine", you need to configure the path to your redmine
|
159
173
|
# instance
|
160
174
|
redmine:
|
@@ -40,6 +40,18 @@ module GitCommitNotifier
|
|
40
40
|
@logger ||= Logger.new(config)
|
41
41
|
end
|
42
42
|
|
43
|
+
def email?(email)
|
44
|
+
!!(email =~ /@/)
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_committer_to_recipient(recipient, committer_email)
|
48
|
+
if email?(committer_email)
|
49
|
+
"#{recipient},#{committer_email}"
|
50
|
+
else
|
51
|
+
recipient
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
43
55
|
# Gets list of branches from {config} to include into notifications.
|
44
56
|
# @note All branches will be notified about if returned list is nil; otherwise only specified branches will be notifified about.
|
45
57
|
# @return [Array(String), NilClass] Array of branches to include into notifications or nil.
|
@@ -105,11 +117,14 @@ module GitCommitNotifier
|
|
105
117
|
slash_branch_name = "" if !config["show_master_branch_name"] && slash_branch_name == '/master'
|
106
118
|
|
107
119
|
# Identify email recipients
|
108
|
-
|
109
|
-
|
120
|
+
recipient = nil
|
121
|
+
recipient = Git.mailing_list_address if config["prefer_git_config_mailinglist"]
|
122
|
+
if config["mailinglist"].kind_of?(Hash)
|
123
|
+
recipient ||= config["mailinglist"][branch_name] || config["mailinglist"]["default"]
|
110
124
|
else
|
111
|
-
recipient
|
125
|
+
recipient ||= config["mailinglist"]
|
112
126
|
end
|
127
|
+
recipient ||= Git.mailing_list_address unless config["prefer_git_config_mailinglist"]
|
113
128
|
|
114
129
|
# If no recipients specified, bail out gracefully. This is not an error, and might be intentional
|
115
130
|
if recipient.nil? || recipient.length == 0
|
@@ -141,6 +156,7 @@ module GitCommitNotifier
|
|
141
156
|
# branch_name
|
142
157
|
# slash_branch_name
|
143
158
|
# commit_id (hash)
|
159
|
+
# short_commit_id (first few unique digits of the hash)
|
144
160
|
# description ('git describe' tag)
|
145
161
|
# short_message
|
146
162
|
# commit_number
|
@@ -153,6 +169,7 @@ module GitCommitNotifier
|
|
153
169
|
:branch_name => branch_name,
|
154
170
|
:slash_branch_name => slash_branch_name,
|
155
171
|
:commit_id => nil,
|
172
|
+
:short_commit_id => lambda { |commit_info| Git.short_commit_id(commit_info[:commit]) },
|
156
173
|
:description => lambda { |commit_info| Git.describe(commit_info[:commit]) },
|
157
174
|
:message => nil,
|
158
175
|
:commit_number => nil,
|
@@ -192,7 +209,7 @@ module GitCommitNotifier
|
|
192
209
|
|
193
210
|
emailer = Emailer.new(config,
|
194
211
|
:project_path => project_path,
|
195
|
-
:recipient => recipient,
|
212
|
+
:recipient => config["send_mail_to_committer"] ? add_committer_to_recipient(recipient, result[:commit_info][:email]) : recipient,
|
196
213
|
:from_address => config["from"] || result[:commit_info][:email],
|
197
214
|
:from_alias => result[:commit_info][:author],
|
198
215
|
:reply_to_address => config["reply_to_author"] ? result[:commit_info][:email] : config["from"] || result[:commit_info][:email],
|
@@ -239,7 +256,7 @@ module GitCommitNotifier
|
|
239
256
|
|
240
257
|
emailer = Emailer.new(config,
|
241
258
|
:project_path => project_path,
|
242
|
-
:recipient => recipient,
|
259
|
+
:recipient => config["send_mail_to_committer"] ? add_committer_to_recipient(recipient, result[:commit_info][:email]) : recipient,
|
243
260
|
:from_address => config["from"] || result[:commit_info][:email],
|
244
261
|
:from_alias => result[:commit_info][:author],
|
245
262
|
:reply_to_address => config["reply_to_author"] ? result[:commit_info][:email] : config["from"] || result[:commit_info][:email],
|
@@ -211,6 +211,8 @@ module GitCommitNotifier
|
|
211
211
|
end
|
212
212
|
elsif config["link_files"] == "gitalist" && config["gitalist"]
|
213
213
|
"<a href='#{config['gitalist']['path']}/#{config['gitalist']['project'] || Git.repo_name}/#{@current_commit}/blob/#{file_name}'>#{file_name}</a>"
|
214
|
+
elsif config["link_files"] == "github" && config["github"]
|
215
|
+
"<a href='#{config['github']['path']}/#{config['github']['project']}/#{Git.repo_name}/blob/#{@current_commit}/#{file_name}'>#{file_name}</a>"
|
214
216
|
elsif config["link_files"] == "redmine" && config["redmine"]
|
215
217
|
"<a href='#{config['redmine']['path']}/projects/#{config['redmine']['project'] || Git.repo_name}/repository/revisions/#{@current_commit}/entry/#{file_name}'>#{file_name}</a>"
|
216
218
|
else
|
@@ -510,6 +512,7 @@ module GitCommitNotifier
|
|
510
512
|
:gitlabhq => lambda { |config, commit| "<a href='#{config['gitlabhq']['path']}/#{Git.repo_name.gsub(".", "_")}/commits/#{commit}'>#{commit}</a>" },
|
511
513
|
:gitalist => lambda { |config, commit| "<a href='#{config['gitalist']['path']}/projects/#{config['gitalist']['project'] || Git.repo_name}/#{commit}/log'>#{commit}</a>" },
|
512
514
|
:redmine => lambda { |config, commit| "<a href='#{config['redmine']['path']}/projects/#{config['redmine']['project'] || Git.repo_name}/repository/revisions/#{commit}'>#{commit}</a>" },
|
515
|
+
:github => lambda { |config, commit| "<a href='#{config['github']['path']}/#{config['github']['project']}/#{Git.repo_name}/commit/#{commit}'>#{commit}</a>" },
|
513
516
|
:default => lambda { |config, commit| commit.to_s }
|
514
517
|
}.freeze
|
515
518
|
|
@@ -107,6 +107,10 @@ class GitCommitNotifier::Git
|
|
107
107
|
from_shell("git rev-parse '#{param}'").strip
|
108
108
|
end
|
109
109
|
|
110
|
+
def short_commit_id(param)
|
111
|
+
from_shell("git rev-parse --short '#{param}'").strip
|
112
|
+
end
|
113
|
+
|
110
114
|
def branch_head(treeish)
|
111
115
|
from_shell("git rev-parse #{treeish}").strip
|
112
116
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-commit-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: diff-lcs
|
@@ -339,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
339
339
|
version: '0'
|
340
340
|
segments:
|
341
341
|
- 0
|
342
|
-
hash:
|
342
|
+
hash: 778864539407809625
|
343
343
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
344
|
none: false
|
345
345
|
requirements:
|