mailcrate 0.0.3 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/mailcrate.rb +14 -12
- metadata +8 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 50ce84b7ea6e73089308e4ee83f3721541698b1a
|
4
|
+
data.tar.gz: a80fdec63e624fb7fa55f8f583901922842f6d65
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 862aaf48feeb51c8c5205970a09b226137231a9acc8085b08588586d56c1276ab3067af955562229458737fba742596f0aefad57116b6a8f28ade1203b61ad1f
|
7
|
+
data.tar.gz: 88e6a4513d5810beea00bba5c361913c81d109dc7019cf55667a80d431809664000d074d3a7b8b0df80cba2fcf29071b97dbe77fb5bed1f8e50a599ee45890cb
|
data/lib/mailcrate.rb
CHANGED
@@ -22,10 +22,11 @@ class Mailcrate
|
|
22
22
|
|
23
23
|
def stop
|
24
24
|
self.class.used_ports.delete(@port)
|
25
|
+
@thread.kill unless @thread.nil?
|
26
|
+
@thread.join unless @thread.nil?
|
25
27
|
@service.close unless @service.nil? || @service.closed?
|
26
|
-
@thread.kill
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
private
|
30
31
|
|
31
32
|
def accept(service)
|
@@ -34,22 +35,22 @@ class Mailcrate
|
|
34
35
|
def get_line
|
35
36
|
line = gets
|
36
37
|
line.chomp! unless line.nil?
|
37
|
-
line
|
38
|
+
line
|
38
39
|
end
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
begin
|
42
43
|
serve(session)
|
43
44
|
rescue Exception => e
|
44
|
-
puts e.message
|
45
|
+
puts e.message
|
45
46
|
end
|
46
|
-
end
|
47
|
+
end
|
47
48
|
end
|
48
49
|
|
49
50
|
def serve(connection)
|
50
51
|
connection.puts("220 localhost mailcrate ready ESTMP")
|
51
52
|
helo = connection.get_line
|
52
|
-
|
53
|
+
|
53
54
|
if helo =~ /^EHLO\s+/
|
54
55
|
connection.puts "250-localhost mailcrate here"
|
55
56
|
connection.puts "250 HELP"
|
@@ -57,9 +58,9 @@ class Mailcrate
|
|
57
58
|
|
58
59
|
from = connection.get_line
|
59
60
|
connection.puts("250 ok")
|
60
|
-
|
61
|
+
|
61
62
|
to_list = []
|
62
|
-
|
63
|
+
|
63
64
|
loop do
|
64
65
|
to = connection.get_line
|
65
66
|
break if to.nil?
|
@@ -72,7 +73,7 @@ class Mailcrate
|
|
72
73
|
connection.puts( "250 ok" )
|
73
74
|
end
|
74
75
|
end
|
75
|
-
|
76
|
+
|
76
77
|
lines = []
|
77
78
|
loop do
|
78
79
|
line = connection.get_line
|
@@ -83,13 +84,14 @@ class Mailcrate
|
|
83
84
|
connection.puts "250 ok"
|
84
85
|
connection.gets
|
85
86
|
connection.puts "221 bye"
|
86
|
-
connection.close
|
87
87
|
|
88
88
|
@mails << {
|
89
89
|
:from => from.gsub(/MAIL FROM:\s*/, ''),
|
90
90
|
:to_list => to_list.map { |to| to.gsub( /RCPT TO:\s*/, "" ) },
|
91
|
-
:body => lines.join( "\n" )
|
91
|
+
:body => lines.join( "\n" )
|
92
92
|
}
|
93
|
+
|
94
|
+
connection.close
|
93
95
|
end
|
94
96
|
|
95
97
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailcrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adam Scott
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-03-13 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A mock SMTP server that can be run and inspected from tests. The server
|
15
14
|
runs in memory and received messages can be retrieved.
|
@@ -22,26 +21,25 @@ files:
|
|
22
21
|
homepage: https://github.com/adscott/mailcrate
|
23
22
|
licenses:
|
24
23
|
- MIT
|
24
|
+
metadata: {}
|
25
25
|
post_install_message:
|
26
26
|
rdoc_options: []
|
27
27
|
require_paths:
|
28
28
|
- lib
|
29
29
|
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
30
|
requirements:
|
32
|
-
- -
|
31
|
+
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
33
|
+
version: 2.0.0
|
35
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
35
|
requirements:
|
38
|
-
- -
|
36
|
+
- - ">="
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: '0'
|
41
39
|
requirements: []
|
42
40
|
rubyforge_project:
|
43
|
-
rubygems_version:
|
41
|
+
rubygems_version: 2.5.1
|
44
42
|
signing_key:
|
45
|
-
specification_version:
|
43
|
+
specification_version: 4
|
46
44
|
summary: A mock SMTP server that can be run and inspected from tests.
|
47
45
|
test_files: []
|