rhizmail 0.1.4 → 0.1.5
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/lib/rhizmail.rb +2 -2
 - data/lib/rhizmail.rb~ +10 -15
 - metadata +46 -44
 
    
        data/lib/rhizmail.rb
    CHANGED
    
    | 
         @@ -48,7 +48,7 @@ require 'net/smtp' 
     | 
|
| 
       48 
48 
     | 
    
         
             
            require 'text/format'
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
            module RhizMail
         
     | 
| 
       51 
     | 
    
         
            -
            	Version = '0.1. 
     | 
| 
      
 51 
     | 
    
         
            +
            	Version = '0.1.5'
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
            	# Sets RhizMail to run using mocks for use in testing. Calling
         
     | 
| 
       54 
54 
     | 
    
         
             
            	# <tt>RhizMail.mock = true</tt> sets the Mailer to use MockMailer instead.
         
     | 
| 
         @@ -62,7 +62,7 @@ module RhizMail 
     | 
|
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
            	# Returns a boolean value describing whether <tt>address</tt> is a plausible 
         
     | 
| 
       64 
64 
     | 
    
         
             
            	# email address format.
         
     | 
| 
       65 
     | 
    
         
            -
            	def self.valid_address?(address); (address =~ /\w@\ 
     | 
| 
      
 65 
     | 
    
         
            +
            	def self.valid_address?(address); (address =~ /\w@\S*\./) != nil; end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
            	# InvalidStateError is raised by SimpleTemplateMessage if you try to send it
         
     | 
| 
       68 
68 
     | 
    
         
             
            	# out without doing all the necessary template substitutions.
         
     | 
    
        data/lib/rhizmail.rb~
    CHANGED
    
    | 
         @@ -48,7 +48,7 @@ require 'net/smtp' 
     | 
|
| 
       48 
48 
     | 
    
         
             
            require 'text/format'
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
            module RhizMail
         
     | 
| 
       51 
     | 
    
         
            -
            	Version = '0.1. 
     | 
| 
      
 51 
     | 
    
         
            +
            	Version = '0.1.4'
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
            	# Sets RhizMail to run using mocks for use in testing. Calling
         
     | 
| 
       54 
54 
     | 
    
         
             
            	# <tt>RhizMail.mock = true</tt> sets the Mailer to use MockMailer instead.
         
     | 
| 
         @@ -120,24 +120,19 @@ module RhizMail 
     | 
|
| 
       120 
120 
     | 
    
         
             
            		end
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
122 
     | 
    
         
             
            		# Sends an email message. +email+ needs to respond to +verify_sendable+;
         
     | 
| 
       123 
     | 
    
         
            -
            		# Mailer## 
     | 
| 
       124 
     | 
    
         
            -
            		def  
     | 
| 
      
 123 
     | 
    
         
            +
            		# Mailer##send_message will call +verify_sendable+ before sending the email.
         
     | 
| 
      
 124 
     | 
    
         
            +
            		def send_message(email)
         
     | 
| 
       125 
125 
     | 
    
         
             
            			email.verify_sendable
         
     | 
| 
       126 
126 
     | 
    
         
             
            			msg = []
         
     | 
| 
       127 
127 
     | 
    
         
             
            			email.headers.each { |header| msg << "#{header}\n" }
         
     | 
| 
       128 
128 
     | 
    
         
             
            			msg << "\n"
         
     | 
| 
       129 
129 
     | 
    
         
             
            			msg << email.body
         
     | 
| 
       130 
     | 
    
         
            -
            			 
     | 
| 
       131 
     | 
    
         
            -
            				@@ 
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
            				 
     | 
| 
       134 
     | 
    
         
            -
            					smtp.sendmail(msg, email.from_address, [ email.to_address ])
         
     | 
| 
       135 
     | 
    
         
            -
            				}
         
     | 
| 
       136 
     | 
    
         
            -
            				@@messagesSent << email
         
     | 
| 
       137 
     | 
    
         
            -
            			rescue Net::ProtoFatalError, TimeoutError, Errno::ECONNREFUSED,
         
     | 
| 
       138 
     | 
    
         
            -
            					Errno::ECONNRESET
         
     | 
| 
       139 
     | 
    
         
            -
            				# whatever
         
     | 
| 
      
 130 
     | 
    
         
            +
            			@@smtpClass.start(
         
     | 
| 
      
 131 
     | 
    
         
            +
            				@@smtpServer, @@smtpLogin, @@smtpPassword, @@smtpAuthType
         
     | 
| 
      
 132 
     | 
    
         
            +
            			) do |smtp|
         
     | 
| 
      
 133 
     | 
    
         
            +
            				smtp.sendmail( msg, email.from_address, [ email.to_address ] )
         
     | 
| 
       140 
134 
     | 
    
         
             
            			end
         
     | 
| 
      
 135 
     | 
    
         
            +
            			@@messagesSent << email
         
     | 
| 
       141 
136 
     | 
    
         
             
            		end
         
     | 
| 
       142 
137 
     | 
    
         | 
| 
       143 
138 
     | 
    
         
             
            		# Returns an array of what messages have been sent.
         
     | 
| 
         @@ -183,7 +178,7 @@ module RhizMail 
     | 
|
| 
       183 
178 
     | 
    
         
             
            		end
         
     | 
| 
       184 
179 
     | 
    
         | 
| 
       185 
180 
     | 
    
         
             
            		# Sends the email.
         
     | 
| 
       186 
     | 
    
         
            -
            		def deliver; Mailer.get_mailer. 
     | 
| 
      
 181 
     | 
    
         
            +
            		def deliver; Mailer.get_mailer.send_message( self ); end
         
     | 
| 
       187 
182 
     | 
    
         | 
| 
       188 
183 
     | 
    
         
             
            		def from_header # :nodoc:
         
     | 
| 
       189 
184 
     | 
    
         
             
            			fromHeader = "From: "
         
     | 
| 
         @@ -260,7 +255,7 @@ module RhizMail 
     | 
|
| 
       260 
255 
     | 
    
         | 
| 
       261 
256 
     | 
    
         
             
            		# Pretends to send an email, recording it in +messages_sent+ to allow
         
     | 
| 
       262 
257 
     | 
    
         
             
            		# inspection later.
         
     | 
| 
       263 
     | 
    
         
            -
            		def  
     | 
| 
      
 258 
     | 
    
         
            +
            		def send_message(email)
         
     | 
| 
       264 
259 
     | 
    
         
             
            			email.verify_sendable
         
     | 
| 
       265 
260 
     | 
    
         
             
            			@messages_sent << email
         
     | 
| 
       266 
261 
     | 
    
         
             
            		end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,70 +1,72 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
     | 
    
         
            -
            rubygems_version: 0.8. 
     | 
| 
      
 2 
     | 
    
         
            +
            rubygems_version: 0.8.11
         
     | 
| 
       3 
3 
     | 
    
         
             
            specification_version: 1
         
     | 
| 
       4 
4 
     | 
    
         
             
            name: rhizmail
         
     | 
| 
       5 
5 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       6 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
       7 
     | 
    
         
            -
            date:  
     | 
| 
      
 6 
     | 
    
         
            +
              version: 0.1.5
         
     | 
| 
      
 7 
     | 
    
         
            +
            date: 2006-02-12 00:00:00 -05:00
         
     | 
| 
       8 
8 
     | 
    
         
             
            summary: RhizMail is a test-friendly library for sending out customized emails.
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_paths: 
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            - lib
         
     | 
| 
       11 
11 
     | 
    
         
             
            email: sera@fhwang.net
         
     | 
| 
       12 
12 
     | 
    
         
             
            homepage: http://rhizmail.rubyforge.org/
         
     | 
| 
       13 
13 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       14 
     | 
    
         
            -
            description:  
     | 
| 
       15 
     | 
    
         
            -
              the library we use day-to-day at http://rhizome.org, where we send out more than
         
     | 
| 
       16 
     | 
    
         
            -
              100 customized emails a day"
         
     | 
| 
      
 14 
     | 
    
         
            +
            description: RhizMail is a test-friendly library for sending out customized emails. This is the library we use day-to-day at http://rhizome.org, where we send out more than 100 customized emails a day
         
     | 
| 
       17 
15 
     | 
    
         
             
            autorequire: rhizmail
         
     | 
| 
       18 
16 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
17 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       20 
18 
     | 
    
         
             
            has_rdoc: false
         
     | 
| 
       21 
19 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
       22 
20 
     | 
    
         
             
              requirements: 
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                   
     | 
| 
       26 
     | 
    
         
            -
                    version: 0.0.0
         
     | 
| 
      
 21 
     | 
    
         
            +
              - - ">"
         
     | 
| 
      
 22 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 23 
     | 
    
         
            +
                  version: 0.0.0
         
     | 
| 
       27 
24 
     | 
    
         
             
              version: 
         
     | 
| 
       28 
25 
     | 
    
         
             
            platform: ruby
         
     | 
| 
      
 26 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 27 
     | 
    
         
            +
            cert_chain: 
         
     | 
| 
       29 
28 
     | 
    
         
             
            authors: 
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
            - Francis Hwang
         
     | 
| 
       31 
30 
     | 
    
         
             
            files: 
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
            - lib/rhizmail.rb
         
     | 
| 
      
 32 
     | 
    
         
            +
            - lib/rhizmail.rb~
         
     | 
| 
       34 
33 
     | 
    
         
             
            test_files: []
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       35 
35 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       36 
37 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       37 
39 
     | 
    
         
             
            executables: []
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       38 
41 
     | 
    
         
             
            extensions: []
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       39 
43 
     | 
    
         
             
            requirements: []
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       40 
45 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       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 
     | 
    
         
            -
                      - !ruby/object:Gem::Version 
         
     | 
| 
       69 
     | 
    
         
            -
                        version: 0.0.0
         
     | 
| 
       70 
     | 
    
         
            -
                  version: 
         
     | 
| 
      
 46 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 47 
     | 
    
         
            +
              name: contxtlservice
         
     | 
| 
      
 48 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 49 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
      
 50 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 51 
     | 
    
         
            +
                - - ">"
         
     | 
| 
      
 52 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 53 
     | 
    
         
            +
                    version: 0.0.0
         
     | 
| 
      
 54 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: mockfs
         
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 58 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
      
 59 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 60 
     | 
    
         
            +
                - - ">"
         
     | 
| 
      
 61 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 62 
     | 
    
         
            +
                    version: 0.0.0
         
     | 
| 
      
 63 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 64 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 65 
     | 
    
         
            +
              name: text-format
         
     | 
| 
      
 66 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 67 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
      
 68 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 69 
     | 
    
         
            +
                - - ">"
         
     | 
| 
      
 70 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 71 
     | 
    
         
            +
                    version: 0.0.0
         
     | 
| 
      
 72 
     | 
    
         
            +
                version: 
         
     |