astrotrain 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4296a34990455bee98b4615fcb972dfbb65c3231
4
+ data.tar.gz: 841fe63bce0683a282c8b2406cf023f1b1f53eb0
5
+ SHA512:
6
+ metadata.gz: 2e4429961a4dd2dbf0aa02568a13ee5b0baadbfbc737c55f89025761ffeb5097f1f85d7c457c5267801d50b7cb8637986e8c6b1c6dbc920209cdc4b93b4a89a3
7
+ data.tar.gz: 3d81688e966ce59a8edf89d193ff45668851c9c84e86ed80969437ad85b61ec1e88b5c308798ce67a6fd85374f6d30d825544cefb01f02266ea0e03da5d96bec
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'astrotrain'
16
- s.version = '0.7.1'
16
+ s.version = '0.7.2'
17
17
  s.date = '2014-08-27'
18
18
  s.rubyforge_project = 'astrotrain'
19
19
 
@@ -1,5 +1,5 @@
1
1
  module Astrotrain
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.2'
3
3
 
4
4
  require 'utf8'
5
5
  require 'charlock_holmes'
@@ -63,7 +63,8 @@ module Astrotrain
63
63
  # Returns Array of possible recipients.
64
64
  def recipients(order = nil)
65
65
  if !@recipients.key?(order)
66
- order = self.class.recipient_header_order if order.blank?
66
+ order = Array(order)
67
+ order = self.class.recipient_header_order if order.empty?
67
68
  recipients = []
68
69
 
69
70
  emails = order.inject([]) do |memo, key|
@@ -309,7 +310,7 @@ module Astrotrain
309
310
  # Returns converted String.
310
311
  def convert_to_utf8(s)
311
312
  # If this string is already valid UTF-8 just hand it back
312
- if s.as_utf8.valid?
313
+ if (!@mail.charset || @mail.charset == 'UTF-8') && s.as_utf8.valid?
313
314
  s.force_encoding("UTF-8") if s.respond_to?(:force_encoding)
314
315
  return s
315
316
  end
@@ -322,7 +323,11 @@ module Astrotrain
322
323
  # if the encoding was already set or we just detected it AND it's not already
323
324
  # set to UTF-8 - try to transcode the body into UTF-8
324
325
  if @mail.charset && @mail.charset != 'UTF-8'
325
- s = CharlockHolmes::Converter.convert s, @mail.charset, 'UTF-8'
326
+ if s.size > 0
327
+ s = CharlockHolmes::Converter.convert s, @mail.charset, 'UTF-8'
328
+ else
329
+ s = ""
330
+ end
326
331
  end
327
332
 
328
333
  # By the time we get here, `s` is either UTF-8 or we need to force it to be
@@ -5,7 +5,7 @@ class MessageParsingTest < Test::Unit::TestCase
5
5
  test "bad content type header" do
6
6
  msg = astrotrain :bad_content_type
7
7
 
8
- expected_body = "This message is being generated automatically to notify you\nthat PowerMTA has crashed on mtasv.net.\n\nAs the information below is likely to be essential for debugging\nthe problem, please forward this message to <support@port25.com>.\nThank you.\nYo"
8
+ expected_body = "This message is being generated automatically to notify you\nthat PowerMTA has crashed on mtasv.net.\n\nAs the information below is likely to be essential for debugging\nthe problem, please forward this message to <support@port25.com>.\nThank you.\n\nYo"
9
9
  expected_header = "multipart/mixed; boundary=\"====boundary====\""
10
10
 
11
11
  assert_equal expected_body, msg.body
@@ -28,7 +28,7 @@ class MessageParsingTest < Test::Unit::TestCase
28
28
  assert_equal %(Bob), msg.sender.first.display_name
29
29
  assert_equal %(user@example.com), msg.sender.first.address
30
30
  assert_equal 'Fwd: blah blah', msg.subject
31
- assert_equal body, msg.body
31
+ assert_equal body + "\n", msg.body
32
32
  end
33
33
 
34
34
  test "iso 8859 1 encoded headers" do
@@ -76,7 +76,7 @@ class MessageParsingTest < Test::Unit::TestCase
76
76
  assert_kind_of Mail::Message, msg.mail
77
77
 
78
78
  assert_equal %w(foo@example.com), msg.recipients
79
- assert_equal "Testing out rich emails with attachments!\nThis one has a name property on Content-Type.\n[state:hold responsible:rick]",
79
+ assert_equal "Testing out rich emails with attachments!\nThis one has a name property on Content-Type.\n[state:hold responsible:rick]\n",
80
80
  msg.body
81
81
  assert_equal 1, msg.attachments.size
82
82
  assert_equal 'bandit.jpg', msg.attachments.first.filename
@@ -89,7 +89,7 @@ class MessageParsingTest < Test::Unit::TestCase
89
89
  assert_kind_of Mail::Message, msg.mail
90
90
 
91
91
  assert_equal %w(foo@example.com), msg.recipients
92
- assert_equal "Testing out rich emails with attachments!\nThis one has NO name property on Content-Type.\n[state:hold responsible:rick]",
92
+ assert_equal "Testing out rich emails with attachments!\nThis one has NO name property on Content-Type.\n[state:hold responsible:rick]\n",
93
93
  msg.body
94
94
  assert_equal 1, msg.attachments.size
95
95
  assert_equal 'bandit.jpg', msg.attachments.first.filename
@@ -102,7 +102,7 @@ class MessageParsingTest < Test::Unit::TestCase
102
102
  assert_kind_of Mail::Message, msg.mail
103
103
 
104
104
  assert_equal %w(foo@example.com), msg.recipients
105
- assert_equal "Let's have a test here:\nYum\n\n\nOn Feb 10, 2009, at 3:37 PM, Tender Support wrote:\n\n> // Add your reply above here\n> ==================================================\n> From: Tyler Durden\n> Subject: Email attachments and file upload\n>\n> not at the moment ... let me test\n>\n> View this Discussion online: http://foobar.com\n> .",
105
+ assert_equal "Let's have a test here:\n\n\nYum\n\n\nOn Feb 10, 2009, at 3:37 PM, Tender Support wrote:\n\n> // Add your reply above here\n> ==================================================\n> From: Tyler Durden\n> Subject: Email attachments and file upload\n>\n> not at the moment ... let me test\n>\n> View this Discussion online: http://foobar.com\n> .\n\n\n\n",
106
106
  msg.body
107
107
  assert_equal 1, msg.attachments.size
108
108
  assert_equal 'logo.gif', msg.attachments.first.filename
@@ -125,7 +125,7 @@ class MessageParsingTest < Test::Unit::TestCase
125
125
  test "recipients in the body" do
126
126
  msg = astrotrain(:multiple_with_body_recipients)
127
127
 
128
- assert_equal %w(processor@astrotrain.com other@example.com processor+foobar@astrotrain.com processor+blah@astrotrain.com),
128
+ assert_equal %w(processor@astrotrain.com other@example.com processor+foobar@astrotrain.com processor+blah@astrotrain.com),
129
129
  msg.recipients(Astrotrain::Message.recipient_header_order + %w(body))
130
130
  end
131
131
 
@@ -208,4 +208,10 @@ class MessageParsingTest < Test::Unit::TestCase
208
208
  end
209
209
  end
210
210
  end
211
+
212
+ test "iso 2022 jp encoded subject and body" do
213
+ msg = astrotrain "iso-2022-jp"
214
+ assert_mail_utf8 msg
215
+ assert_equal "投稿テスト\n--\nyamada@example.jp", msg.body
216
+ end
211
217
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrotrain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
5
- prerelease:
4
+ version: 0.7.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rick Olson
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: utf8
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mail
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: i18n
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: faraday
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: addressable
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: charlock_holmes
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -110,17 +97,15 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: resque
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  description: email => http post
@@ -166,27 +151,25 @@ files:
166
151
  - test/transport_test.rb
167
152
  homepage: http://github.com/technoweenie/astrotrain
168
153
  licenses: []
154
+ metadata: {}
169
155
  post_install_message:
170
156
  rdoc_options: []
171
157
  require_paths:
172
158
  - lib
173
159
  required_ruby_version: !ruby/object:Gem::Requirement
174
- none: false
175
160
  requirements:
176
- - - ! '>='
161
+ - - '>='
177
162
  - !ruby/object:Gem::Version
178
163
  version: '0'
179
164
  required_rubygems_version: !ruby/object:Gem::Requirement
180
- none: false
181
165
  requirements:
182
- - - ! '>='
166
+ - - '>='
183
167
  - !ruby/object:Gem::Version
184
168
  version: '0'
185
169
  requirements: []
186
170
  rubyforge_project: astrotrain
187
- rubygems_version: 1.8.23
171
+ rubygems_version: 2.0.14.1
188
172
  signing_key:
189
173
  specification_version: 2
190
174
  summary: email => http post
191
175
  test_files: []
192
- has_rdoc: