rumbster 1.0.0 → 1.0.1

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 (44) hide show
  1. data/.autotest +1 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +34 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.rdoc +50 -0
  6. data/Rakefile +50 -8
  7. data/VERSION +1 -0
  8. data/lib/message_observers.rb +3 -3
  9. data/lib/rumbster.rb +0 -0
  10. data/lib/smtp_protocol.rb +7 -7
  11. data/lib/smtp_states.rb +24 -58
  12. data/rumbster.gemspec +70 -0
  13. data/test/{message_observers_test.rb → test_message_observers.rb} +1 -1
  14. data/test/{rumbster_test.rb → test_rumbster.rb} +1 -1
  15. data/test/{smtp_protocol_test.rb → test_smtp_protocol.rb} +2 -19
  16. data/test/{smtp_states_test.rb → test_smtp_states.rb} +31 -87
  17. metadata +128 -76
  18. data/COPYING +0 -515
  19. data/README +0 -56
  20. data/vendor/tmail.rb +0 -4
  21. data/vendor/tmail/.cvsignore +0 -3
  22. data/vendor/tmail/Makefile +0 -19
  23. data/vendor/tmail/address.rb +0 -222
  24. data/vendor/tmail/base64.rb +0 -52
  25. data/vendor/tmail/compat.rb +0 -39
  26. data/vendor/tmail/config.rb +0 -50
  27. data/vendor/tmail/encode.rb +0 -447
  28. data/vendor/tmail/header.rb +0 -895
  29. data/vendor/tmail/info.rb +0 -14
  30. data/vendor/tmail/loader.rb +0 -1
  31. data/vendor/tmail/mail.rb +0 -869
  32. data/vendor/tmail/mailbox.rb +0 -386
  33. data/vendor/tmail/mbox.rb +0 -1
  34. data/vendor/tmail/net.rb +0 -260
  35. data/vendor/tmail/obsolete.rb +0 -122
  36. data/vendor/tmail/parser.rb +0 -1475
  37. data/vendor/tmail/parser.y +0 -372
  38. data/vendor/tmail/port.rb +0 -356
  39. data/vendor/tmail/scanner.rb +0 -22
  40. data/vendor/tmail/scanner_r.rb +0 -243
  41. data/vendor/tmail/stringio.rb +0 -256
  42. data/vendor/tmail/textutils.rb +0 -197
  43. data/vendor/tmail/tmail.rb +0 -1
  44. data/vendor/tmail/utils.rb +0 -23
data/README DELETED
@@ -1,56 +0,0 @@
1
- Rumbster README
2
- ===============
3
-
4
- Rumbster is a fake smtp server for email testing in Ruby.
5
- Rumbster was developed to as a way to acceptance test email
6
- sending applications.
7
-
8
- Requirements
9
- ------------
10
-
11
- * Ruby 1.8.2 or later (may work with earlier versions)
12
-
13
- License
14
- -------
15
-
16
- GNU LGPL, Lesser General Public License version 2.1
17
- For details of LGPL, see file "COPYING".
18
-
19
- Example Usage
20
- -------------
21
-
22
- A good source for usage information is the unit tests in the
23
- test directory. Below is an example of the usage.
24
-
25
- class TestEmails < Test::Unit::TestCase
26
-
27
- def setup
28
- @rumbster = Rumbster.new(port)
29
- @message_observer = MailMessageObserver.new
30
-
31
- @rumbster.add_observer @message_observer
32
- @rumbster.add_observer FileMessageObserver.new('some/directory')
33
-
34
- @rumbster.start
35
- end
36
-
37
- def teardown
38
- @rumbster.stop
39
- end
40
-
41
- def test_email_is_sent
42
- send_email
43
- assert_equal 1, @message_observer.messages.size
44
- assert_equal 'junk@junk.com', @message_observer.messages.first.to
45
- end
46
- end
47
-
48
- Bug Report
49
- ----------
50
-
51
- Any bug reports are welcome.
52
- If you encounter a bug, please email me.
53
-
54
- Adam Esterline
55
- adam@esterlines.com
56
- http://adamesterline.com
data/vendor/tmail.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'tmail/info'
2
- require 'tmail/mail'
3
- require 'tmail/mailbox'
4
- require 'tmail/obsolete'
@@ -1,3 +0,0 @@
1
- parser.rb
2
- output.parser
3
- stringio.rb
@@ -1,19 +0,0 @@
1
- #
2
- # lib/tmail/Makefile
3
- #
4
-
5
- debug:
6
- rm -f parser.rb
7
- make parser.rb DEBUG=true
8
-
9
- parser.rb: parser.y
10
- if [ "$(DEBUG)" = true ]; then \
11
- racc -v -g -o$@ parser.y ;\
12
- else \
13
- racc -E -o$@ parser.y ;\
14
- fi
15
-
16
- clean:
17
- rm -f parser.rb parser.output
18
-
19
- distclean: clean
@@ -1,222 +0,0 @@
1
- #
2
- # address.rb
3
- #
4
- # Copyright (c) 1998-2004 Minero Aoki
5
- #
6
- # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU Lesser General Public License version 2.1.
9
- #
10
-
11
- require 'tmail/encode'
12
- require 'tmail/parser'
13
-
14
- module TMail
15
-
16
- class Address
17
-
18
- include TextUtils
19
-
20
- def Address.parse(str)
21
- Parser.parse :ADDRESS, str
22
- end
23
-
24
- def address_group?
25
- false
26
- end
27
-
28
- def initialize(local, domain)
29
- if domain
30
- domain.each do |s|
31
- raise SyntaxError, 'empty word in domain' if s.empty?
32
- end
33
- end
34
- @local = local
35
- @domain = domain
36
- @name = nil
37
- @routes = []
38
- end
39
-
40
- attr_reader :name
41
-
42
- def name=(str)
43
- @name = str
44
- @name = nil if str and str.empty?
45
- end
46
-
47
- alias phrase name
48
- alias phrase= name=
49
-
50
- attr_reader :routes
51
-
52
- def inspect
53
- "#<#{self.class} #{address()}>"
54
- end
55
-
56
- def local
57
- return nil unless @local
58
- return '""' if @local.size == 1 and @local[0].empty?
59
- @local.map {|i| quote_atom(i) }.join('.')
60
- end
61
-
62
- def domain
63
- return nil unless @domain
64
- join_domain(@domain)
65
- end
66
-
67
- def spec
68
- s = self.local
69
- d = self.domain
70
- if s and d
71
- s + '@' + d
72
- else
73
- s
74
- end
75
- end
76
-
77
- alias address spec
78
-
79
-
80
- def ==(other)
81
- other.respond_to? :spec and self.spec == other.spec
82
- end
83
-
84
- alias eql? ==
85
-
86
- def hash
87
- @local.hash ^ @domain.hash
88
- end
89
-
90
- def dup
91
- obj = self.class.new(@local.dup, @domain.dup)
92
- obj.name = @name.dup if @name
93
- obj.routes.replace @routes
94
- obj
95
- end
96
-
97
- include StrategyInterface
98
-
99
- def accept(strategy, dummy1 = nil, dummy2 = nil)
100
- unless @local
101
- strategy.meta '<>' # empty return-path
102
- return
103
- end
104
-
105
- spec_p = (not @name and @routes.empty?)
106
- if @name
107
- strategy.phrase @name
108
- strategy.space
109
- end
110
- tmp = spec_p ? '' : '<'
111
- unless @routes.empty?
112
- tmp << @routes.map {|i| '@' + i }.join(',') << ':'
113
- end
114
- tmp << self.spec
115
- tmp << '>' unless spec_p
116
- strategy.meta tmp
117
- strategy.lwsp ''
118
- end
119
-
120
- end
121
-
122
-
123
- class AddressGroup
124
-
125
- include Enumerable
126
-
127
- def address_group?
128
- true
129
- end
130
-
131
- def initialize(name, addrs)
132
- @name = name
133
- @addresses = addrs
134
- end
135
-
136
- attr_reader :name
137
-
138
- def ==(other)
139
- other.respond_to? :to_a and @addresses == other.to_a
140
- end
141
-
142
- alias eql? ==
143
-
144
- def hash
145
- map {|i| i.hash }.hash
146
- end
147
-
148
- def [](idx)
149
- @addresses[idx]
150
- end
151
-
152
- def size
153
- @addresses.size
154
- end
155
-
156
- def empty?
157
- @addresses.empty?
158
- end
159
-
160
- def each(&block)
161
- @addresses.each(&block)
162
- end
163
-
164
- def to_a
165
- @addresses.dup
166
- end
167
-
168
- alias to_ary to_a
169
-
170
- def include?(a)
171
- @addresses.include? a
172
- end
173
-
174
- def flatten
175
- set = []
176
- @addresses.each do |a|
177
- if a.respond_to? :flatten
178
- set.concat a.flatten
179
- else
180
- set.push a
181
- end
182
- end
183
- set
184
- end
185
-
186
- def each_address(&block)
187
- flatten.each(&block)
188
- end
189
-
190
- def add(a)
191
- @addresses.push a
192
- end
193
-
194
- alias push add
195
-
196
- def delete(a)
197
- @addresses.delete a
198
- end
199
-
200
- include StrategyInterface
201
-
202
- def accept(strategy, dummy1 = nil, dummy2 = nil)
203
- strategy.phrase @name
204
- strategy.meta ':'
205
- strategy.space
206
- first = true
207
- each do |mbox|
208
- if first
209
- first = false
210
- else
211
- strategy.meta ','
212
- end
213
- strategy.space
214
- mbox.accept strategy
215
- end
216
- strategy.meta ';'
217
- strategy.lwsp ''
218
- end
219
-
220
- end
221
-
222
- end # module TMail
@@ -1,52 +0,0 @@
1
- #
2
- # base64.rb
3
- #
4
- # Copyright (c) 1998-2004 Minero Aoki
5
- #
6
- # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU Lesser General Public License version 2.1.
9
- #
10
-
11
- module TMail
12
-
13
- module Base64
14
-
15
- module_function
16
-
17
- def rb_folding_encode(str, eol = "\n", limit = 60)
18
- [str].pack('m')
19
- end
20
-
21
- def rb_encode(str)
22
- [str].pack('m').tr( "\r\n", '' )
23
- end
24
-
25
- def rb_decode(str, strict = false)
26
- str.unpack('m')
27
- end
28
-
29
- begin
30
- require 'tmail/base64.so'
31
- alias folding_encode c_folding_encode
32
- alias encode c_encode
33
- alias decode c_decode
34
- class << self
35
- alias folding_encode c_folding_encode
36
- alias encode c_encode
37
- alias decode c_decode
38
- end
39
- rescue LoadError
40
- alias folding_encode rb_folding_encode
41
- alias encode rb_encode
42
- alias decode rb_decode
43
- class << self
44
- alias folding_encode rb_folding_encode
45
- alias encode rb_encode
46
- alias decode rb_decode
47
- end
48
- end
49
-
50
- end
51
-
52
- end
@@ -1,39 +0,0 @@
1
- unless Enumerable.method_defined?(:map)
2
- module Enumerable
3
- alias map collect
4
- end
5
- end
6
-
7
- unless Enumerable.method_defined?(:select)
8
- module Enumerable
9
- alias select find_all
10
- end
11
- end
12
-
13
- unless Enumerable.method_defined?(:reject)
14
- module Enumerable
15
- def reject
16
- result = []
17
- each do |i|
18
- result.push i unless yield(i)
19
- end
20
- result
21
- end
22
- end
23
- end
24
-
25
- unless Enumerable.method_defined?(:sort_by)
26
- module Enumerable
27
- def sort_by
28
- map {|i| [yield(i), i] }.sort.map {|val, i| i }
29
- end
30
- end
31
- end
32
-
33
- unless File.respond_to?(:read)
34
- def File.read(fname)
35
- File.open(fname) {|f|
36
- return f.read
37
- }
38
- end
39
- end
@@ -1,50 +0,0 @@
1
- #
2
- # config.rb
3
- #
4
- # Copyright (c) 1998-2004 Minero Aoki
5
- #
6
- # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU Lesser General Public License version 2.1.
9
- #
10
-
11
- module TMail
12
-
13
- class Config
14
-
15
- def initialize(strict)
16
- @strict_parse = strict
17
- @strict_base64decode = strict
18
- end
19
-
20
- def strict_parse?
21
- @strict_parse
22
- end
23
-
24
- attr_writer :strict_parse
25
-
26
- def strict_base64decode?
27
- @strict_base64decode
28
- end
29
-
30
- attr_writer :strict_base64decode
31
-
32
- def new_body_port(mail)
33
- StringPort.new
34
- end
35
-
36
- alias new_preamble_port new_body_port
37
- alias new_part_port new_body_port
38
-
39
- end
40
-
41
- DEFAULT_CONFIG = Config.new(false)
42
- DEFAULT_STRICT_CONFIG = Config.new(true)
43
-
44
- def Config.to_config(arg)
45
- return DEFAULT_STRICT_CONFIG if arg == true
46
- return DEFAULT_CONFIG if arg == false
47
- arg or DEFAULT_CONFIG
48
- end
49
-
50
- end