git-commit-notifier 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/README.md +125 -0
- data/Rakefile +0 -6
- data/VERSION +1 -1
- data/config/git-notifier-config.yml.sample +8 -2
- data/git-commit-notifier.gemspec +3 -5
- data/lib/git_commit_notifier/commit_hook.rb +23 -19
- data/lib/git_commit_notifier/diff_to_html.rb +175 -97
- data/lib/git_commit_notifier/emailer.rb +7 -0
- data/lib/git_commit_notifier/executor.rb +5 -5
- data/lib/git_commit_notifier/git.rb +15 -3
- data/spec/fixtures/git_log_name_status +4 -0
- data/spec/lib/git_commit_notifier/commit_hook_spec.rb +4 -1
- data/spec/lib/git_commit_notifier/diff_to_html_spec.rb +45 -15
- data/spec/lib/git_commit_notifier/git_spec.rb +18 -3
- data/spec/spec_helper.rb +5 -0
- metadata +129 -125
- data/README.textile +0 -111
data/README.textile
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
h1. Git Commit Notifier
|
2
|
-
|
3
|
-
__by Bodo Tasche (bodo 'at' wannawork 'dot' de), Akzhan Abdulin (akzhan 'dot' abdulin 'at' gmail 'dot' com), Csoma Zoltan (Primalgrasp) (zoltan 'at' primalgrasp 'dot' com)__
|
4
|
-
|
5
|
-
Sends email commit messages splitting commits that were pushed in one step.
|
6
|
-
Email is delivered as text or HTML with changes refined per word. Emails
|
7
|
-
have a scanable subject containing the first sentence of the commit as well
|
8
|
-
as the author, project and branch name.
|
9
|
-
|
10
|
-
It's also possible to send a mail to a newsgroup using NNTP.
|
11
|
-
|
12
|
-
For example:
|
13
|
-
|
14
|
-
<pre>[rails][branch] Fix Brasilia timezone. [#1180 state:resolved] </pre>
|
15
|
-
|
16
|
-
A reply-to header is added containing the author of the commit. This makes
|
17
|
-
follow up really simple. If multiple commits are pushed at once, emails are
|
18
|
-
numbered in chronological order:
|
19
|
-
|
20
|
-
<pre> [rails][branch][000] Added deprecated warning messages to Float#months and Float#years deprications.
|
21
|
-
[rails][branch][001] Enhance testing for fractional days and weeks. Update changelog.</pre>
|
22
|
-
|
23
|
-
Example email:
|
24
|
-
|
25
|
-
!http://img171.imageshack.us/img171/954/gitcommitnotifieremailpq3.png!
|
26
|
-
|
27
|
-
h2. Requirements
|
28
|
-
|
29
|
-
* Ruby
|
30
|
-
* RubyGems
|
31
|
-
|
32
|
-
h2. Installing and Configuring
|
33
|
-
|
34
|
-
Install the gem:
|
35
|
-
|
36
|
-
<pre>sudo gem install git-commit-notifier</pre>
|
37
|
-
|
38
|
-
After you installed the gem, you need to configure your git repository. Add a file called
|
39
|
-
"post-receive" to the "hooks" directory of your git repository with this content:
|
40
|
-
|
41
|
-
<pre>
|
42
|
-
#!/bin/sh
|
43
|
-
git-commit-notifier path_to_config.yml
|
44
|
-
</pre>
|
45
|
-
(Don't forget to make that file executable.)
|
46
|
-
|
47
|
-
An example for the config file can be found in <a href="http://github.com/bitboxer/git-commit-notifier/blob/master/config/git-notifier-config.yml.sample">config/git-notifier-config.yml.sample</a>.
|
48
|
-
|
49
|
-
If you want to send mails on each commit instead on each pull, you should add a file called "post-commit" with this content:
|
50
|
-
|
51
|
-
<pre>
|
52
|
-
#!/bin/sh
|
53
|
-
echo "HEAD^1 HEAD refs/heads/master" | git-commit-notifier path_to_config.yml
|
54
|
-
</pre>
|
55
|
-
|
56
|
-
h2. Integration with Redmine, Bugzilla, MediaWiki
|
57
|
-
|
58
|
-
Git-commit-notifier supports easy integration with Redmine, Bugzilla and MediaWiki. All you need is to uncomment the according line in the configuration and change the links to your software installations instead of example ones (no trailing slash please).
|
59
|
-
|
60
|
-
* "BUG 123" sentence in commit message will be replaced with link to bug in Bugzilla.
|
61
|
-
* "refs #123" and "fixes #123" sentences in commit message will be replaced with link to issue in Redmine.
|
62
|
-
* "[[SomePage]]" sentence in commit message will be replaced with link to page in MediaWiki.
|
63
|
-
|
64
|
-
h2. Integration of links to other websites
|
65
|
-
|
66
|
-
If you need integration with other websites not supported by git-commit-notifier you can use the message_map property. For that you need to know basics of regular expressions syntax.
|
67
|
-
|
68
|
-
Each key of message_map is a case sensitive Regexp pattern, and its value is the replacement string.
|
69
|
-
Every matched group (that defined by round brackets in regular expression) will be automatically substituted instead of \1-\9 backreferences in replacement string where number after backslash informs which group should be substituted instead of the backreference. The first matched group is known as \1.
|
70
|
-
|
71
|
-
For example, when we need to expand "follow 23" to http://example.com/answer/23, simply type this:
|
72
|
-
|
73
|
-
'\bfollow\s+(\d+)': 'http://example.com/answer/\1'
|
74
|
-
|
75
|
-
Key and value are enclosed into single quotes. \b means that "follow" must not be preceded by other word chars, so "befollow" will not match but "be follow" will match. After "follow" we expect one or more spaces followed by group of one or more digits. The \1 in the result url will be replaced with the matched group.
|
76
|
-
|
77
|
-
More examples can be found in the config file.
|
78
|
-
|
79
|
-
h2. Logic of commits handling
|
80
|
-
|
81
|
-
Commit notifier use special files named *previously.txt to track already
|
82
|
-
handled commits to not send repeated messages about commits.
|
83
|
-
|
84
|
-
By default all commits tracked through overall repository so after merge action
|
85
|
-
You should not receive messages about commits those already posted in other branches.
|
86
|
-
|
87
|
-
This behaviour can be changed using unique_commits_per_branch option. When it's true,
|
88
|
-
you should receive new message about commit when it's merged in other branch.
|
89
|
-
|
90
|
-
Yet another option, skip_commits_older_than (in days), should be used to not inform about
|
91
|
-
old commits in processes of forking, branching etc.
|
92
|
-
|
93
|
-
h2. Note on Patches/Pull Requests
|
94
|
-
|
95
|
-
* Fork the project.
|
96
|
-
* Make your feature addition or bug fix.
|
97
|
-
* Add tests for it. This is important so I don't break it in a
|
98
|
-
future version unintentionally.
|
99
|
-
* Commit, do not mess with rakefile, version, or history.
|
100
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
101
|
-
* Send me a pull request. Bonus points for topic branches.
|
102
|
-
|
103
|
-
h2. Troubleshooting
|
104
|
-
|
105
|
-
h3. Permission denied - /var/git/repo/previously.txt (Errno::EACCES)
|
106
|
-
|
107
|
-
The file __previously.txt__ is created at the first commit. If you moved the file to the server, you have to check the rights to that file and fix them if needed. The git repo owner needs the right to write into that file.
|
108
|
-
|
109
|
-
h2. License
|
110
|
-
|
111
|
-
MIT License, see the file LICENSE.
|