git-commit-notifier 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Git Commit Notifier
2
2
 
3
- [![Build Status](https://travis-ci.org/bitboxer/git-commit-notifier.png)](http://travis-ci.org/bitboxer/git-commit-notifier)
3
+ [![Build Status](http://travis-ci.org/bitboxer/git-commit-notifier.png)](http://travis-ci.org/bitboxer/git-commit-notifier)
4
4
 
5
5
  __by Bodo Tasche (bodo 'at' wannawork 'dot' de), Akzhan Abdulin (akzhan 'dot' abdulin 'at' gmail 'dot' com), Csoma Zoltan (info 'at' railsprogrammer 'dot' net)__
6
6
 
@@ -116,6 +116,10 @@ old commits in processes of forking, branching etc.
116
116
 
117
117
  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.
118
118
 
119
+ ### Empty html on ruby 1.8.7
120
+
121
+ Check <code>gem list premailer</code>. Please remove premailer 1.7.2 if exists (<code>gem uninstall premailer -v 1.7.2; gem install premailer</code>), because 1.7.2 was broken.
122
+
119
123
  ## Credits
120
124
 
121
125
  Thanks for [putpat.tv](http://www.putpat.tv), [Primalgrasp](http://www.primalgrasp.com) and [Undev](http://undev.ru/) for sponsoring this work.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.2
1
+ 0.10.3
@@ -6,6 +6,12 @@ if RUBY_VERSION < '1.9'
6
6
  require 'jcode'
7
7
  end
8
8
 
9
+ if RUBY_VERSION >= '1.9'
10
+ Encoding.default_external = "utf-8"
11
+ Encoding.default_internal = "utf-8"
12
+ end
13
+
14
+
9
15
  require 'rubygems'
10
16
 
11
17
  # parameters: revision1, revision 2, branch
@@ -28,6 +28,9 @@ mailinglist: developers@example.com,dev2@example.com,dev3@example.com,cto@exampl
28
28
  # stylesheet file (embedded template/styles.css by default)
29
29
  # stylesheet: /absolute/path/to/readable/stylesheet.css
30
30
 
31
+ # custom template file (embedded template/email.html.erb)
32
+ # custom_template: /absolute/path/to/readable/email.html.erb
33
+
31
34
  # select the delivery method: smtp, nntp, sendmail, or debug
32
35
  delivery_method: sendmail
33
36
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
 
28
28
  s.add_runtime_dependency(%q<diff-lcs>, ["~> 1.1.2"])
29
29
  s.add_runtime_dependency(%q<nntp>, ["~> 1.0"])
30
- s.add_runtime_dependency(%q<premailer>, ["~> 1.7", "!= 1.7.2"])
30
+ s.add_runtime_dependency(%q<premailer>, ["~> 1.7", ">= 1.7.1", "!= 1.7.2"])
31
31
  s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4"])
32
32
  s.add_development_dependency(%q<rake>, ["~> 0.8", "!= 0.9.0"])
33
33
  s.add_development_dependency(%q<bundler>, ["~> 1.0", ">=1.0.10"])
@@ -434,8 +434,13 @@ module GitCommitNotifier
434
434
  return nil if old_commit?(commit_info)
435
435
  changed_files = ""
436
436
  if merge_commit?(commit_info)
437
+ changed_file_list = []
437
438
  merge_revisions = commit_info[:merge].split
438
- changed_files += "Changed files:\n\n#{Git.changed_files(*merge_revisions)}\n"
439
+ merge_first_parent = merge_revisions.slice!(0)
440
+ merge_revisions.each do |merge_other_parent|
441
+ changed_file_list += Git.changed_files(merge_first_parent, merge_other_parent)
442
+ end
443
+ changed_files = "Changed files:\n\n#{changed_file_list.uniq.join()}\n"
439
444
  end
440
445
 
441
446
  title = "<div class=\"title\">"
@@ -460,7 +465,7 @@ module GitCommitNotifier
460
465
 
461
466
  title += "<br />\n"
462
467
 
463
- title += "<strong>Branch:</strong> #{CGI.escapeHTML(branch_name)}\n<br />"
468
+ title += "<strong>Branch:</strong> #{CGI.escapeHTML(branch_name)}\n<br />" if branch_name
464
469
  title += "<strong>Date:</strong> #{CGI.escapeHTML commit_info[:date]}\n<br />"
465
470
  title += "<strong>Author:</strong> #{CGI.escapeHTML(commit_info[:author])} &lt;#{commit_info[:email]}&gt;\n<br />"
466
471
  title += "<strong>Committer:</strong> #{CGI.escapeHTML(commit_info[:committer])} &lt;#{commit_info[:commit_email]}&gt;\n</div>"
@@ -5,10 +5,12 @@ class GitCommitNotifier::Emailer
5
5
  TEMPLATE = File.join(File.dirname(__FILE__), '/../../template/email.html.erb').freeze
6
6
  PARAMETERS = %w[project_path recipient from_address from_alias subject text_message html_message ref_name old_rev new_rev].freeze
7
7
 
8
- attr_reader :config
8
+ def config
9
+ @@config
10
+ end
9
11
 
10
12
  def initialize(config, options = {})
11
- @config = config || {}
13
+ @@config = config || {}
12
14
  PARAMETERS.each do |name|
13
15
  instance_variable_set("@#{name}".to_sym, options[name.to_sym])
14
16
  end
@@ -19,9 +21,14 @@ class GitCommitNotifier::Emailer
19
21
  @template = nil
20
22
  end
21
23
 
24
+ def template_source
25
+ template_file = @@config['custom_template'] || TEMPLATE
26
+ IO.read(template_file)
27
+ end
28
+
22
29
  def template
23
30
  unless @template
24
- source = IO.read(TEMPLATE)
31
+ source = template_source
25
32
  begin
26
33
  require 'erubis'
27
34
  @template = Erubis::Eruby.new(source)
@@ -136,7 +143,7 @@ class GitCommitNotifier::Emailer
136
143
  when :nntp then perform_delivery_nntp(content, config['nntp_settings'])
137
144
  when :debug then perform_delivery_debug(content)
138
145
  else # sendmail
139
- perform_delivery_sendmail(content, @config['sendmail_options'])
146
+ perform_delivery_sendmail(content, config['sendmail_options'])
140
147
  end
141
148
  end
142
149
 
@@ -10,7 +10,12 @@ module GitCommitNotifier
10
10
  GitCommitNotifier::CommitHook.show_error("You have to add a path to the config file for git-commit-notifier")
11
11
  puts "Usage: git-commit-notifier config-script [oldrev newrev [ref]]"
12
12
  when 1
13
- oldrev, newrev, ref = $stdin.gets.strip.split
13
+ stdin = $stdin.gets
14
+ if stdin.nil?
15
+ GitCommitNotifier::CommitHook.show_error("No data given on standard input")
16
+ return
17
+ end
18
+ oldrev, newrev, ref = stdin.strip.split
14
19
  GitCommitNotifier::CommitHook.run args.first, oldrev, newrev, ref
15
20
  when 2
16
21
  GitCommitNotifier::CommitHook.run args.first, args.last, args.last, ""
data/local-run.rb CHANGED
@@ -6,6 +6,12 @@ if RUBY_VERSION < '1.9'
6
6
  require 'jcode'
7
7
  end
8
8
 
9
+ if RUBY_VERSION >= '1.9'
10
+ Encoding.default_external = "utf-8"
11
+ Encoding.default_internal = "utf-8"
12
+ end
13
+
14
+
9
15
  require 'rubygems'
10
16
  $LOAD_PATH.unshift(File.expand_path('./lib', File.dirname(__FILE__)))
11
17
 
@@ -86,4 +86,19 @@ describe GitCommitNotifier::Emailer do
86
86
  GitCommitNotifier::Emailer.template.should be_kind_of(ERB)
87
87
  end
88
88
  end
89
+
90
+ describe :template_source do
91
+ it "should return custom template if custom is provided" do
92
+ emailer = GitCommitNotifier::Emailer.new({'custom_template' => '/path/to/custom/template'})
93
+ mock(IO).read('/path/to/custom/template') { 'custom templated text' }
94
+ dont_allow(IO).read(GitCommitNotifier::Emailer::TEMPLATE)
95
+ GitCommitNotifier::Emailer.template_source.should == 'custom templated text'
96
+ end
97
+
98
+ it "should return the default template if custom_template is not provided" do
99
+ emailer = GitCommitNotifier::Emailer.new({})
100
+ mock(IO).read(GitCommitNotifier::Emailer::TEMPLATE) { 'default templated text' }
101
+ GitCommitNotifier::Emailer.template_source.should == 'default templated text'
102
+ end
103
+ end
89
104
  end
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.2
4
+ version: 0.10.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-08 00:00:00.000000000 +02:00
13
+ date: 2011-10-16 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: &70327232962420 !ruby/object:Gem::Requirement
18
+ requirement: &70201601412560 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 1.1.2
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70327232962420
26
+ version_requirements: *70201601412560
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nntp
29
- requirement: &70327232961940 !ruby/object:Gem::Requirement
29
+ requirement: &70201601412080 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,24 +34,27 @@ dependencies:
34
34
  version: '1.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70327232961940
37
+ version_requirements: *70201601412080
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: premailer
40
- requirement: &70327232961440 !ruby/object:Gem::Requirement
40
+ requirement: &70201601411560 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: '1.7'
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.7.1
46
49
  - - ! '!='
47
50
  - !ruby/object:Gem::Version
48
51
  version: 1.7.2
49
52
  type: :runtime
50
53
  prerelease: false
51
- version_requirements: *70327232961440
54
+ version_requirements: *70201601411560
52
55
  - !ruby/object:Gem::Dependency
53
56
  name: nokogiri
54
- requirement: &70327225451960 !ruby/object:Gem::Requirement
57
+ requirement: &70201601410600 !ruby/object:Gem::Requirement
55
58
  none: false
56
59
  requirements:
57
60
  - - ~>
@@ -59,10 +62,10 @@ dependencies:
59
62
  version: '1.4'
60
63
  type: :runtime
61
64
  prerelease: false
62
- version_requirements: *70327225451960
65
+ version_requirements: *70201601410600
63
66
  - !ruby/object:Gem::Dependency
64
67
  name: rake
65
- requirement: &70327225692660 !ruby/object:Gem::Requirement
68
+ requirement: &70201601410100 !ruby/object:Gem::Requirement
66
69
  none: false
67
70
  requirements:
68
71
  - - ~>
@@ -73,10 +76,10 @@ dependencies:
73
76
  version: 0.9.0
74
77
  type: :development
75
78
  prerelease: false
76
- version_requirements: *70327225692660
79
+ version_requirements: *70201601410100
77
80
  - !ruby/object:Gem::Dependency
78
81
  name: bundler
79
- requirement: &70327226404100 !ruby/object:Gem::Requirement
82
+ requirement: &70201601372340 !ruby/object:Gem::Requirement
80
83
  none: false
81
84
  requirements:
82
85
  - - ~>
@@ -87,10 +90,10 @@ dependencies:
87
90
  version: 1.0.10
88
91
  type: :development
89
92
  prerelease: false
90
- version_requirements: *70327226404100
93
+ version_requirements: *70201601372340
91
94
  - !ruby/object:Gem::Dependency
92
95
  name: code-cleaner
93
- requirement: &70327226682620 !ruby/object:Gem::Requirement
96
+ requirement: &70201601371500 !ruby/object:Gem::Requirement
94
97
  none: false
95
98
  requirements:
96
99
  - - ! '>='
@@ -98,10 +101,10 @@ dependencies:
98
101
  version: '0'
99
102
  type: :development
100
103
  prerelease: false
101
- version_requirements: *70327226682620
104
+ version_requirements: *70201601371500
102
105
  - !ruby/object:Gem::Dependency
103
106
  name: rspec-core
104
- requirement: &70327226991100 !ruby/object:Gem::Requirement
107
+ requirement: &70201601370900 !ruby/object:Gem::Requirement
105
108
  none: false
106
109
  requirements:
107
110
  - - ! '>='
@@ -109,10 +112,10 @@ dependencies:
109
112
  version: '0'
110
113
  type: :development
111
114
  prerelease: false
112
- version_requirements: *70327226991100
115
+ version_requirements: *70201601370900
113
116
  - !ruby/object:Gem::Dependency
114
117
  name: rspec-expectations
115
- requirement: &70327227187340 !ruby/object:Gem::Requirement
118
+ requirement: &70201601370320 !ruby/object:Gem::Requirement
116
119
  none: false
117
120
  requirements:
118
121
  - - ! '>='
@@ -120,10 +123,10 @@ dependencies:
120
123
  version: '0'
121
124
  type: :development
122
125
  prerelease: false
123
- version_requirements: *70327227187340
126
+ version_requirements: *70201601370320
124
127
  - !ruby/object:Gem::Dependency
125
128
  name: rr
126
- requirement: &70327227206520 !ruby/object:Gem::Requirement
129
+ requirement: &70201601369720 !ruby/object:Gem::Requirement
127
130
  none: false
128
131
  requirements:
129
132
  - - ~>
@@ -131,10 +134,10 @@ dependencies:
131
134
  version: '1.0'
132
135
  type: :development
133
136
  prerelease: false
134
- version_requirements: *70327227206520
137
+ version_requirements: *70201601369720
135
138
  - !ruby/object:Gem::Dependency
136
139
  name: faker
137
- requirement: &70327229452500 !ruby/object:Gem::Requirement
140
+ requirement: &70201601369140 !ruby/object:Gem::Requirement
138
141
  none: false
139
142
  requirements:
140
143
  - - ~>
@@ -142,7 +145,7 @@ dependencies:
142
145
  version: 0.9.5
143
146
  type: :development
144
147
  prerelease: false
145
- version_requirements: *70327229452500
148
+ version_requirements: *70201601369140
146
149
  description: This git commit notifier sends html mails with nice diffs for every changed
147
150
  file.
148
151
  email: bodo@bitboxer.de
@@ -213,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
216
  version: '0'
214
217
  segments:
215
218
  - 0
216
- hash: 2795611329410386434
219
+ hash: 3801418310889905206
217
220
  required_rubygems_version: !ruby/object:Gem::Requirement
218
221
  none: false
219
222
  requirements: