mack-notifier 0.7.1.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -25,7 +25,7 @@ Currently implemented delivery handlers are: SMTP (default), sendmail, and test.
25
25
 
26
26
  == Testing
27
27
 
28
- When testing you can get access to delivered emails with the delivered_emails
28
+ When testing you can get access to delivered emails with the delivered_notifiers
29
29
  method. After each tests these emails will be flushed our of the test handler.
30
30
 
31
31
  == Rake tasks
@@ -5,11 +5,10 @@ module Mack
5
5
  module Sendmail
6
6
 
7
7
  def self.deliver(mail)
8
- sendmail_settings = app_config.notifier.sendmail_settings
9
- sendmail_settings.symbolize_keys!
10
- sendmail_args = sendmail_settings[:arguments]
8
+ sendmail_settings = configatron.mack.notifier.sendmail_settings
9
+ sendmail_args = sendmail_settings.arguments
11
10
  sendmail_args += " -f \"#{mail.reply_to}\"" if mail.reply_to
12
- IO.popen("#{sendmail_settings[:location]} #{sendmail_args}","w+") do |sm|
11
+ IO.popen("#{sendmail_settings.location} #{sendmail_args}","w+") do |sm|
13
12
  sm.print(mail.deliverable.gsub(/\r/, ''))
14
13
  sm.flush
15
14
  end
@@ -6,11 +6,10 @@ module Mack
6
6
  module Smtp
7
7
 
8
8
  def self.deliver(mail)
9
- smtp_settings = app_config.notifier.smtp_settings
10
- smtp_settings.symbolize_keys!
11
- Net::SMTP.start(smtp_settings[:address], smtp_settings[:port],
12
- smtp_settings[:domain], smtp_settings[:user_name],
13
- smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
9
+ smtp_settings = configatron.mack.notifier.smtp_settings
10
+ Net::SMTP.start(smtp_settings.address, smtp_settings.port,
11
+ smtp_settings.domain, smtp_settings.retrieve(:user_name, nil),
12
+ smtp_settings.retrieve(:password, nil), smtp_settings.retrieve(:authentication, nil)) do |smtp|
14
13
  smtp.sendmail(mail.deliverable, mail.reply_to, mail.recipients)
15
14
  end
16
15
  end
@@ -127,23 +127,23 @@ module Mack # :nodoc:
127
127
  end
128
128
 
129
129
  # This method returns the adapter that will transform the Mack::Notifier object
130
- # and prepare it for delivery. This method returns the app_config.notifier.adapter
130
+ # and prepare it for delivery. This method returns the configatron.notifier.adapter
131
131
  # parameter. Override this in your Mack::Notifier class to specify a different adapter
132
- # or change the app_config parameter to globally affect all your Notifiers.
132
+ # or change the configatron parameter to globally affect all your Notifiers.
133
133
  #
134
134
  # Default: :tmail
135
135
  def adapter
136
- app_config.notifier.adapter
136
+ configatron.mack.notifier.adapter
137
137
  end
138
138
 
139
139
  # This method returns the delivery handler that will delivers the Mack::Notifier object.
140
- # This method returns the app_config.notifier.deliver_with parameter. Override this in
141
- # your Mack::Notifier class to specify a different handler or change the app_config
140
+ # This method returns the configatron.mack.notifier.deliver_with parameter. Override this in
141
+ # your Mack::Notifier class to specify a different handler or change the configatron
142
142
  # parameter to globally affect all your Notifiers.
143
143
  #
144
144
  # Default: :sendmail
145
145
  def deliver_with
146
- app_config.notifier.deliver_with
146
+ configatron.mack.notifier.deliver_with
147
147
  end
148
148
 
149
149
  private
@@ -10,12 +10,12 @@ html_template:
10
10
  type: file
11
11
  template_path: <%= File.join(templates_directory_path, "app", "notifiers", "html.erb.template") %>
12
12
  output_path: <%= File.join("app", "notifiers", "templates", file_name, "html.erb") %>
13
- <% if app_config.mack.testing_framework == "test_case" -%>
13
+ <% if configatron.mack.testing_framework.to_s == "test_case" -%>
14
14
  test_template:
15
15
  type: file
16
16
  template_path: <%= File.join(templates_directory_path, "test", "notifiers", "test_case.rb.template") %>
17
17
  output_path: <%= File.join("test", "notifiers", "#{file_name}_test.rb") %>
18
- <% elsif app_config.mack.testing_framework == "rspec" -%>
18
+ <% elsif configatron.mack.testing_framework.to_s == "rspec" -%>
19
19
  test_template:
20
20
  type: file
21
21
  template_path: <%= File.join(templates_directory_path, "test", "notifiers", "rspec.rb.template") %>
@@ -1,15 +1,7 @@
1
- if app_config.notifier.nil? || app_config.notifier.smtp_settings.nil?
2
- app_config.load_file(File.join(File.dirname(__FILE__), "configs", "smtp_settings.yml"))
3
- end
4
-
5
- if app_config.notifier.nil? || app_config.notifier.sendmail_settings.nil?
6
- app_config.load_file(File.join(File.dirname(__FILE__), "configs", "sendmail_settings.yml"))
7
- end
8
-
9
- if app_config.notifier.nil? || app_config.notifier.deliver_with.nil?
10
- app_config.load_hash({"notifier::deliver_with" => (Mack.env == "test" ? "test" : "smtp")}, String.randomize)
11
- end
12
-
13
- if app_config.notifier.nil? || app_config.notifier.adapter.nil?
14
- app_config.load_hash({"notifier::adapter" => "tmail"}, String.randomize)
15
- end
1
+ configatron.mack.notifier.sendmail_settings.set_default(:location, '/usr/sbin/sendmail')
2
+ configatron.mack.notifier.sendmail_settings.set_default(:arguments, '-i -t')
3
+ configatron.mack.notifier.smtp_settings.set_default(:address, 'localhost')
4
+ configatron.mack.notifier.smtp_settings.set_default(:port, 25)
5
+ configatron.mack.notifier.smtp_settings.set_default(:domain, 'localhost.localdomain')
6
+ configatron.mack.notifier.set_default(:deliver_with, (Mack.env == "test" ? "test" : "smtp"))
7
+ configatron.mack.notifier.set_default(:adapter, 'tmail')
@@ -1,7 +1,5 @@
1
1
  if Mack.env == "test"
2
2
 
3
- alias_deprecated_method :delivered_emails, :delivered_notifiers, '0.7.1', '0.8.0'
4
-
5
3
  # Used for testing this method will return any emails that have been 'sent' using Mack::Notifier::DeliveryHandlers::Test.
6
4
  # These emails will get 'flushed' after each test.
7
5
  def delivered_notifiers
@@ -13,8 +11,8 @@ if Mack.env == "test"
13
11
  module ExampleMethods # :nodoc:
14
12
  include Mack::Routes::Urls
15
13
  include Mack::Testing::Helpers
16
-
17
- alias_method :email_spec_execute, :execute
14
+
15
+ alias_instance_method :execute, :email_spec_execute
18
16
 
19
17
  def execute(options, instance_variables)
20
18
  @__res = email_spec_execute(options, instance_variables)
@@ -32,7 +30,7 @@ if Mack.env == "test"
32
30
 
33
31
  # Let's alias the run method in the class above us so we can create a new one here
34
32
  # but still reference it.
35
- alias_method :super_run, :run # :nodoc:
33
+ alias_instance_method :run, :super_run
36
34
 
37
35
  # We need to wrap the run method so we can do things like
38
36
  # run a cleanup method if it exists
@@ -11,18 +11,18 @@ module Mack
11
11
  end
12
12
 
13
13
  base.class_eval do
14
+
15
+ # Alias the Validatable methods to look like DataMapper methods,
16
+ # if that's the kind of thing you're used to. :)
17
+ alias_class_method :validates_acceptance_of, :validates_is_accepted
18
+ alias_class_method :validates_confirmation_of, :validates_is_confirmed
19
+ alias_class_method :validates_format_of, :validates_format
20
+ alias_class_method :validates_length_of, :validates_length
21
+ alias_class_method :validates_numericality_of, :validates_is_number
22
+ alias_class_method :validates_presence_of, :validates_present
14
23
 
15
24
  class << self
16
25
 
17
- # Alias the Validatable methods to look like DataMapper methods,
18
- # if that's the kind of thing you're used to. :)
19
- alias_method :validates_is_accepted, :validates_acceptance_of
20
- alias_method :validates_is_confirmed, :validates_confirmation_of
21
- alias_method :validates_format, :validates_format_of
22
- alias_method :validates_length, :validates_length_of
23
- alias_method :validates_is_number, :validates_numericality_of
24
- alias_method :validates_present, :validates_presence_of
25
-
26
26
  # Adds common validations to your Mack::Notifier class.
27
27
  # These include:
28
28
  # validates_presence_of :to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Bates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 -04:00
12
+ date: 2008-10-06 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,8 +44,6 @@ files:
44
44
  - lib/mack-notifier/adapters/base.rb
45
45
  - lib/mack-notifier/adapters/tmail.rb
46
46
  - lib/mack-notifier/attachment.rb
47
- - lib/mack-notifier/configs/sendmail_settings.yml
48
- - lib/mack-notifier/configs/smtp_settings.yml
49
47
  - lib/mack-notifier/delivery_handlers/sendmail.rb
50
48
  - lib/mack-notifier/delivery_handlers/smtp.rb
51
49
  - lib/mack-notifier/delivery_handlers/test.rb
@@ -89,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
87
  requirements: []
90
88
 
91
89
  rubyforge_project: magrathea
92
- rubygems_version: 1.2.0
90
+ rubygems_version: 1.3.0
93
91
  signing_key:
94
92
  specification_version: 2
95
93
  summary: Notifier functionality for Mack applications.
@@ -1,3 +0,0 @@
1
- notifier::sendmail_settings:
2
- location: "/usr/sbin/sendmail"
3
- arguments: "-i -t"
@@ -1,7 +0,0 @@
1
- notifier::smtp_settings:
2
- address: localhost
3
- port: 25
4
- domain: "localhost.localdomain"
5
- # user_name:
6
- # password:
7
- # authentication: