mail 2.6.4.rc1 → 2.6.4.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9294e13f17b710d1817da0765d4f366904f79b0a
4
- data.tar.gz: 7c7e6bb27d50e7d0a77aeff4b0024a575950fa6e
3
+ metadata.gz: a4cd6578224b57f03109de0e15e54fc7d0e54079
4
+ data.tar.gz: 7f7b2116022f18740b56ba559038332d40476dbf
5
5
  SHA512:
6
- metadata.gz: 21c9ad8d24e777f6eb598f91f26502d9a22e8ee7477d222b58a5d08d33cb395e0fbe7423ef4d55b28b41a0829a081f2f489e9b5ab60b3a5aa6f5a3dcb6d91460
7
- data.tar.gz: ee66d0c7ad442f39ecc5a383098d156309faf9ee231197e9a7cac7899f7b286d234d2de83a170c4069699650c75d21f74c0eff4cd369473d2b0dba5ceb426c38
6
+ metadata.gz: 5a93b7505e4b1dc57444a7779005de12c4cc4db846d9e0ec86981f26c13abdac2cffde6be282b03ef6cc7f24317822434cdb34be99dd213a585b4eb34589ece4
7
+ data.tar.gz: c5abba187c988de228cd9d808b5e85d26a1d59a48ae8c702a1ebb25a96b98ad1c48e16364ff1970ba5302c08112f78c45e82b475c724574cd9664b7847423f42
data/Gemfile CHANGED
@@ -8,5 +8,4 @@ gem "jruby-openssl", :platforms => :jruby
8
8
  # For gems not required to run tests
9
9
  group :local_development, :test do
10
10
  gem "appraisal", "~> 1.0" unless RUBY_VERSION <= "1.8.7"
11
- gem "ruby-debug", :platforms => :mri_18
12
11
  end
@@ -32,7 +32,6 @@ module Mail # :doc:
32
32
 
33
33
  require 'mail/version'
34
34
 
35
- require 'mail/core_extensions/nil'
36
35
  require 'mail/core_extensions/string'
37
36
  require 'mail/core_extensions/smtp' if RUBY_VERSION < '1.9.3'
38
37
  require 'mail/indifferent_hash'
@@ -12,7 +12,7 @@ module Mail
12
12
  control = %Q|\x00-\x1f\x7f-\xff|
13
13
 
14
14
  if control.respond_to?(:force_encoding)
15
- control = control.force_encoding(Encoding::BINARY)
15
+ control = control.dup.force_encoding(Encoding::BINARY)
16
16
  end
17
17
 
18
18
  CRLF = /\r\n/
@@ -1,26 +1,6 @@
1
1
  # encoding: utf-8
2
2
  class String #:nodoc:
3
3
 
4
- CRLF = "\r\n"
5
- LF = "\n"
6
-
7
- if RUBY_VERSION >= '1.9'
8
- # This 1.9 only regex can save a reasonable amount of time (~20%)
9
- # by not matching "\r\n" so the string is returned unchanged in
10
- # the common case.
11
- CRLF_REGEX = Regexp.new("(?<!\r)\n|\r(?!\n)")
12
- else
13
- CRLF_REGEX = /\n|\r\n|\r/
14
- end
15
-
16
- def to_crlf
17
- to_str.gsub(CRLF_REGEX, CRLF)
18
- end
19
-
20
- def to_lf
21
- to_str.gsub(/\r\n|\r/, LF)
22
- end
23
-
24
4
  unless method_defined?(:ascii_only?)
25
5
  # Backport from Ruby 1.9 checks for non-us-ascii characters.
26
6
  def ascii_only?
@@ -12,12 +12,12 @@ module Mail
12
12
 
13
13
  # Decode the string
14
14
  def self.decode(str)
15
- str.to_lf
15
+ ::Mail::Utilities.to_lf str
16
16
  end
17
17
 
18
18
  # Encode the string
19
19
  def self.encode(str)
20
- str.to_crlf
20
+ ::Mail::Utilities.to_crlf str
21
21
  end
22
22
 
23
23
  # Idenity encodings have a fixed cost, 1 byte out per 1 byte in
@@ -19,7 +19,7 @@ module Mail
19
19
 
20
20
  # Encode the string to Base64
21
21
  def self.encode(str)
22
- RubyVer.encode_base64( str ).to_crlf
22
+ ::Mail::Utilities.to_crlf(RubyVer.encode_base64( str ))
23
23
  end
24
24
 
25
25
  # Base64 has a fixed cost, 4 bytes out per 3 bytes in
@@ -15,11 +15,11 @@ module Mail
15
15
  # Decode the string from Quoted-Printable. Cope with hard line breaks
16
16
  # that were incorrectly encoded as hex instead of literal CRLF.
17
17
  def self.decode(str)
18
- str.gsub(/(?:=0D=0A|=0D|=0A)\r\n/, "\r\n").unpack("M*").first.to_lf
18
+ ::Mail::Utilities.to_lf str.gsub(/(?:=0D=0A|=0D|=0A)\r\n/, "\r\n").unpack("M*").first
19
19
  end
20
20
 
21
21
  def self.encode(str)
22
- [str.to_lf].pack("M").to_crlf
22
+ ::Mail::Utilities.to_crlf([::Mail::Utilities.to_lf(str)].pack("M"))
23
23
  end
24
24
 
25
25
  def self.cost(str)
@@ -143,7 +143,7 @@ module Mail
143
143
  while !words.empty?
144
144
  limit = 78 - prepend
145
145
  limit = limit - 7 - encoding.length if should_encode
146
- line = ""
146
+ line = String.new
147
147
  first_word = true
148
148
  while !words.empty?
149
149
  break unless word = words.first.dup
@@ -49,7 +49,7 @@ module Mail
49
49
  # me the example so we can fix it.
50
50
  def initialize(header_text = nil, charset = nil)
51
51
  @charset = charset
52
- self.raw_source = header_text.to_crlf.lstrip
52
+ self.raw_source = ::Mail::Utilities.to_crlf(header_text).lstrip
53
53
  split_header if header_text
54
54
  end
55
55
 
@@ -204,7 +204,7 @@ module Mail
204
204
  content-id content-disposition content-location]
205
205
 
206
206
  def encoded
207
- buffer = ''
207
+ buffer = String.new
208
208
  buffer.force_encoding('us-ascii') if buffer.respond_to?(:force_encoding)
209
209
  fields.each do |field|
210
210
  buffer << field.encoded
@@ -1994,7 +1994,7 @@ module Mail
1994
1994
 
1995
1995
  def raw_source=(value)
1996
1996
  value = value.dup.force_encoding(Encoding::BINARY) if RUBY_VERSION >= "1.9.1"
1997
- @raw_source = value.to_crlf
1997
+ @raw_source = ::Mail::Utilities.to_crlf(value)
1998
1998
  end
1999
1999
 
2000
2000
  # see comments to body=. We take data and process it lazily
@@ -43,7 +43,7 @@ module Mail
43
43
 
44
44
  def self.call(path, arguments, destinations, mail)
45
45
  popen "#{path} #{arguments}" do |io|
46
- io.puts mail.encoded.to_lf
46
+ io.puts ::Mail::Utilities.to_lf(mail.encoded)
47
47
  io.flush
48
48
  end
49
49
  end
@@ -58,7 +58,7 @@ module Mail
58
58
 
59
59
  def self.call(path, arguments, destinations, encoded_message)
60
60
  popen "#{path} #{arguments} #{destinations}" do |io|
61
- io.puts encoded_message.to_lf
61
+ io.puts ::Mail::Utilities.to_lf(encoded_message)
62
62
  io.flush
63
63
  end
64
64
  end
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  module Mail
3
3
  module Utilities
4
+
5
+ LF = "\n"
6
+ CRLF = "\r\n"
7
+
4
8
  include Constants
5
9
 
6
10
  # Returns true if the string supplied is free from characters not allowed as an ATOM
@@ -219,6 +223,23 @@ module Mail
219
223
  enum.each_with_index.map(&block)
220
224
  end
221
225
 
226
+ def self.to_lf input
227
+ input.kind_of?(String) ? input.to_str.gsub(/\r\n|\r/, LF) : ''
228
+ end
229
+
230
+ if RUBY_VERSION >= '1.9'
231
+ # This 1.9 only regex can save a reasonable amount of time (~20%)
232
+ # by not matching "\r\n" so the string is returned unchanged in
233
+ # the common case.
234
+ CRLF_REGEX = Regexp.new("(?<!\r)\n|\r(?!\n)")
235
+ else
236
+ CRLF_REGEX = /\n|\r\n|\r/
237
+ end
238
+
239
+ def self.to_crlf input
240
+ input.kind_of?(String) ? input.to_str.gsub(CRLF_REGEX, CRLF) : ''
241
+ end
242
+
222
243
  end
223
244
 
224
245
  # Returns true if the object is considered blank.
@@ -4,7 +4,7 @@ module Mail
4
4
  MAJOR = 2
5
5
  MINOR = 6
6
6
  PATCH = 4
7
- BUILD = 'rc1'
7
+ BUILD = 'rc2'
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4.rc1
4
+ version: 2.6.4.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikel Lindsaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.16'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '3'
22
+ version: '4'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '1.16'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '3'
32
+ version: '4'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +110,6 @@ files:
110
110
  - lib/mail/check_delivery_params.rb
111
111
  - lib/mail/configuration.rb
112
112
  - lib/mail/constants.rb
113
- - lib/mail/core_extensions/nil.rb
114
113
  - lib/mail/core_extensions/smtp.rb
115
114
  - lib/mail/core_extensions/string.rb
116
115
  - lib/mail/core_extensions/string/access.rb
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # This is not loaded if ActiveSupport is already loaded
4
-
5
- class NilClass #:nodoc:
6
- def to_crlf
7
- ''
8
- end
9
-
10
- def to_lf
11
- ''
12
- end
13
- end