git-commit-notifier 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.3
1
+ 0.11.4
@@ -143,12 +143,6 @@ module GitCommitNotifier
143
143
  diffresult = diff2html.result
144
144
  diff2html.clear_result
145
145
 
146
- if config["ignore_merge"]
147
- diffresult.reject! do |result|
148
- merge_commit?(result)
149
- end
150
- end
151
-
152
146
  text, html = [], []
153
147
  result = diffresult.first
154
148
  return if result.nil? || !result[:commit_info]
@@ -187,19 +181,17 @@ module GitCommitNotifier
187
181
  emailer.send
188
182
  else
189
183
  commit_number = 1
190
- diff2html.diff_between_revisions(rev1, rev2, prefix, ref_name) do |result|
191
- next if config["ignore_merge"] && merge_commit?(result)
192
-
184
+ diff2html.diff_between_revisions(rev1, rev2, prefix, ref_name) do |count, result|
193
185
  # Form the subject from template
194
186
  revised_subject_words = subject_words.merge({
195
187
  :commit_id => result[:commit_info][:commit],
196
188
  :message => result[:commit_info][:message],
197
189
  :commit_number => commit_number,
198
- :commit_count => 1,
199
- :commit_count_phrase => "1 commit",
200
- :commit_count_phrase2 => ""
190
+ :commit_count => count,
191
+ :commit_count_phrase => count == 1 ? "1 commit" : "#{count} commits",
192
+ :commit_count_phrase2 => count == 1 ? "" : "#{count} commits: "
201
193
  })
202
- subject_template = config['subject'] || "[${prefix}${slash_branch_name}][${commit_number}] ${message}"
194
+ subject_template = config['subject'] || "[${prefix}${slash_branch_name}][${commit_number}/${commit_count}] ${message}"
203
195
  subject = subject_template.gsub(/\$\{(\w+)\}/) { |m| revised_subject_words[$1.intern] }
204
196
 
205
197
  emailer = Emailer.new(config,
@@ -222,13 +214,6 @@ module GitCommitNotifier
222
214
  end
223
215
  nil
224
216
  end
225
-
226
- # Gets human readable commit number.
227
- # @param [Fixnum] i Commit index.
228
- # @return [String] Human readable commit number.
229
- def number(i)
230
- "[#{i + 1}]"
231
- end
232
217
  end
233
218
  end
234
219
  end
@@ -73,14 +73,20 @@ module GitCommitNotifier
73
73
  end
74
74
 
75
75
  # Gets lines_per_diff setting from {#config}.
76
+ # @return [Fixnum, NilClass] Lines per diff limit.
76
77
  def lines_per_diff
77
- @config['lines_per_diff']
78
+ config['lines_per_diff']
79
+ end
80
+
81
+ # Gets ignore_merge setting from {#config}.
82
+ def ignore_merge?
83
+ config['ignore_merge']
78
84
  end
79
85
 
80
86
  # Gets ignore_whitespace setting from {#config}.
81
87
  # @return [Boolean] true if whitespaces should be ignored in diff; otherwise false.
82
88
  def ignore_whitespaces?
83
- @config['ignore_whitespace'].nil? || @config['ignore_whitespace']
89
+ config['ignore_whitespace'].nil? || config['ignore_whitespace']
84
90
  end
85
91
 
86
92
  # Adds separator between diff blocks to @diff_result.
@@ -422,10 +428,10 @@ module GitCommitNotifier
422
428
  end
423
429
 
424
430
  def truncate_long_lines(text)
425
- StringIO.open("", "w") do |output|
426
- # Match encoding of output string to that of input string
427
- output.string.force_encoding(text.encoding) if output.string.respond_to?(:force_encoding)
428
-
431
+ str = ""
432
+ # Match encoding of output string to that of input string
433
+ str.force_encoding(text.encoding) if str.respond_to?(:force_encoding)
434
+ StringIO.open(str, "w") do |output|
429
435
  input = StringIO.new(text, "r")
430
436
  input.each_line "\n" do |line|
431
437
  if line.length > MAX_LINE_LENGTH && MAX_LINE_LENGTH >= 9
@@ -436,7 +442,7 @@ module GitCommitNotifier
436
442
  # characters, so deal specially with that case
437
443
  # so that we don't truncate in the middle of a UTF8 sequence,
438
444
  # which would be invalid.
439
- if !line.respond_to?(:force_encoding)
445
+ unless line.respond_to?(:force_encoding)
440
446
  # If the last remaining character is part of a UTF8 multibyte character,
441
447
  # keep truncating until we go past the start of a UTF8 character.
442
448
  # This assumes that this is a UTF8 string, which may be a false assumption
@@ -697,8 +703,13 @@ module GitCommitNotifier
697
703
  puts "Unknown change type #{ref_name},#{@rev_type}"
698
704
  end
699
705
 
706
+ # Remove merge commits if required
707
+ if ignore_merge?
708
+ @result.reject! { |commit| merge_commit?(commit[:commit_info]) }
709
+ end
710
+
700
711
  # If a block was given, pass it the results, in turn
701
- @result.each { |result| yield result } if block_given?
712
+ @result.each { |commit| yield @result.size, commit } if block_given?
702
713
  end
703
714
 
704
715
  def message_replace!(message, search_for, replace_with)
@@ -242,10 +242,10 @@ class GitCommitNotifier::Emailer
242
242
  # can result in the MTA breaking lines at inconvenient points,
243
243
  # such as in the middle of UTF8 characters.
244
244
  def encode_quoted_printable_message(text)
245
- StringIO.open("", "w") do |output|
246
- # Character encoding of output string can be plain US-ASCII since quoted-printable is plain ASCII
247
- output.string.force_encoding("US-ASCII") if output.string.respond_to?(:force_encoding)
248
-
245
+ str = ''
246
+ # Character encoding of output string can be plain US-ASCII since quoted-printable is plain ASCII
247
+ str.force_encoding("US-ASCII") if str.respond_to?(:force_encoding)
248
+ StringIO.open(str, "w") do |output|
249
249
  line_max = 76
250
250
  line_len = 0
251
251
 
@@ -304,5 +304,3 @@ class GitCommitNotifier::Emailer
304
304
  end
305
305
  end
306
306
 
307
-
308
-
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.3
4
+ version: 0.11.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-16 00:00:00.000000000 Z
13
+ date: 2012-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: diff-lcs
17
- requirement: &70233138189380 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 1.1.2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70233138189380
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.1.2
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: nntp
28
- requirement: &70233138187640 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ~>
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: '1.0'
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70233138187640
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: premailer
39
- requirement: &70233138186300 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ~>
@@ -50,10 +60,21 @@ dependencies:
50
60
  version: 1.7.2
51
61
  type: :runtime
52
62
  prerelease: false
53
- version_requirements: *70233138186300
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: 1.7.1
72
+ - - ! '!='
73
+ - !ruby/object:Gem::Version
74
+ version: 1.7.2
54
75
  - !ruby/object:Gem::Dependency
55
76
  name: nokogiri
56
- requirement: &70233138182860 !ruby/object:Gem::Requirement
77
+ requirement: !ruby/object:Gem::Requirement
57
78
  none: false
58
79
  requirements:
59
80
  - - ~>
@@ -61,10 +82,15 @@ dependencies:
61
82
  version: '1.4'
62
83
  type: :runtime
63
84
  prerelease: false
64
- version_requirements: *70233138182860
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: '1.4'
65
91
  - !ruby/object:Gem::Dependency
66
92
  name: rake
67
- requirement: &70233138197920 !ruby/object:Gem::Requirement
93
+ requirement: !ruby/object:Gem::Requirement
68
94
  none: false
69
95
  requirements:
70
96
  - - ~>
@@ -75,10 +101,18 @@ dependencies:
75
101
  version: 0.9.0
76
102
  type: :development
77
103
  prerelease: false
78
- version_requirements: *70233138197920
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0.8'
110
+ - - ! '!='
111
+ - !ruby/object:Gem::Version
112
+ version: 0.9.0
79
113
  - !ruby/object:Gem::Dependency
80
114
  name: bundler
81
- requirement: &70233138194380 !ruby/object:Gem::Requirement
115
+ requirement: !ruby/object:Gem::Requirement
82
116
  none: false
83
117
  requirements:
84
118
  - - ~>
@@ -89,10 +123,18 @@ dependencies:
89
123
  version: 1.0.10
90
124
  type: :development
91
125
  prerelease: false
92
- version_requirements: *70233138194380
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '1.0'
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: 1.0.10
93
135
  - !ruby/object:Gem::Dependency
94
136
  name: code-cleaner
95
- requirement: &70233138190680 !ruby/object:Gem::Requirement
137
+ requirement: !ruby/object:Gem::Requirement
96
138
  none: false
97
139
  requirements:
98
140
  - - ! '>='
@@ -100,10 +142,15 @@ dependencies:
100
142
  version: '0'
101
143
  type: :development
102
144
  prerelease: false
103
- version_requirements: *70233138190680
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
104
151
  - !ruby/object:Gem::Dependency
105
152
  name: rspec-core
106
- requirement: &70233138210380 !ruby/object:Gem::Requirement
153
+ requirement: !ruby/object:Gem::Requirement
107
154
  none: false
108
155
  requirements:
109
156
  - - ! '>='
@@ -111,10 +158,15 @@ dependencies:
111
158
  version: '0'
112
159
  type: :development
113
160
  prerelease: false
114
- version_requirements: *70233138210380
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
115
167
  - !ruby/object:Gem::Dependency
116
168
  name: rspec-expectations
117
- requirement: &70233138207180 !ruby/object:Gem::Requirement
169
+ requirement: !ruby/object:Gem::Requirement
118
170
  none: false
119
171
  requirements:
120
172
  - - ! '>='
@@ -122,10 +174,15 @@ dependencies:
122
174
  version: '0'
123
175
  type: :development
124
176
  prerelease: false
125
- version_requirements: *70233138207180
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
126
183
  - !ruby/object:Gem::Dependency
127
184
  name: rr
128
- requirement: &70233138400720 !ruby/object:Gem::Requirement
185
+ requirement: !ruby/object:Gem::Requirement
129
186
  none: false
130
187
  requirements:
131
188
  - - ~>
@@ -133,10 +190,15 @@ dependencies:
133
190
  version: '1.0'
134
191
  type: :development
135
192
  prerelease: false
136
- version_requirements: *70233138400720
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ~>
197
+ - !ruby/object:Gem::Version
198
+ version: '1.0'
137
199
  - !ruby/object:Gem::Dependency
138
200
  name: faker
139
- requirement: &70233138395800 !ruby/object:Gem::Requirement
201
+ requirement: !ruby/object:Gem::Requirement
140
202
  none: false
141
203
  requirements:
142
204
  - - ~>
@@ -144,10 +206,15 @@ dependencies:
144
206
  version: 0.9.5
145
207
  type: :development
146
208
  prerelease: false
147
- version_requirements: *70233138395800
209
+ version_requirements: !ruby/object:Gem::Requirement
210
+ none: false
211
+ requirements:
212
+ - - ~>
213
+ - !ruby/object:Gem::Version
214
+ version: 0.9.5
148
215
  - !ruby/object:Gem::Dependency
149
216
  name: yard
150
- requirement: &70233138429760 !ruby/object:Gem::Requirement
217
+ requirement: !ruby/object:Gem::Requirement
151
218
  none: false
152
219
  requirements:
153
220
  - - ~>
@@ -155,10 +222,15 @@ dependencies:
155
222
  version: 0.7.5
156
223
  type: :development
157
224
  prerelease: false
158
- version_requirements: *70233138429760
225
+ version_requirements: !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ~>
229
+ - !ruby/object:Gem::Version
230
+ version: 0.7.5
159
231
  - !ruby/object:Gem::Dependency
160
232
  name: redcarpet
161
- requirement: &70233138423420 !ruby/object:Gem::Requirement
233
+ requirement: !ruby/object:Gem::Requirement
162
234
  none: false
163
235
  requirements:
164
236
  - - ~>
@@ -166,7 +238,12 @@ dependencies:
166
238
  version: 1.17.2
167
239
  type: :development
168
240
  prerelease: false
169
- version_requirements: *70233138423420
241
+ version_requirements: !ruby/object:Gem::Requirement
242
+ none: false
243
+ requirements:
244
+ - - ~>
245
+ - !ruby/object:Gem::Version
246
+ version: 1.17.2
170
247
  description: This git commit notifier sends html mails with nice diffs for every changed
171
248
  file.
172
249
  email: bodo@bitboxer.de
@@ -243,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
320
  version: '0'
244
321
  requirements: []
245
322
  rubyforge_project:
246
- rubygems_version: 1.8.10
323
+ rubygems_version: 1.8.23
247
324
  signing_key:
248
325
  specification_version: 3
249
326
  summary: Sends git commit messages with diffs