bones 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ == 2.4.2 / 2009-03-02
2
+
3
+ * 2 bug fixes
4
+ - SMTP/TLS will not be used if openssl is not present
5
+ - fixed rdoc title generation
6
+
1
7
  == 2.4.1 / 2009-03-02
2
8
 
3
9
  * 1 minor enhancement
@@ -4,7 +4,7 @@ require 'rbconfig'
4
4
  module Bones
5
5
 
6
6
  # :stopdoc:
7
- VERSION = '2.4.1'
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:'
@@ -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
- require "openssl"
10
- require "net/smtp"
9
+ begin
10
+ require "openssl"
11
+ require "net/smtp"
11
12
 
12
- Net::SMTP.class_eval do
13
- private
14
- def do_start(helodomain, user, secret, authtype)
15
- raise IOError, 'SMTP session already started' if @started
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
- if user or secret
18
- if 3 == self.method(:check_auth_args).arity
19
- check_auth_args(user, secret, authtype)
20
- else
21
- check_auth_args(user, secret)
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
- sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
26
- @socket = Net::InternetMessageIO.new(sock)
27
- @socket.read_timeout = 60 #@read_timeout
28
- @socket.debug_output = STDERR #@debug_output
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
- check_response(critical { recv_response() })
31
- do_helo(helodomain)
31
+ check_response(critical { recv_response() })
32
+ do_helo(helodomain)
32
33
 
33
- raise 'openssl library not installed' unless defined?(OpenSSL)
34
- starttls
35
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
36
- ssl.sync_close = true
37
- ssl.connect
38
- @socket = Net::InternetMessageIO.new(ssl)
39
- @socket.read_timeout = 60 #@read_timeout
40
- @socket.debug_output = STDERR #@debug_output
41
- do_helo(helodomain)
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
- authenticate user, secret, authtype if user
44
- @started = true
45
- ensure
46
- unless @started
47
- # authentication failed, cancel connection.
48
- @socket.close if not @started and @socket and not @socket.closed?
49
- @socket = nil
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
- def do_helo(helodomain)
54
- begin
55
- if @esmtp
56
- ehlo helodomain
57
- else
58
- helo helodomain
59
- end
60
- rescue Net::ProtocolError
61
- if @esmtp
62
- @esmtp = false
63
- @error_occured = false
64
- retry
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
- def starttls
71
- getok('STARTTLS')
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
@@ -19,10 +19,11 @@ namespace :doc do
19
19
  end
20
20
  rd.rdoc_files.push(*files)
21
21
 
22
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
23
-
22
+ name = PROJ.name
24
23
  rf_name = PROJ.rubyforge.name
25
- title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
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)
@@ -19,10 +19,11 @@ namespace :doc do
19
19
  end
20
20
  rd.rdoc_files.push(*files)
21
21
 
22
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
23
-
22
+ name = PROJ.name
24
23
  rf_name = PROJ.rubyforge.name
25
- title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bones
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease