Skip to content

Commit 0df3614

Browse files
committed
Run test-tool without extension libraries in bundled gems
Now the extension libraries in bundled gems may not be built before test-tool.
1 parent 2976415 commit 0df3614

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tool/commit-email.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env ruby
22

33
require "optparse"
4-
require "nkf"
54
require "shellwords"
65

76
CommitEmailInfo = Struct.new(
@@ -207,7 +206,13 @@ def sendmail(to, from, mail)
207206
private
208207

209208
def b_encode(str)
210-
NKF.nkf('-WwM', str)
209+
str.gsub(/\S+/) do |sub|
210+
if sub.ascii_only?
211+
sub
212+
else
213+
"=?#{str.encoding}?B?#{[sub].pack("m0")}?="
214+
end
215+
end
211216
end
212217

213218
def make_body(info, viewer_uri:)
@@ -341,7 +346,7 @@ def make_from(name:, email:)
341346
escaped_name = name.gsub(/["\\\n]/) { |c| "\\#{c}" }
342347
%Q["#{escaped_name}" <#{email}>]
343348
else
344-
escaped_name = "=?UTF-8?B?#{NKF.nkf('-WwMB', name)}?="
349+
escaped_name = "=?UTF-8?B?#{[name].pack("m0")}?="
345350
%Q[#{escaped_name} <#{email}>]
346351
end
347352
end

0 commit comments

Comments
 (0)