sinatra_mailer 0.0.1 → 0.0.1.1

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.
@@ -1,53 +1,53 @@
1
1
  # coding: utf-8
2
2
 
3
- require 'net/smtp'
4
- require 'rubygems'
5
- require 'mailfactory'
3
+ require "net/smtp"
4
+ require "rubygems"
5
+ require "mailfactory"
6
6
 
7
7
  class MailFactory
8
8
  attr_reader :html, :text
9
9
  end
10
10
 
11
11
  module Sinatra
12
- # You'll need a simple config like this in your configure block if you want
12
+ # You"ll need a simple config like this in your configure block if you want
13
13
  # to actually send mail:
14
14
  #
15
15
  # Sinatra::Mailer.config = {
16
- # :host => 'smtp.yourserver.com',
17
- # :port => '25',
18
- # :user => 'user',
19
- # :pass => 'pass',
16
+ # :host => "smtp.yourserver.com",
17
+ # :port => "25",
18
+ # :user => "user",
19
+ # :pass => "pass",
20
20
  # :auth => :plain # :plain, :login, :cram_md5, the default is no auth
21
21
  # :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
22
22
  # }
23
23
  #
24
24
  # or
25
25
  #
26
- # Sinatra::Mailer.config = {:sendmail_path => '/somewhere/odd'}
26
+ # Sinatra::Mailer.config = {:sendmail_path => "/somewhere/odd"}
27
27
  # Sinatra::Mailer.delivery_method = :sendmail
28
28
  #
29
- # From your event handlers then, you can just call the 'email' method to deliver an email:
29
+ # From your event handlers then, you can just call the "email" method to deliver an email:
30
30
  #
31
- # email :to => 'foo@bar.com',
32
- # :from => 'bar@foo.com',
33
- # :subject => 'Welcome to whatever!',
31
+ # email :to => "foo@bar.com",
32
+ # :from => "bar@foo.com",
33
+ # :subject => "Welcome to whatever!",
34
34
  # :body => haml(:sometemplate)
35
35
  #
36
36
  module Mailer
37
37
  class << self
38
38
  attr_accessor :config, :delivery_method
39
+
40
+ def email(mail_options={})
41
+ Email.new(mail_options).deliver!
42
+ end
39
43
  end
40
44
 
41
- def email(mail_options={})
42
- Email.new(mail_options).deliver!
43
- end
44
-
45
45
  class Email
46
46
  attr_accessor :mail, :config
47
47
 
48
48
  # Sends the mail using sendmail.
49
49
  def sendmail
50
- sendmail = IO.popen("#{config[:sendmail_path]} #{@mail.to}", 'w+')
50
+ sendmail = IO.popen("#{config[:sendmail_path]} #{@mail.to}", "w+")
51
51
  sendmail.puts @mail.to_s
52
52
  sendmail.close
53
53
  end
@@ -90,10 +90,13 @@ module Sinatra
90
90
  # ==== Parameters
91
91
  # o<Hash{~to_s => Object}>:: Configuration commands to send to MailFactory.
92
92
  def initialize(o={})
93
- self.config = Mailer.config || {:sendmail_path => '/usr/sbin/sendmail'}
93
+ self.config = Mailer.config || {:sendmail_path => "/usr/sbin/sendmail"}
94
94
  o[:rawhtml] = o.delete(:html)
95
95
  m = MailFactory.new()
96
96
  o.each { |k,v| m.send "#{k}=", v }
97
+ puts "++++"
98
+ puts "m: #{m.inspect}"
99
+ puts "++++"
97
100
  @mail = m
98
101
  end
99
102
 
@@ -1,3 +1,3 @@
1
1
  module SinatraMailer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.1.1"
3
3
  end
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_dependency "mailfactory", ">= 1.4.0"
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mailfactory
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.0
46
62
  description: Send email in Sinatra APP
47
63
  email:
48
64
  - railscode@gmail.com