public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Don't send email w/ announce task
macournoyer (author)
Fri Jan 11 19:42:54 -0800 2008
commit  31d7fe1c1dc59604ea690166528bf820fea13770
tree    b7452af26eb4f85afec4eb3eea96264a31dfd892
parent  85cebaef4bfe0589592913815ae351e9ec551312
0
...
14
15
16
17
 
...
14
15
16
 
17
0
@@ -14,5 +14,5 @@
0
  * Port response writing to a C extension
0
  * Benchmark CGI and FastCGI too [Carlos Junior]
0
  * Investigate http://rev.rubyforge.org/
0
- * Check for memory leaks using dike and Instruments
0
+ * Check for memory leaks using dike and/or Mac OS Instruments
...
1
2
3
4
5
6
 
7
8
9
10
11
 
 
 
12
13
14
15
16
17
18
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
93
...
 
1
2
3
 
 
4
5
 
 
 
 
6
7
8
9
 
 
 
 
 
 
10
11
12
 
 
13
14
15
 
 
 
 
 
 
 
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
18
0
@@ -1,94 +1,19 @@
0
-require 'time'
0
 require 'erb'
0
 
0
 MSG_TEMPLATE = File.dirname(__FILE__) + '/email.erb'
0
-FROM = 'macournoyer@gmail.com'
0
-SEND_ANN_TO = %w(thin-ruby@googlegroups.com eventmachine-talk@rubyforge.org Rubymtl@lists.artengine.ca ruby-talk@ruby-lang.org)
0
+SEND_TO = %w(thin-ruby@googlegroups.com eventmachine-talk@rubyforge.org Rubymtl@lists.artengine.ca ruby-talk@ruby-lang.org)
0
 
0
-namespace :ann do
0
- desc 'Send the new version annoucement by email'
0
- task :email do
0
- abort 'Specify PW for GMail account' unless ENV['PW']
0
+desc 'Generate a template for the new version annoucement'
0
+task :ann do
0
+ msg = ERB.new(File.read(MSG_TEMPLATE)).result(binding)
0
     
0
- (ENV['TEST'] ? %w(macournoyer@yahoo.ca) : SEND_ANN_TO).each do |to|
0
- msg = ERB.new(File.read(MSG_TEMPLATE)).result(binding)
0
-
0
- body = <<END_OF_MESSAGE
0
-From: Marc-Andre Cournoyer <#{FROM}>
0
-To: #{to}
0
+ body = <<END_OF_MESSAGE
0
+To: #{SEND_TO}
0
 Subject: [ANN] Thin #{Thin::VERSION::STRING} #{Thin::VERSION::CODENAME} released
0
-Date: #{Time.now.httpdate}
0
-Message-Id: <unique.message.id.string@example.com>
0
 
0
 #{msg}
0
 END_OF_MESSAGE
0
-
0
- Net::SMTP.start('smtp.gmail.com', 587, 'localhost.localdomain',
0
- 'macournoyer', ENV['PW'], :plain) do |smtp|
0
- smtp.send_message body, FROM, to
0
- end
0
- end
0
- end
0
-end
0
 
0
-# Require some magic stuff for sending mails using Gmail
0
-# Source: http://d.hatena.ne.jp/zorio/20060416
0
-require 'openssl'
0
-require 'net/smtp'
0
-
0
-Net::SMTP.class_eval do
0
- private
0
- def do_start(helodomain, user, secret, authtype)
0
- raise IOError, 'SMTP session already started' if @started
0
- check_auth_args user, secret, authtype if user or secret
0
-
0
- sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
0
- @socket = Net::InternetMessageIO.new(sock)
0
- @socket.read_timeout = 60 #@read_timeout
0
- @socket.debug_output = STDERR #@debug_output
0
-
0
- check_response(critical { recv_response() })
0
- do_helo(helodomain)
0
-
0
- raise 'openssl library not installed' unless defined?(OpenSSL)
0
- starttls
0
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
0
- ssl.sync_close = true
0
- ssl.connect
0
- @socket = Net::InternetMessageIO.new(ssl)
0
- @socket.read_timeout = 60 #@read_timeout
0
- @socket.debug_output = STDERR #@debug_output
0
- do_helo(helodomain)
0
-
0
- authenticate user, secret, authtype if user
0
- @started = true
0
- ensure
0
- unless @started
0
- # authentication failed, cancel connection.
0
- @socket.close if not @started and @socket and not @socket.closed?
0
- @socket = nil
0
- end
0
- end
0
-
0
- def do_helo(helodomain)
0
- begin
0
- if @esmtp
0
- ehlo helodomain
0
- else
0
- helo helodomain
0
- end
0
- rescue Net::ProtocolError
0
- if @esmtp
0
- @esmtp = false
0
- @error_occured = false
0
- retry
0
- end
0
- raise
0
- end
0
- end
0
-
0
- def starttls
0
- getok('STARTTLS')
0
- end
0
+ puts body
0
 end
...
11
12
13
 
14
15
16
...
11
12
13
14
15
16
17
0
@@ -11,6 +11,7 @@
0
   "lib"
0
 ]
0
 
0
+desc "Compile the Ragel state machines"
0
 task :ragel do
0
   Dir.chdir EXT_DIR do
0
     target = "parser.c"
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@
0
   s.homepage = 'http://code.macournoyer.com/thin/'
0
   s.executables = %w(thin)
0
 
0
- s.required_ruby_version = '>= 1.8.6'
0
+ s.required_ruby_version = '>= 1.8.6' # Makes sure the CGI eof fix is there
0
   
0
   s.add_dependency 'eventmachine', '>= 0.8.1'
0
   s.add_dependency 'rack', '>= 0.2.0'

Comments

    No one has commented yet.