actionmailer 2.3.18 → 3.0.0.beta

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.
Files changed (154) hide show
  1. data/CHANGELOG +13 -16
  2. data/README +39 -21
  3. data/lib/action_mailer/adv_attr_accessor.rb +14 -18
  4. data/lib/action_mailer/base.rb +437 -560
  5. data/lib/action_mailer/collector.rb +36 -0
  6. data/lib/action_mailer/delivery_methods.rb +86 -0
  7. data/lib/action_mailer/deprecated_api.rb +139 -0
  8. data/lib/action_mailer/mail_helper.rb +25 -13
  9. data/lib/action_mailer/old_api.rb +248 -0
  10. data/lib/action_mailer/quoting.rb +4 -2
  11. data/lib/action_mailer/railtie.rb +25 -0
  12. data/lib/action_mailer/railties/subscriber.rb +20 -0
  13. data/lib/action_mailer/test_case.rb +4 -6
  14. data/lib/action_mailer/test_helper.rb +0 -1
  15. data/lib/action_mailer/tmail_compat.rb +34 -0
  16. data/lib/action_mailer/version.rb +3 -3
  17. data/lib/action_mailer.rb +25 -30
  18. metadata +41 -161
  19. data/Rakefile +0 -97
  20. data/install.rb +0 -30
  21. data/lib/action_mailer/helpers.rb +0 -113
  22. data/lib/action_mailer/part.rb +0 -107
  23. data/lib/action_mailer/part_container.rb +0 -55
  24. data/lib/action_mailer/utils.rb +0 -7
  25. data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +0 -1466
  26. data/lib/action_mailer/vendor/text_format.rb +0 -10
  27. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +0 -18
  28. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +0 -392
  29. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +0 -65
  30. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +0 -46
  31. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +0 -41
  32. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +0 -67
  33. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +0 -63
  34. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +0 -590
  35. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +0 -962
  36. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +0 -9
  37. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +0 -1162
  38. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +0 -3
  39. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +0 -578
  40. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +0 -496
  41. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +0 -6
  42. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +0 -3
  43. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +0 -250
  44. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +0 -132
  45. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +0 -1060
  46. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +0 -416
  47. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +0 -379
  48. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +0 -164
  49. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +0 -58
  50. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +0 -49
  51. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +0 -262
  52. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +0 -280
  53. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +0 -362
  54. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +0 -504
  55. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +0 -12
  56. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +0 -927
  57. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +0 -42
  58. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +0 -238
  59. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +0 -112
  60. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +0 -75
  61. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +0 -64
  62. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +0 -42
  63. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +0 -89
  64. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +0 -244
  65. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +0 -88
  66. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +0 -596
  67. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +0 -42
  68. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +0 -430
  69. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +0 -42
  70. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +0 -474
  71. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +0 -42
  72. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +0 -289
  73. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +0 -570
  74. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +0 -229
  75. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +0 -229
  76. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +0 -330
  77. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +0 -227
  78. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +0 -202
  79. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +0 -226
  80. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +0 -201
  81. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +0 -147
  82. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +0 -89
  83. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +0 -45
  84. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +0 -542
  85. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +0 -124
  86. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +0 -56
  87. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +0 -88
  88. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +0 -168
  89. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +0 -87
  90. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +0 -67
  91. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +0 -39
  92. data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +0 -6
  93. data/lib/action_mailer/vendor/tmail.rb +0 -17
  94. data/lib/actionmailer.rb +0 -2
  95. data/test/abstract_unit.rb +0 -62
  96. data/test/asset_host_test.rb +0 -54
  97. data/test/delivery_method_test.rb +0 -51
  98. data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +0 -1
  99. data/test/fixtures/auto_layout_mailer/hello.html.erb +0 -1
  100. data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +0 -1
  101. data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +0 -1
  102. data/test/fixtures/explicit_layout_mailer/logout.html.erb +0 -1
  103. data/test/fixtures/explicit_layout_mailer/signup.html.erb +0 -1
  104. data/test/fixtures/first_mailer/share.erb +0 -1
  105. data/test/fixtures/helper_mailer/use_example_helper.erb +0 -1
  106. data/test/fixtures/helper_mailer/use_helper.erb +0 -1
  107. data/test/fixtures/helper_mailer/use_helper_method.erb +0 -1
  108. data/test/fixtures/helper_mailer/use_mail_helper.erb +0 -5
  109. data/test/fixtures/helpers/example_helper.rb +0 -5
  110. data/test/fixtures/layouts/auto_layout_mailer.html.erb +0 -1
  111. data/test/fixtures/layouts/auto_layout_mailer.text.erb +0 -1
  112. data/test/fixtures/layouts/spam.html.erb +0 -1
  113. data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +0 -1
  114. data/test/fixtures/raw_email +0 -14
  115. data/test/fixtures/raw_email10 +0 -20
  116. data/test/fixtures/raw_email12 +0 -32
  117. data/test/fixtures/raw_email13 +0 -29
  118. data/test/fixtures/raw_email2 +0 -114
  119. data/test/fixtures/raw_email3 +0 -70
  120. data/test/fixtures/raw_email4 +0 -59
  121. data/test/fixtures/raw_email5 +0 -19
  122. data/test/fixtures/raw_email6 +0 -20
  123. data/test/fixtures/raw_email7 +0 -66
  124. data/test/fixtures/raw_email8 +0 -47
  125. data/test/fixtures/raw_email9 +0 -28
  126. data/test/fixtures/raw_email_quoted_with_0d0a +0 -14
  127. data/test/fixtures/raw_email_with_invalid_characters_in_content_type +0 -104
  128. data/test/fixtures/raw_email_with_nested_attachment +0 -100
  129. data/test/fixtures/raw_email_with_partially_quoted_subject +0 -14
  130. data/test/fixtures/second_mailer/share.erb +0 -1
  131. data/test/fixtures/templates/signed_up.erb +0 -3
  132. data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +0 -1
  133. data/test/fixtures/test_mailer/body_ivar.erb +0 -2
  134. data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +0 -6
  135. data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +0 -6
  136. data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +0 -1
  137. data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +0 -1
  138. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +0 -10
  139. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +0 -10
  140. data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +0 -2
  141. data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +0 -1
  142. data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +0 -1
  143. data/test/fixtures/test_mailer/rxml_template.builder +0 -2
  144. data/test/fixtures/test_mailer/rxml_template.rxml +0 -2
  145. data/test/fixtures/test_mailer/signed_up.html.erb +0 -3
  146. data/test/fixtures/test_mailer/signed_up_with_url.erb +0 -5
  147. data/test/mail_helper_test.rb +0 -95
  148. data/test/mail_layout_test.rb +0 -123
  149. data/test/mail_render_test.rb +0 -116
  150. data/test/mail_service_test.rb +0 -1145
  151. data/test/quoting_test.rb +0 -105
  152. data/test/test_helper_test.rb +0 -129
  153. data/test/tmail_test.rb +0 -22
  154. data/test/url_test.rb +0 -76
@@ -1,56 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is Mozilla Universal charset detector code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 2001
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Jeff Hodges - port to Ruby
11
- # Mark Pilgrim - port to Python
12
- # Shy Shalom - original C code
13
- #
14
- # This library is free software; you can redistribute it and/or
15
- # modify it under the terms of the GNU Lesser General Public
16
- # License as published by the Free Software Foundation; either
17
- # version 2.1 of the License, or (at your option) any later version.
18
- #
19
- # This library is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
- # Lesser General Public License for more details.
23
- #
24
- # You should have received a copy of the GNU Lesser General Public
25
- # License along with this library; if not, write to the Free Software
26
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27
- # 02110-1301 USA
28
- ######################### END LICENSE BLOCK #########################
29
-
30
- module CharDet
31
- class SBCSGroupProber < CharSetGroupProber
32
- def initialize
33
- super
34
- @_mProbers = [ SingleByteCharSetProber.new(Win1251CyrillicModel),
35
- SingleByteCharSetProber.new(Koi8rModel),
36
- SingleByteCharSetProber.new(Latin5CyrillicModel),
37
- SingleByteCharSetProber.new(MacCyrillicModel),
38
- SingleByteCharSetProber.new(Ibm866Model),
39
- SingleByteCharSetProber.new(Ibm855Model),
40
- SingleByteCharSetProber.new(Latin7GreekModel),
41
- SingleByteCharSetProber.new(Win1253GreekModel),
42
- SingleByteCharSetProber.new(Latin5BulgarianModel),
43
- SingleByteCharSetProber.new(Win1251BulgarianModel),
44
- SingleByteCharSetProber.new(Latin2HungarianModel),
45
- SingleByteCharSetProber.new(Win1250HungarianModel),
46
- SingleByteCharSetProber.new(TIS620ThaiModel) ]
47
- hebrewProber = HebrewProber.new()
48
- logicalHebrewProber = SingleByteCharSetProber.new(Win1255HebrewModel, false, hebrewProber)
49
- visualHebrewProber = SingleByteCharSetProber.new(Win1255HebrewModel, true, hebrewProber)
50
- hebrewProber.set_model_probers(logicalHebrewProber, visualHebrewProber)
51
- @_mProbers += [hebrewProber, logicalHebrewProber, visualHebrewProber]
52
-
53
- reset()
54
- end
55
- end
56
- end
@@ -1,88 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is mozilla.org code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 1998
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Jeff Hodges - port to Ruby
11
- # Mark Pilgrim - port to Python
12
- #
13
- # This library is free software; you can redistribute it and/or
14
- # modify it under the terms of the GNU Lesser General Public
15
- # License as published by the Free Software Foundation; either
16
- # version 2.1 of the License, or (at your option) any later version.
17
- #
18
- # This library is distributed in the hope that it will be useful,
19
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # Lesser General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU Lesser General Public
24
- # License along with this library; if not, write to the Free Software
25
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
- # 02110-1301 USA
27
- ######################### END LICENSE BLOCK #########################
28
-
29
- module CharDet
30
- class SJISProber < MultiByteCharSetProber
31
- def initialize
32
- super()
33
- @_mCodingSM = CodingStateMachine.new(SJISSMModel)
34
- @_mDistributionAnalyzer = SJISDistributionAnalysis.new()
35
- @_mContextAnalyzer = SJISContextAnalysis.new()
36
- reset()
37
- end
38
-
39
- def reset
40
- super()
41
- @_mContextAnalyzer.reset()
42
- end
43
-
44
- def get_charset_name
45
- return "SHIFT_JIS"
46
- end
47
-
48
- def feed(aBuf)
49
- aLen = aBuf.length
50
- for i in (0...aLen)
51
- codingState = @_mCodingSM.next_state(aBuf[i..i])
52
- if codingState == EError
53
- $stderr << "#{get_charset_name} prober hit error at byte #{i}\n" if $debug
54
- @_mState = ENotMe
55
- break
56
- elsif codingState == EItsMe
57
- @_mState = EFoundIt
58
- break
59
- elsif codingState == EStart
60
- charLen = @_mCodingSM.get_current_charlen()
61
- if i == 0
62
- @_mLastChar[1] = aBuf[0..0]
63
- @_mContextAnalyzer.feed(@_mLastChar[2 - charLen..-1], charLen)
64
- @_mDistributionAnalyzer.feed(@_mLastChar, charLen)
65
- else
66
- @_mContextAnalyzer.feed(aBuf[i + 1 - charLen ... i + 3 - charLen], charLen)
67
- @_mDistributionAnalyzer.feed(aBuf[i - 1 ... i + 1], charLen)
68
- end
69
- end
70
- end
71
-
72
- @_mLastChar[0] = aBuf[aLen - 1.. aLen-1]
73
-
74
- if get_state() == EDetecting
75
- if @_mContextAnalyzer.got_enough_data() and (get_confidence() > SHORTCUT_THRESHOLD)
76
- @_mState = EFoundIt
77
- end
78
- end
79
-
80
- return get_state()
81
- end
82
-
83
- def get_confidence
84
- l = [@_mContextAnalyzer.get_confidence(), @_mDistributionAnalyzer.get_confidence()]
85
- return l.max
86
- end
87
- end
88
- end
@@ -1,168 +0,0 @@
1
- # encoding: us-ascii
2
- ######################## BEGIN LICENSE BLOCK ########################
3
- # The Original Code is Mozilla Universal charset detector code.
4
- #
5
- # The Initial Developer of the Original Code is
6
- # Netscape Communications Corporation.
7
- # Portions created by the Initial Developer are Copyright (C) 2001
8
- # the Initial Developer. All Rights Reserved.
9
- #
10
- # Contributor(s):
11
- # Jeff Hodges - port to Ruby
12
- # Mark Pilgrim - port to Python
13
- # Shy Shalom - original C code
14
- #
15
- # This library is free software; you can redistribute it and/or
16
- # modify it under the terms of the GNU Lesser General Public
17
- # License as published by the Free Software Foundation; either
18
- # version 2.1 of the License, or (at your option) any later version.
19
- #
20
- # This library is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
- # Lesser General Public License for more details.
24
- #
25
- # You should have received a copy of the GNU Lesser General Public
26
- # License along with this library; if not, write to the Free Software
27
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28
- # 02110-1301 USA
29
- ######################### END LICENSE BLOCK #########################
30
-
31
- module CharDet
32
- MINIMUM_THRESHOLD = 0.20
33
- EPureAscii = 0
34
- EEscAscii = 1
35
- EHighbyte = 2
36
-
37
- class UniversalDetector
38
- attr_accessor :result
39
- def initialize
40
- @_highBitDetector = /[\x80-\xFF]/
41
- @_escDetector = /(\033|\~\{)/
42
- @_mEscCharSetProber = nil
43
- @_mCharSetProbers = []
44
- reset()
45
- end
46
-
47
- def reset
48
- @result = {'encoding' => nil, 'confidence' => 0.0}
49
- @done = false
50
- @_mStart = true
51
- @_mGotData = false
52
- @_mInputState = EPureAscii
53
- @_mLastChar = ''
54
- if @_mEscCharSetProber
55
- @_mEscCharSetProber.reset()
56
- end
57
- for prober in @_mCharSetProbers
58
- prober.reset()
59
- end
60
- end
61
-
62
- def feed(aBuf)
63
- return if @done
64
-
65
- aLen = aBuf.length
66
- return if not aLen
67
-
68
- if not @_mGotData
69
- # If the data starts with BOM, we know it is UTF
70
- if aBuf[0...3] == "\xEF\xBB\xBF"
71
- # EF BB BF UTF-8 with BOM
72
- @result = {'encoding' => "UTF-8", 'confidence' => 1.0}
73
- elsif aBuf[0...4] == "\xFF\xFE\x00\x00"
74
- # FF FE 00 00 UTF-32, little-endian BOM
75
- @result = {'encoding' => "UTF-32LE", 'confidence' => 1.0}
76
- elsif aBuf[0...4] == "\x00\x00\xFE\xFF"
77
- # 00 00 FE FF UTF-32, big-endian BOM
78
- @result = {'encoding' => "UTF-32BE", 'confidence' => 1.0}
79
- elsif aBuf[0...4] == "\xFE\xFF\x00\x00"
80
- # FE FF 00 00 UCS-4, unusual octet order BOM (3412)
81
- @result = {'encoding' => "X-ISO-10646-UCS-4-3412", 'confidence' => 1.0}
82
- elsif aBuf[0...4] == "\x00\x00\xFF\xFE"
83
- # 00 00 FF FE UCS-4, unusual octet order BOM (2143)
84
- @result = {'encoding' => "X-ISO-10646-UCS-4-2143", 'confidence' => 1.0}
85
- elsif aBuf[0...2] == "\xFF\xFE"
86
- # FF FE UTF-16, little endian BOM
87
- @result = {'encoding' => "UTF-16LE", 'confidence' => 1.0}
88
- elsif aBuf[0...2] == "\xFE\xFF"
89
- # FE FF UTF-16, big endian BOM
90
- @result = {'encoding' => "UTF-16BE", 'confidence' => 1.0}
91
- end
92
- end
93
-
94
- @_mGotData = true
95
- if @result['encoding'] and (@result['confidence'] > 0.0)
96
- @done = true
97
- return
98
- end
99
-
100
- if @_mInputState == EPureAscii
101
- if @_highBitDetector =~ (aBuf)
102
- @_mInputState = EHighbyte
103
- elsif (@_mInputState == EPureAscii) and @_escDetector =~ (@_mLastChar + aBuf)
104
- @_mInputState = EEscAscii
105
- end
106
- end
107
-
108
- @_mLastChar = aBuf[-1..-1]
109
- if @_mInputState == EEscAscii
110
- if not @_mEscCharSetProber
111
- @_mEscCharSetProber = EscCharSetProber.new()
112
- end
113
- if @_mEscCharSetProber.feed(aBuf) == EFoundIt
114
- @result = {'encoding' => self._mEscCharSetProber.get_charset_name(),
115
- 'confidence' => @_mEscCharSetProber.get_confidence()
116
- }
117
- @done = true
118
- end
119
- elsif @_mInputState == EHighbyte
120
- if not @_mCharSetProbers or @_mCharSetProbers.empty?
121
- @_mCharSetProbers = [MBCSGroupProber.new(), SBCSGroupProber.new(), Latin1Prober.new()]
122
- end
123
- for prober in @_mCharSetProbers
124
- if prober.feed(aBuf) == EFoundIt
125
- @result = {'encoding' => prober.get_charset_name(),
126
- 'confidence' => prober.get_confidence()}
127
- @done = true
128
- break
129
- end
130
- end
131
- end
132
-
133
- end
134
-
135
- def close
136
- return if @done
137
- if not @_mGotData
138
- $stderr << "no data received!\n" if $debug
139
- return
140
- end
141
- @done = true
142
-
143
- if @_mInputState == EPureAscii
144
- @result = {'encoding' => 'ascii', 'confidence' => 1.0}
145
- return @result
146
- end
147
-
148
- if @_mInputState == EHighbyte
149
- confidences = {}
150
- @_mCharSetProbers.each{ |prober| confidences[prober] = prober.get_confidence }
151
- maxProber = @_mCharSetProbers.max{ |a,b| confidences[a] <=> confidences[b] }
152
- if maxProber and maxProber.get_confidence > MINIMUM_THRESHOLD
153
- @result = {'encoding' => maxProber.get_charset_name(),
154
- 'confidence' => maxProber.get_confidence()}
155
- return @result
156
- end
157
- end
158
-
159
- if $debug
160
- $stderr << "no probers hit minimum threshhold\n" if $debug
161
- for prober in @_mCharSetProbers[0]._mProbers
162
- next if not prober
163
- $stderr << "#{prober.get_charset_name} confidence = #{prober.get_confidence}\n" if $debug
164
- end
165
- end
166
- end
167
- end
168
- end
@@ -1,87 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is mozilla.org code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 1998
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Jeff Hodges - port to Ruby
11
- # Mark Pilgrim - port to Python
12
- #
13
- # This library is free software; you can redistribute it and/or
14
- # modify it under the terms of the GNU Lesser General Public
15
- # License as published by the Free Software Foundation; either
16
- # version 2.1 of the License, or (at your option) any later version.
17
- #
18
- # This library is distributed in the hope that it will be useful,
19
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # Lesser General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU Lesser General Public
24
- # License along with this library; if not, write to the Free Software
25
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
- # 02110-1301 USA
27
- ######################### END LICENSE BLOCK #########################
28
-
29
- module CharDet
30
- ONE_CHAR_PROB = 0.5
31
-
32
- class UTF8Prober < CharSetProber
33
- def initialize
34
- super()
35
- @_mCodingSM = CodingStateMachine.new(UTF8SMModel)
36
- reset()
37
- end
38
-
39
- def reset
40
- super()
41
- @_mCodingSM.reset()
42
- @_mNumOfMBChar = 0
43
- end
44
-
45
- def get_charset_name
46
- return "utf-8"
47
- end
48
-
49
- def feed(aBuf)
50
- aBuf.each_byte do |b|
51
- c = b.chr
52
- codingState = @_mCodingSM.next_state(c)
53
- if codingState == EError
54
- @_mState = ENotMe
55
- break
56
- elsif codingState == EItsMe
57
- @_mState = EFoundIt
58
- break
59
- elsif codingState == EStart
60
- if @_mCodingSM.get_current_charlen() >= 2
61
- @_mNumOfMBChar += 1
62
- end
63
- end
64
- end
65
-
66
- if get_state() == EDetecting
67
- if get_confidence() > SHORTCUT_THRESHOLD
68
- @_mState = EFoundIt
69
- end
70
- end
71
-
72
- return get_state()
73
- end
74
-
75
- def get_confidence
76
- unlike = 0.99
77
- if @_mNumOfMBChar < 6
78
- for i in (0...@_mNumOfMBChar)
79
- unlike = unlike * ONE_CHAR_PROB
80
- end
81
- return 1.0 - unlike
82
- else
83
- return unlike
84
- end
85
- end
86
- end
87
- end
@@ -1,67 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # This library is free software; you can redistribute it and/or
3
- # modify it under the terms of the GNU Lesser General Public
4
- # License as published by the Free Software Foundation; either
5
- # version 2.1 of the License, or (at your option) any later version.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
15
- # 02110-1301 USA
16
- ######################### END LICENSE BLOCK #########################
17
-
18
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
19
-
20
- require 'rchardet/charsetprober'
21
- require 'rchardet/mbcharsetprober'
22
-
23
- require 'rchardet/big5freq'
24
- require 'rchardet/big5prober'
25
- require 'rchardet/chardistribution'
26
- require 'rchardet/charsetgroupprober'
27
-
28
- require 'rchardet/codingstatemachine'
29
- require 'rchardet/constants'
30
- require 'rchardet/escprober'
31
- require 'rchardet/escsm'
32
- require 'rchardet/eucjpprober'
33
- require 'rchardet/euckrfreq'
34
- require 'rchardet/euckrprober'
35
- require 'rchardet/euctwfreq'
36
- require 'rchardet/euctwprober'
37
- require 'rchardet/gb2312freq'
38
- require 'rchardet/gb2312prober'
39
- require 'rchardet/hebrewprober'
40
- require 'rchardet/jisfreq'
41
- require 'rchardet/jpcntx'
42
- require 'rchardet/langbulgarianmodel'
43
- require 'rchardet/langcyrillicmodel'
44
- require 'rchardet/langgreekmodel'
45
- require 'rchardet/langhebrewmodel'
46
- require 'rchardet/langhungarianmodel'
47
- require 'rchardet/langthaimodel'
48
- require 'rchardet/latin1prober'
49
-
50
- require 'rchardet/mbcsgroupprober'
51
- require 'rchardet/mbcssm'
52
- require 'rchardet/sbcharsetprober'
53
- require 'rchardet/sbcsgroupprober'
54
- require 'rchardet/sjisprober'
55
- require 'rchardet/universaldetector'
56
- require 'rchardet/utf8prober'
57
-
58
- module CharDet
59
- VERSION = "1.3"
60
- def CharDet.detect(aBuf)
61
- u = UniversalDetector.new
62
- u.reset
63
- u.feed(aBuf)
64
- u.close
65
- u.result
66
- end
67
- end
@@ -1,39 +0,0 @@
1
- #
2
- # version.rb
3
- #
4
- #--
5
- # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining
8
- # a copy of this software and associated documentation files (the
9
- # "Software"), to deal in the Software without restriction, including
10
- # without limitation the rights to use, copy, modify, merge, publish,
11
- # distribute, sublicense, and/or sell copies of the Software, and to
12
- # permit persons to whom the Software is furnished to do so, subject to
13
- # the following conditions:
14
- #
15
- # The above copyright notice and this permission notice shall be
16
- # included in all copies or substantial portions of the Software.
17
- #
18
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
- #
26
- # Note: Originally licensed under LGPL v2+. Using MIT license for Rails
27
- # with permission of Minero Aoki.
28
- #++
29
-
30
- #:stopdoc:
31
- module TMail
32
- module VERSION
33
- MAJOR = 1
34
- MINOR = 2
35
- TINY = 6
36
-
37
- STRING = [MAJOR, MINOR, TINY].join('.')
38
- end
39
- end
@@ -1,6 +0,0 @@
1
- require 'tmail/version'
2
- require 'tmail/mail'
3
- require 'tmail/mailbox'
4
- require 'tmail/core_extensions'
5
- require 'tmail/net'
6
- require 'tmail/vendor/rchardet-1.3/lib/rchardet'
@@ -1,17 +0,0 @@
1
- # Prefer gems to the bundled libs.
2
- require 'rubygems'
3
-
4
- begin
5
- gem 'tmail', '~> 1.2.7'
6
- rescue Gem::LoadError
7
- $:.unshift "#{File.dirname(__FILE__)}/tmail-1.2.7"
8
- end
9
-
10
- module TMail
11
- end
12
-
13
- require 'tmail'
14
-
15
- silence_warnings do
16
- TMail::Encoder.const_set("MAX_LINE_LEN", 200)
17
- end
data/lib/actionmailer.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'action_mailer'
2
- ActiveSupport::Deprecation.warn 'require "actionmailer" is deprecated and will be removed in Rails 3. Use require "action_mailer" instead.'
@@ -1,62 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
-
4
- $:.unshift File.expand_path('../../lib', __FILE__)
5
- $:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
6
- $:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
7
- require 'action_mailer'
8
- require 'action_mailer/test_case'
9
-
10
- # Show backtraces for deprecated behavior for quicker cleanup.
11
- ActiveSupport::Deprecation.debug = true
12
-
13
- # Bogus template processors
14
- ActionView::Template.register_template_handler :haml, lambda { |template| "Look its HAML!".inspect }
15
- ActionView::Template.register_template_handler :bak, lambda { |template| "Lame backup".inspect }
16
-
17
- $:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers"
18
-
19
- ActionView::Base.cache_template_loading = true
20
- FIXTURE_LOAD_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
21
- ActionMailer::Base.template_root = FIXTURE_LOAD_PATH
22
-
23
- class MockSMTP
24
- def self.deliveries
25
- @@deliveries
26
- end
27
-
28
- def initialize
29
- @@deliveries = []
30
- end
31
-
32
- def sendmail(mail, from, to)
33
- @@deliveries << [mail, from, to]
34
- end
35
-
36
- def start(*args)
37
- yield self
38
- end
39
- end
40
-
41
- class Net::SMTP
42
- def self.new(*args)
43
- MockSMTP.new
44
- end
45
- end
46
-
47
- def uses_gem(gem_name, test_name, version = '> 0')
48
- gem gem_name.to_s, version
49
- require gem_name.to_s
50
- yield
51
- rescue LoadError
52
- $stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again."
53
- end
54
-
55
- def set_delivery_method(delivery_method)
56
- @old_delivery_method = ActionMailer::Base.delivery_method
57
- ActionMailer::Base.delivery_method = delivery_method
58
- end
59
-
60
- def restore_delivery_method
61
- ActionMailer::Base.delivery_method = @old_delivery_method
62
- end
@@ -1,54 +0,0 @@
1
- require 'abstract_unit'
2
-
3
- class AssetHostMailer < ActionMailer::Base
4
- def email_with_asset(recipient)
5
- recipients recipient
6
- subject "testing email containing asset path while asset_host is set"
7
- from "tester@example.com"
8
- end
9
- end
10
-
11
- class AssetHostTest < Test::Unit::TestCase
12
- def setup
13
- set_delivery_method :test
14
- ActionMailer::Base.perform_deliveries = true
15
- ActionMailer::Base.deliveries = []
16
-
17
- @recipient = 'test@localhost'
18
- end
19
-
20
- def teardown
21
- restore_delivery_method
22
- end
23
-
24
- def test_asset_host_as_string
25
- ActionController::Base.asset_host = "http://www.example.com"
26
- mail = AssetHostMailer.deliver_email_with_asset(@recipient)
27
- assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.strip
28
- end
29
-
30
- def test_asset_host_as_one_arguement_proc
31
- ActionController::Base.asset_host = Proc.new { |source|
32
- if source.starts_with?('/images')
33
- "http://images.example.com"
34
- else
35
- "http://assets.example.com"
36
- end
37
- }
38
- mail = AssetHostMailer.deliver_email_with_asset(@recipient)
39
- assert_equal "<img alt=\"Somelogo\" src=\"http://images.example.com/images/somelogo.png\" />", mail.body.strip
40
- end
41
-
42
- def test_asset_host_as_two_arguement_proc
43
- ActionController::Base.asset_host = Proc.new {|source,request|
44
- if request && request.ssl?
45
- "https://www.example.com"
46
- else
47
- "http://www.example.com"
48
- end
49
- }
50
- mail = nil
51
- assert_nothing_raised { mail = AssetHostMailer.deliver_email_with_asset(@recipient) }
52
- assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.strip
53
- end
54
- end