bones 2.4.1 → 2.4.2
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.
- data/History.txt +6 -0
- data/lib/bones.rb +1 -1
- data/lib/bones/smtp_tls.rb +56 -51
- data/lib/bones/tasks/rdoc.rake +4 -3
- data/tasks/rdoc.rake +4 -3
- metadata +1 -1
data/History.txt
CHANGED
data/lib/bones.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rbconfig'
|
|
4
4
|
module Bones
|
5
5
|
|
6
6
|
# :stopdoc:
|
7
|
-
VERSION = '2.4.
|
7
|
+
VERSION = '2.4.2'
|
8
8
|
PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
9
9
|
HOME = File.expand_path(ENV['HOME'] || ENV['USERPROFILE'])
|
10
10
|
DEV_NULL = File.exist?('/dev/null') ? '/dev/null' : 'NUL:'
|
data/lib/bones/smtp_tls.rb
CHANGED
@@ -6,70 +6,75 @@
|
|
6
6
|
# http://d.hatena.ne.jp/zorio/20060416
|
7
7
|
# http://www.jamesbritt.com/2007/12/18/sending-mail-through-gmail-with-ruby-s-net-smtp
|
8
8
|
|
9
|
-
|
10
|
-
require "
|
9
|
+
begin
|
10
|
+
require "openssl"
|
11
|
+
require "net/smtp"
|
11
12
|
|
12
|
-
Net::SMTP.class_eval do
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Net::SMTP.class_eval do
|
14
|
+
private
|
15
|
+
def do_start(helodomain, user, secret, authtype)
|
16
|
+
raise IOError, 'SMTP session already started' if @started
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if user or secret
|
19
|
+
if 3 == self.method(:check_auth_args).arity
|
20
|
+
check_auth_args(user, secret, authtype)
|
21
|
+
else
|
22
|
+
check_auth_args(user, secret)
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
|
27
|
+
@socket = Net::InternetMessageIO.new(sock)
|
28
|
+
@socket.read_timeout = 60 #@read_timeout
|
29
|
+
@socket.debug_output = STDERR #@debug_output
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
check_response(critical { recv_response() })
|
32
|
+
do_helo(helodomain)
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
34
|
+
raise 'openssl library not installed' unless defined?(OpenSSL)
|
35
|
+
starttls
|
36
|
+
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
37
|
+
ssl.sync_close = true
|
38
|
+
ssl.connect
|
39
|
+
@socket = Net::InternetMessageIO.new(ssl)
|
40
|
+
@socket.read_timeout = 60 #@read_timeout
|
41
|
+
@socket.debug_output = STDERR #@debug_output
|
42
|
+
do_helo(helodomain)
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
authenticate user, secret, authtype if user
|
45
|
+
@started = true
|
46
|
+
ensure
|
47
|
+
unless @started
|
48
|
+
# authentication failed, cancel connection.
|
49
|
+
@socket.close if not @started and @socket and not @socket.closed?
|
50
|
+
@socket = nil
|
51
|
+
end
|
50
52
|
end
|
51
|
-
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
54
|
+
def do_helo(helodomain)
|
55
|
+
begin
|
56
|
+
if @esmtp
|
57
|
+
ehlo helodomain
|
58
|
+
else
|
59
|
+
helo helodomain
|
60
|
+
end
|
61
|
+
rescue Net::ProtocolError
|
62
|
+
if @esmtp
|
63
|
+
@esmtp = false
|
64
|
+
@error_occured = false
|
65
|
+
retry
|
66
|
+
end
|
67
|
+
raise
|
65
68
|
end
|
66
|
-
raise
|
67
69
|
end
|
68
|
-
end
|
69
70
|
|
70
|
-
|
71
|
-
|
71
|
+
def starttls
|
72
|
+
getok('STARTTLS')
|
73
|
+
end
|
72
74
|
end
|
75
|
+
|
76
|
+
# We cannot do TLS if we do not have 'openssl'
|
77
|
+
rescue LoadError
|
73
78
|
end
|
74
79
|
|
75
80
|
# EOF
|
data/lib/bones/tasks/rdoc.rake
CHANGED
@@ -19,10 +19,11 @@ namespace :doc do
|
|
19
19
|
end
|
20
20
|
rd.rdoc_files.push(*files)
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
name = PROJ.name
|
24
23
|
rf_name = PROJ.rubyforge.name
|
25
|
-
|
24
|
+
|
25
|
+
title = "#{name}-#{PROJ.version} Documentation"
|
26
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != name
|
26
27
|
|
27
28
|
rd.options << "-t #{title}"
|
28
29
|
rd.options.concat(rdoc.opts)
|
data/tasks/rdoc.rake
CHANGED
@@ -19,10 +19,11 @@ namespace :doc do
|
|
19
19
|
end
|
20
20
|
rd.rdoc_files.push(*files)
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
name = PROJ.name
|
24
23
|
rf_name = PROJ.rubyforge.name
|
25
|
-
|
24
|
+
|
25
|
+
title = "#{name}-#{PROJ.version} Documentation"
|
26
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != name
|
26
27
|
|
27
28
|
rd.options << "-t #{title}"
|
28
29
|
rd.options.concat(rdoc.opts)
|