git-commit-notifier 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/README.md +9 -8
- data/VERSION +1 -1
- data/config/{git-notifier-config.yml.sample → git-notifier-config.example.yml} +0 -0
- data/git-commit-notifier.gemspec +8 -9
- data/lib/git_commit_notifier/diff_to_html.rb +15 -8
- data/lib/git_commit_notifier/git.rb +2 -1
- data/spec/lib/git_commit_notifier/git_spec.rb +4 -4
- data/template/email.html.erb +4 -3
- metadata +47 -49
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -28,17 +28,18 @@ Example email:
|
|
28
28
|
|
29
29
|
## Requirements
|
30
30
|
|
31
|
-
* Ruby 1.8.7 or higher
|
32
|
-
* RubyGems
|
31
|
+
* Ruby 1.8.7 or higher.
|
32
|
+
* RubyGems.
|
33
|
+
* libxml2 and libxslt with headers (see [nokogiri installation notes](http://nokogiri.org/tutorials/installing_nokogiri.html) for details).
|
33
34
|
|
34
|
-
We do not support ruby 1.8.6 because of nokogiri gem.
|
35
|
+
We do not support ruby 1.8.6 because of nokogiri gem requirements.
|
35
36
|
|
36
37
|
## Installing and Configuring
|
37
38
|
|
38
39
|
Install the gem:
|
39
40
|
|
40
41
|
```bash
|
41
|
-
|
42
|
+
gem install git-commit-notifier
|
42
43
|
```
|
43
44
|
|
44
45
|
After you installed the gem, you need to configure your git repository. Add a file called
|
@@ -51,13 +52,13 @@ git-commit-notifier path_to_config.yml
|
|
51
52
|
|
52
53
|
(Don't forget to make that file executable.)
|
53
54
|
|
54
|
-
An example for the config file can be found in [config/git-notifier-config.yml
|
55
|
+
An example for the config file can be found in [config/git-notifier-config.example.yml](http://github.com/bitboxer/git-commit-notifier/blob/master/config/git-notifier-config.example.yml).
|
55
56
|
|
56
57
|
If you want to send mails on each commit instead on each push, you should add a file called "post-commit" with this content:
|
57
58
|
|
58
59
|
```bash
|
59
|
-
|
60
|
-
|
60
|
+
#!/bin/sh
|
61
|
+
echo "HEAD^1 HEAD refs/heads/master" | git-commit-notifier path_to_config.yml
|
61
62
|
```
|
62
63
|
|
63
64
|
## Integration with Redmine, Bugzilla, MediaWiki
|
@@ -117,7 +118,7 @@ The file _previously.txt_ is created at the first commit. If you moved the file
|
|
117
118
|
|
118
119
|
## Credits
|
119
120
|
|
120
|
-
Thanks for [Primalgrasp](http://www.primalgrasp.com) and [Undev](http://undev.ru/) for sponsoring this work.
|
121
|
+
Thanks for [putpat.tv](http://www.putpat.tv), [Primalgrasp](http://www.primalgrasp.com) and [Undev](http://undev.ru/) for sponsoring this work.
|
121
122
|
|
122
123
|
## License
|
123
124
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.2
|
File without changes
|
data/git-commit-notifier.gemspec
CHANGED
@@ -25,17 +25,16 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
s.specification_version = 3
|
27
27
|
|
28
|
-
s.add_runtime_dependency(%q<diff-lcs>, ["
|
29
|
-
s.add_runtime_dependency(%q<nntp>, ["
|
30
|
-
s.add_runtime_dependency(%q<premailer>, ["
|
31
|
-
s.add_runtime_dependency(%q<nokogiri>, ["
|
32
|
-
s.add_development_dependency(%q<rake>, ["!= 0.9.0"])
|
33
|
-
s.add_development_dependency(%q<bundler>, ["
|
28
|
+
s.add_runtime_dependency(%q<diff-lcs>, ["~> 1.1.2"])
|
29
|
+
s.add_runtime_dependency(%q<nntp>, ["~> 1.0"])
|
30
|
+
s.add_runtime_dependency(%q<premailer>, ["~> 1.7", "!= 1.7.2"])
|
31
|
+
s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4"])
|
32
|
+
s.add_development_dependency(%q<rake>, ["~> 0.8", "!= 0.9.0"])
|
33
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0", ">=1.0.10"])
|
34
34
|
s.add_development_dependency(%q<code-cleaner>, [">= 0"])
|
35
35
|
s.add_development_dependency(%q<rspec-core>, [">= 0"])
|
36
36
|
s.add_development_dependency(%q<rspec-expectations>, [">= 0"])
|
37
|
-
s.add_development_dependency(%q<rr>, ["
|
38
|
-
s.add_development_dependency(%q<faker>, ["
|
39
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
37
|
+
s.add_development_dependency(%q<rr>, ["~> 1.0"])
|
38
|
+
s.add_development_dependency(%q<faker>, ["~> 0.9.5"])
|
40
39
|
end
|
41
40
|
|
@@ -313,17 +313,22 @@ module GitCommitNotifier
|
|
313
313
|
end
|
314
314
|
|
315
315
|
def extract_commit_info_from_git_show_output(content)
|
316
|
-
result = { :message => [], :commit => '', :author => '', :date => '', :email => ''
|
316
|
+
result = { :message => [], :commit => '', :author => '', :date => '', :email => '',
|
317
|
+
:committer => '', :commit_date => '', :committer_email => ''}
|
317
318
|
content.split("\n").each do |line|
|
318
319
|
if line =~ /^diff/ # end of commit info, return results
|
319
320
|
return result
|
320
|
-
elsif line =~ /^commit/
|
321
|
+
elsif line =~ /^commit /
|
321
322
|
result[:commit] = line[7..-1]
|
322
|
-
elsif line =~ /^Author
|
323
|
-
result[:author], result[:email] = author_name_and_email(line[
|
324
|
-
elsif line =~ /^
|
325
|
-
result[:date] = line[
|
326
|
-
elsif line =~ /^
|
323
|
+
elsif line =~ /^Author:/
|
324
|
+
result[:author], result[:email] = author_name_and_email(line[12..-1])
|
325
|
+
elsif line =~ /^AuthorDate:/
|
326
|
+
result[:date] = line[12..-1]
|
327
|
+
elsif line =~ /^Commit:/
|
328
|
+
result[:committer], result[:commit_email] = author_name_and_email(line[12..-1])
|
329
|
+
elsif line =~ /^CommitDate:/
|
330
|
+
result[:commit_date] = line[12..-1]
|
331
|
+
elsif line =~ /^Merge:/
|
327
332
|
result[:merge] = line[7..-1]
|
328
333
|
else
|
329
334
|
clean_line = line.strip
|
@@ -457,7 +462,9 @@ module GitCommitNotifier
|
|
457
462
|
|
458
463
|
title += "<strong>Branch:</strong> #{CGI.escapeHTML(branch_name)}\n<br />"
|
459
464
|
title += "<strong>Date:</strong> #{CGI.escapeHTML commit_info[:date]}\n<br />"
|
460
|
-
title += "<strong>Author:</strong> #{CGI.escapeHTML(commit_info[:author])} <#{commit_info[:email]}>\n
|
465
|
+
title += "<strong>Author:</strong> #{CGI.escapeHTML(commit_info[:author])} <#{commit_info[:email]}>\n<br />"
|
466
|
+
title += "<strong>Committer:</strong> #{CGI.escapeHTML(commit_info[:committer])} <#{commit_info[:commit_email]}>\n</div>"
|
467
|
+
|
461
468
|
text = "#{raw_diff}"
|
462
469
|
text += "#{changed_files}\n\n\n"
|
463
470
|
|
@@ -8,12 +8,13 @@ class GitCommitNotifier::Git
|
|
8
8
|
|
9
9
|
def show(rev, ignore_whitespace)
|
10
10
|
gitopt = ""
|
11
|
+
gitopt += " --pretty=fuller"
|
11
12
|
gitopt += " -w" if ignore_whitespace
|
12
13
|
from_shell("git show #{rev.strip}#{gitopt}")
|
13
14
|
end
|
14
15
|
|
15
16
|
def log(rev1, rev2)
|
16
|
-
from_shell("git log #{rev1}..#{rev2}").strip
|
17
|
+
from_shell("git log --pretty=fuller #{rev1}..#{rev2}").strip
|
17
18
|
end
|
18
19
|
|
19
20
|
def changed_files(rev1, rev2)
|
@@ -14,18 +14,18 @@ describe GitCommitNotifier::Git do
|
|
14
14
|
describe :show do
|
15
15
|
it "should get data from shell: git show without whitespaces" do
|
16
16
|
expected = 'some data from git show'
|
17
|
-
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} -w") { expected }
|
17
|
+
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --pretty=fuller -w") { expected }
|
18
18
|
GitCommitNotifier::Git.show(SAMPLE_REV, true).should == expected
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should get data from shell: git show with whitespaces" do
|
22
22
|
expected = 'some data from git show'
|
23
|
-
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV}") { expected }
|
23
|
+
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --pretty=fuller") { expected }
|
24
24
|
GitCommitNotifier::Git.show(SAMPLE_REV, false).should == expected
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should strip given revision" do
|
28
|
-
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} -w")
|
28
|
+
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --pretty=fuller -w")
|
29
29
|
GitCommitNotifier::Git.show("#{SAMPLE_REV}\n", true)
|
30
30
|
end
|
31
31
|
end
|
@@ -73,7 +73,7 @@ describe GitCommitNotifier::Git do
|
|
73
73
|
|
74
74
|
describe :log do
|
75
75
|
it "should run git log with given args" do
|
76
|
-
mock(GitCommitNotifier::Git).from_shell("git log #{SAMPLE_REV}..#{SAMPLE_REV_2}") { " ok " }
|
76
|
+
mock(GitCommitNotifier::Git).from_shell("git log --pretty=fuller #{SAMPLE_REV}..#{SAMPLE_REV_2}") { " ok " }
|
77
77
|
GitCommitNotifier::Git.log(SAMPLE_REV, SAMPLE_REV_2).should == "ok"
|
78
78
|
end
|
79
79
|
end
|
data/template/email.html.erb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
<html><
|
1
|
+
<html><head>
|
2
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
2
3
|
<style type="text/css">
|
3
|
-
|
4
|
+
<%= stylesheet_string %>
|
4
5
|
</style>
|
5
6
|
</head>
|
6
7
|
<body>
|
7
|
-
|
8
|
+
<%= @html_message %>
|
8
9
|
</body>
|
9
10
|
</html>
|
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.10.
|
4
|
+
version: 0.10.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,78 +10,87 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-08 00:00:00.000000000 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: diff-lcs
|
18
|
-
requirement: &
|
18
|
+
requirement: &70327232962420 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 1.1.2
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70327232962420
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nntp
|
29
|
-
requirement: &
|
29
|
+
requirement: &70327232961940 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
34
|
+
version: '1.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70327232961940
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: premailer
|
40
|
-
requirement: &
|
40
|
+
requirement: &70327232961440 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.7
|
45
|
+
version: '1.7'
|
46
|
+
- - ! '!='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.7.2
|
46
49
|
type: :runtime
|
47
50
|
prerelease: false
|
48
|
-
version_requirements: *
|
51
|
+
version_requirements: *70327232961440
|
49
52
|
- !ruby/object:Gem::Dependency
|
50
53
|
name: nokogiri
|
51
|
-
requirement: &
|
54
|
+
requirement: &70327225451960 !ruby/object:Gem::Requirement
|
52
55
|
none: false
|
53
56
|
requirements:
|
54
|
-
- -
|
57
|
+
- - ~>
|
55
58
|
- !ruby/object:Gem::Version
|
56
|
-
version: 1.4
|
59
|
+
version: '1.4'
|
57
60
|
type: :runtime
|
58
61
|
prerelease: false
|
59
|
-
version_requirements: *
|
62
|
+
version_requirements: *70327225451960
|
60
63
|
- !ruby/object:Gem::Dependency
|
61
64
|
name: rake
|
62
|
-
requirement: &
|
65
|
+
requirement: &70327225692660 !ruby/object:Gem::Requirement
|
63
66
|
none: false
|
64
67
|
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0.8'
|
65
71
|
- - ! '!='
|
66
72
|
- !ruby/object:Gem::Version
|
67
73
|
version: 0.9.0
|
68
74
|
type: :development
|
69
75
|
prerelease: false
|
70
|
-
version_requirements: *
|
76
|
+
version_requirements: *70327225692660
|
71
77
|
- !ruby/object:Gem::Dependency
|
72
78
|
name: bundler
|
73
|
-
requirement: &
|
79
|
+
requirement: &70327226404100 !ruby/object:Gem::Requirement
|
74
80
|
none: false
|
75
81
|
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '1.0'
|
76
85
|
- - ! '>='
|
77
86
|
- !ruby/object:Gem::Version
|
78
87
|
version: 1.0.10
|
79
88
|
type: :development
|
80
89
|
prerelease: false
|
81
|
-
version_requirements: *
|
90
|
+
version_requirements: *70327226404100
|
82
91
|
- !ruby/object:Gem::Dependency
|
83
92
|
name: code-cleaner
|
84
|
-
requirement: &
|
93
|
+
requirement: &70327226682620 !ruby/object:Gem::Requirement
|
85
94
|
none: false
|
86
95
|
requirements:
|
87
96
|
- - ! '>='
|
@@ -89,10 +98,10 @@ dependencies:
|
|
89
98
|
version: '0'
|
90
99
|
type: :development
|
91
100
|
prerelease: false
|
92
|
-
version_requirements: *
|
101
|
+
version_requirements: *70327226682620
|
93
102
|
- !ruby/object:Gem::Dependency
|
94
103
|
name: rspec-core
|
95
|
-
requirement: &
|
104
|
+
requirement: &70327226991100 !ruby/object:Gem::Requirement
|
96
105
|
none: false
|
97
106
|
requirements:
|
98
107
|
- - ! '>='
|
@@ -100,10 +109,10 @@ dependencies:
|
|
100
109
|
version: '0'
|
101
110
|
type: :development
|
102
111
|
prerelease: false
|
103
|
-
version_requirements: *
|
112
|
+
version_requirements: *70327226991100
|
104
113
|
- !ruby/object:Gem::Dependency
|
105
114
|
name: rspec-expectations
|
106
|
-
requirement: &
|
115
|
+
requirement: &70327227187340 !ruby/object:Gem::Requirement
|
107
116
|
none: false
|
108
117
|
requirements:
|
109
118
|
- - ! '>='
|
@@ -111,40 +120,29 @@ dependencies:
|
|
111
120
|
version: '0'
|
112
121
|
type: :development
|
113
122
|
prerelease: false
|
114
|
-
version_requirements: *
|
123
|
+
version_requirements: *70327227187340
|
115
124
|
- !ruby/object:Gem::Dependency
|
116
125
|
name: rr
|
117
|
-
requirement: &
|
126
|
+
requirement: &70327227206520 !ruby/object:Gem::Requirement
|
118
127
|
none: false
|
119
128
|
requirements:
|
120
|
-
- -
|
129
|
+
- - ~>
|
121
130
|
- !ruby/object:Gem::Version
|
122
|
-
version: '0'
|
131
|
+
version: '1.0'
|
123
132
|
type: :development
|
124
133
|
prerelease: false
|
125
|
-
version_requirements: *
|
134
|
+
version_requirements: *70327227206520
|
126
135
|
- !ruby/object:Gem::Dependency
|
127
136
|
name: faker
|
128
|
-
requirement: &
|
137
|
+
requirement: &70327229452500 !ruby/object:Gem::Requirement
|
129
138
|
none: false
|
130
139
|
requirements:
|
131
|
-
- -
|
140
|
+
- - ~>
|
132
141
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: *70201193359660
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: rcov
|
139
|
-
requirement: &70201193359180 !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
|
-
requirements:
|
142
|
-
- - ! '>='
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
142
|
+
version: 0.9.5
|
145
143
|
type: :development
|
146
144
|
prerelease: false
|
147
|
-
version_requirements: *
|
145
|
+
version_requirements: *70327229452500
|
148
146
|
description: This git commit notifier sends html mails with nice diffs for every changed
|
149
147
|
file.
|
150
148
|
email: bodo@bitboxer.de
|
@@ -164,7 +162,7 @@ files:
|
|
164
162
|
- Rakefile
|
165
163
|
- VERSION
|
166
164
|
- bin/git-commit-notifier
|
167
|
-
- config/git-notifier-config.yml
|
165
|
+
- config/git-notifier-config.example.yml
|
168
166
|
- git-commit-notifier.gemspec
|
169
167
|
- lib/git_commit_notifier.rb
|
170
168
|
- lib/git_commit_notifier/commit_hook.rb
|
@@ -215,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
213
|
version: '0'
|
216
214
|
segments:
|
217
215
|
- 0
|
218
|
-
hash:
|
216
|
+
hash: 2795611329410386434
|
219
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
218
|
none: false
|
221
219
|
requirements:
|