git-commit-notifier 0.12.3 → 0.12.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f83e882803b817c7a4f11b44a75a2fd61a98212
4
+ data.tar.gz: 73ea6dd2b99d5da0e40ff60457496ea1dc1c2417
5
+ SHA512:
6
+ metadata.gz: 839f27f8d5f2b5062121681b83f71d4f2c973b341c62ea81e353a234882c1f01731bafed52d73e18fe0abcb2296d80195048703b01ccfcaea65e036cce7a5604
7
+ data.tar.gz: 2932fc34f195548e3b96339206529880f3e960c461b497f8f9f8641c6cfa4d1050c8263144a277d01ac3289d471d076b37f9294f1bbe33a66c2fc8f0f7004d65
data/CHANGES.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Not yet released
4
4
 
5
+ ## Version 0.12.5
6
+
7
+ * Fix behaviour when git output is not utf-8.
8
+
5
9
  ## Version 0.12.3
6
10
 
7
11
  * Links updated for Gitlab 5.x
data/Gemfile CHANGED
@@ -6,8 +6,8 @@ gem "rcov", :group => :test, :platforms => :mri_18
6
6
  gem "erubis", "~> 2.7"
7
7
 
8
8
  gem "ripper", :group => :development, :platforms => :mri_18
9
- gem "redcarpet", "~> 3.0", :group => :development, :platforms => :mri
10
- gem "yard-redcarpet-ext", "~> 0.0.3", :group => :development, :platforms => :mri
11
- gem "maruku", :group => :development, :platforms => :jruby
9
+ gem "redcarpet", "~> 3.0", :group => :development, :platforms => [:mri_19, :mri_20]
10
+ gem "yard-redcarpet-ext", "~> 0.0.3", :group => :development, :platforms => [:mri_19, :mri_20]
11
+ gem "maruku", :group => :development, :platforms => [:jruby, :mri_18]
12
12
 
13
13
  gem "coveralls", :require => false, :platforms => [:mri_19, :mri_20], :group => :development
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.3
1
+ 0.12.5
@@ -52,6 +52,16 @@ module GitCommitNotifier
52
52
  end
53
53
  end
54
54
 
55
+ def get_reply_to_address(config, committer_email)
56
+ reply_to_address = config["from"]
57
+ if config["reply_to_author"]
58
+ reply_to_address = committer_email
59
+ elsif config["reply_to_mailinglist"]
60
+ reply_to_address = recipient
61
+ end
62
+ reply_to_address
63
+ end
64
+
55
65
  # Gets list of branches from {config} to include into notifications.
56
66
  # @note All branches will be notified about if returned list is nil; otherwise only specified branches will be notifified about.
57
67
  # @return [Array(String), NilClass] Array of branches to include into notifications or nil.
@@ -137,15 +147,6 @@ module GitCommitNotifier
137
147
  return
138
148
  end
139
149
 
140
- reply_to_address = nil
141
- if config["reply_to_author"]
142
- reply_to_address ||= result[:commit_info][:email]
143
- elsif config["reply_to_mailinglist"]
144
- reply_to_address ||= recipient
145
- else
146
- reply_to_address ||= config["from"]
147
- end
148
-
149
150
  # Debug information
150
151
  logger.debug('----')
151
152
  logger.debug("cwd: #{Dir.pwd}")
@@ -226,7 +227,7 @@ module GitCommitNotifier
226
227
  :recipient => config["send_mail_to_committer"] ? add_committer_to_recipient(recipient, result[:commit_info][:email]) : recipient,
227
228
  :from_address => config["from"] || result[:commit_info][:email],
228
229
  :from_alias => result[:commit_info][:author],
229
- :reply_to_address => reply_to_address,
230
+ :reply_to_address => get_reply_to_address(config, result[:commit_info][:email]),
230
231
  :subject => subject,
231
232
  :commit_date => result[:commit_info][:date],
232
233
  :current_date => Time.new.rfc2822,
@@ -277,7 +278,7 @@ module GitCommitNotifier
277
278
  :recipient => config["send_mail_to_committer"] ? add_committer_to_recipient(recipient, result[:commit_info][:email]) : recipient,
278
279
  :from_address => config["from"] || result[:commit_info][:email],
279
280
  :from_alias => result[:commit_info][:author],
280
- :reply_to_address => reply_to_address,
281
+ :reply_to_address => get_reply_to_address(config, result[:commit_info][:email]),
281
282
  :subject => subject,
282
283
  :commit_date => result[:commit_info][:date],
283
284
  :current_date => Time.new.rfc2822,
@@ -3,14 +3,21 @@
3
3
  # Git methods
4
4
  class GitCommitNotifier::Git
5
5
  class << self
6
+ def to_utf8(str)
7
+ return str unless str.respond_to?(:force_encoding)
8
+ str = str.force_encoding(Encoding::UTF_8)
9
+ return str if str.valid_encoding?
10
+ str = str.force_encoding(Encoding::BINARY)
11
+ str.encode("UTF-8", :invalid => :replace, :undef => :replace)
12
+ end
13
+
6
14
  # Runs specified command and gets its output.
7
15
  # @return (String) Shell command STDOUT (forced to UTF-8)
8
16
  # @raise [ArgumentError] when command exits with nonzero status.
9
17
  def from_shell(cmd)
10
18
  r = `#{cmd}`
11
19
  raise ArgumentError.new("#{cmd} failed") unless $?.exitstatus.zero?
12
- r.force_encoding(Encoding::UTF_8) if r.respond_to?(:force_encoding)
13
- r
20
+ to_utf8(r)
14
21
  end
15
22
 
16
23
  # Runs specified command and gets its output as array of lines.
@@ -66,7 +73,7 @@ class GitCommitNotifier::Git
66
73
  # @param [String] rev2 Second revision
67
74
  def changed_files(rev1, rev2)
68
75
  lines = lines_from_shell("git log #{rev1}..#{rev2} --name-status --pretty=oneline -M#{GitCommitNotifier::CommitHook.config['similarity_detection_threshold'] || "0.5"}")
69
- lines = lines.select {|line| line =~ /^\w{1}\s+\w+/} # grep out only filenames
76
+ lines = lines.select { |line| line =~ /^\w{1}\s+\w+/ } # grep out only filenames
70
77
  lines.uniq
71
78
  end
72
79
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-commit-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.3
5
- prerelease:
4
+ version: 0.12.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bodo Tasche
@@ -10,238 +9,212 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-11-08 00:00:00.000000000 Z
12
+ date: 2014-01-20 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: diff-lcs
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ~>
18
+ - - "~>"
21
19
  - !ruby/object:Gem::Version
22
20
  version: 1.1.2
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ~>
25
+ - - "~>"
29
26
  - !ruby/object:Gem::Version
30
27
  version: 1.1.2
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: nntp
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ~>
32
+ - - "~>"
37
33
  - !ruby/object:Gem::Version
38
34
  version: '1.0'
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ~>
39
+ - - "~>"
45
40
  - !ruby/object:Gem::Version
46
41
  version: '1.0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: premailer
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ~>
46
+ - - "~>"
53
47
  - !ruby/object:Gem::Version
54
48
  version: '1.7'
55
- - - ! '>='
49
+ - - ">="
56
50
  - !ruby/object:Gem::Version
57
51
  version: 1.7.1
58
- - - ! '!='
52
+ - - "!="
59
53
  - !ruby/object:Gem::Version
60
54
  version: 1.7.2
61
55
  type: :runtime
62
56
  prerelease: false
63
57
  version_requirements: !ruby/object:Gem::Requirement
64
- none: false
65
58
  requirements:
66
- - - ~>
59
+ - - "~>"
67
60
  - !ruby/object:Gem::Version
68
61
  version: '1.7'
69
- - - ! '>='
62
+ - - ">="
70
63
  - !ruby/object:Gem::Version
71
64
  version: 1.7.1
72
- - - ! '!='
65
+ - - "!="
73
66
  - !ruby/object:Gem::Version
74
67
  version: 1.7.2
75
68
  - !ruby/object:Gem::Dependency
76
69
  name: nokogiri
77
70
  requirement: !ruby/object:Gem::Requirement
78
- none: false
79
71
  requirements:
80
- - - ~>
72
+ - - "~>"
81
73
  - !ruby/object:Gem::Version
82
74
  version: '1.4'
83
- - - <
75
+ - - "<"
84
76
  - !ruby/object:Gem::Version
85
77
  version: 1.6.0
86
78
  type: :runtime
87
79
  prerelease: false
88
80
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
81
  requirements:
91
- - - ~>
82
+ - - "~>"
92
83
  - !ruby/object:Gem::Version
93
84
  version: '1.4'
94
- - - <
85
+ - - "<"
95
86
  - !ruby/object:Gem::Version
96
87
  version: 1.6.0
97
88
  - !ruby/object:Gem::Dependency
98
89
  name: yajl-ruby
99
90
  requirement: !ruby/object:Gem::Requirement
100
- none: false
101
91
  requirements:
102
- - - ~>
92
+ - - "~>"
103
93
  - !ruby/object:Gem::Version
104
94
  version: '1.0'
105
95
  type: :runtime
106
96
  prerelease: false
107
97
  version_requirements: !ruby/object:Gem::Requirement
108
- none: false
109
98
  requirements:
110
- - - ~>
99
+ - - "~>"
111
100
  - !ruby/object:Gem::Version
112
101
  version: '1.0'
113
102
  - !ruby/object:Gem::Dependency
114
103
  name: rake
115
104
  requirement: !ruby/object:Gem::Requirement
116
- none: false
117
105
  requirements:
118
- - - ~>
106
+ - - "~>"
119
107
  - !ruby/object:Gem::Version
120
108
  version: '0.8'
121
- - - ! '!='
109
+ - - "!="
122
110
  - !ruby/object:Gem::Version
123
111
  version: 0.9.0
124
112
  type: :development
125
113
  prerelease: false
126
114
  version_requirements: !ruby/object:Gem::Requirement
127
- none: false
128
115
  requirements:
129
- - - ~>
116
+ - - "~>"
130
117
  - !ruby/object:Gem::Version
131
118
  version: '0.8'
132
- - - ! '!='
119
+ - - "!="
133
120
  - !ruby/object:Gem::Version
134
121
  version: 0.9.0
135
122
  - !ruby/object:Gem::Dependency
136
123
  name: bundler
137
124
  requirement: !ruby/object:Gem::Requirement
138
- none: false
139
125
  requirements:
140
- - - ~>
126
+ - - "~>"
141
127
  - !ruby/object:Gem::Version
142
128
  version: '1.3'
143
129
  type: :development
144
130
  prerelease: false
145
131
  version_requirements: !ruby/object:Gem::Requirement
146
- none: false
147
132
  requirements:
148
- - - ~>
133
+ - - "~>"
149
134
  - !ruby/object:Gem::Version
150
135
  version: '1.3'
151
136
  - !ruby/object:Gem::Dependency
152
137
  name: code-cleaner
153
138
  requirement: !ruby/object:Gem::Requirement
154
- none: false
155
139
  requirements:
156
- - - ! '>='
140
+ - - ">="
157
141
  - !ruby/object:Gem::Version
158
142
  version: '0'
159
143
  type: :development
160
144
  prerelease: false
161
145
  version_requirements: !ruby/object:Gem::Requirement
162
- none: false
163
146
  requirements:
164
- - - ! '>='
147
+ - - ">="
165
148
  - !ruby/object:Gem::Version
166
149
  version: '0'
167
150
  - !ruby/object:Gem::Dependency
168
151
  name: rspec-core
169
152
  requirement: !ruby/object:Gem::Requirement
170
- none: false
171
153
  requirements:
172
- - - ! '>='
154
+ - - ">="
173
155
  - !ruby/object:Gem::Version
174
156
  version: '0'
175
157
  type: :development
176
158
  prerelease: false
177
159
  version_requirements: !ruby/object:Gem::Requirement
178
- none: false
179
160
  requirements:
180
- - - ! '>='
161
+ - - ">="
181
162
  - !ruby/object:Gem::Version
182
163
  version: '0'
183
164
  - !ruby/object:Gem::Dependency
184
165
  name: rspec-expectations
185
166
  requirement: !ruby/object:Gem::Requirement
186
- none: false
187
167
  requirements:
188
- - - ! '>='
168
+ - - ">="
189
169
  - !ruby/object:Gem::Version
190
170
  version: '0'
191
171
  type: :development
192
172
  prerelease: false
193
173
  version_requirements: !ruby/object:Gem::Requirement
194
- none: false
195
174
  requirements:
196
- - - ! '>='
175
+ - - ">="
197
176
  - !ruby/object:Gem::Version
198
177
  version: '0'
199
178
  - !ruby/object:Gem::Dependency
200
179
  name: rr
201
180
  requirement: !ruby/object:Gem::Requirement
202
- none: false
203
181
  requirements:
204
- - - ~>
182
+ - - "~>"
205
183
  - !ruby/object:Gem::Version
206
184
  version: '1.0'
207
185
  type: :development
208
186
  prerelease: false
209
187
  version_requirements: !ruby/object:Gem::Requirement
210
- none: false
211
188
  requirements:
212
- - - ~>
189
+ - - "~>"
213
190
  - !ruby/object:Gem::Version
214
191
  version: '1.0'
215
192
  - !ruby/object:Gem::Dependency
216
193
  name: faker
217
194
  requirement: !ruby/object:Gem::Requirement
218
- none: false
219
195
  requirements:
220
- - - ~>
196
+ - - "~>"
221
197
  - !ruby/object:Gem::Version
222
198
  version: 1.1.2
223
199
  type: :development
224
200
  prerelease: false
225
201
  version_requirements: !ruby/object:Gem::Requirement
226
- none: false
227
202
  requirements:
228
- - - ~>
203
+ - - "~>"
229
204
  - !ruby/object:Gem::Version
230
205
  version: 1.1.2
231
206
  - !ruby/object:Gem::Dependency
232
207
  name: yard
233
208
  requirement: !ruby/object:Gem::Requirement
234
- none: false
235
209
  requirements:
236
- - - ~>
210
+ - - "~>"
237
211
  - !ruby/object:Gem::Version
238
212
  version: 0.8.1
239
213
  type: :development
240
214
  prerelease: false
241
215
  version_requirements: !ruby/object:Gem::Requirement
242
- none: false
243
216
  requirements:
244
- - - ~>
217
+ - - "~>"
245
218
  - !ruby/object:Gem::Version
246
219
  version: 0.8.1
247
220
  description: This git commit notifier sends html mails with nice diffs for every changed
@@ -255,10 +228,10 @@ extra_rdoc_files:
255
228
  - README.md
256
229
  - CHANGES.md
257
230
  files:
258
- - .gitignore
259
- - .rspec
260
- - .travis.yml
261
- - .yardopts
231
+ - ".gitignore"
232
+ - ".rspec"
233
+ - ".travis.yml"
234
+ - ".yardopts"
262
235
  - CHANGES.md
263
236
  - Gemfile
264
237
  - LICENSE
@@ -312,28 +285,24 @@ files:
312
285
  - template/styles.css
313
286
  homepage: http://git-commit-notifier.github.com/
314
287
  licenses: []
288
+ metadata: {}
315
289
  post_install_message:
316
290
  rdoc_options: []
317
291
  require_paths:
318
292
  - lib
319
293
  required_ruby_version: !ruby/object:Gem::Requirement
320
- none: false
321
294
  requirements:
322
- - - ! '>='
295
+ - - ">="
323
296
  - !ruby/object:Gem::Version
324
297
  version: '0'
325
- segments:
326
- - 0
327
- hash: 1331678205794572639
328
298
  required_rubygems_version: !ruby/object:Gem::Requirement
329
- none: false
330
299
  requirements:
331
- - - ! '>='
300
+ - - ">="
332
301
  - !ruby/object:Gem::Version
333
302
  version: '0'
334
303
  requirements: []
335
304
  rubyforge_project:
336
- rubygems_version: 1.8.24
305
+ rubygems_version: 2.2.0
337
306
  signing_key:
338
307
  specification_version: 3
339
308
  summary: Sends git commit messages with diffs