Permalink
Browse files

Minor fixes

  • Loading branch information...
inescoelho committed Aug 10, 2015
1 parent 60fefcb commit 8e0c8370f9fbfef79fa40dafe1d825d782f78455
Showing with 2 additions and 150 deletions.
  1. +0 −15 lib/lotus/mailer.rb
  2. +2 −70 lib/lotus/mailer/configuration.rb
  3. +0 −7 lib/lotus/mailer/dsl.rb
  4. +0 −54 lib/lotus/mailer/inheritable.rb
  5. +0 −4 test/fixtures.rb
@@ -3,7 +3,6 @@
require 'lotus/mailer/version'
require 'lotus/mailer/configuration'
require 'lotus/mailer/dsl'
require 'lotus/mailer/inheritable'
module Lotus
module Mailer
@@ -104,12 +103,6 @@ def self.dupe
# Mailer = Lotus::Mailer.duplicate(self)
# end
#
# # It will: (TODO: REVIEW THIS)
# #
# # 1. Generate MyApp::Mailer
# # 2. Generate MyApp::Mailers
# # 3. Configure MyApp::Mailers as the default namespace for mailers
#
# module MyApp::Mailers::Dashboard
# class Index
# include MyApp::Mailer
@@ -185,10 +178,6 @@ def self.dupe
def self.duplicate(mod, mailers = 'Mailers', &blk)
dupe.tap do |duplicated|
mod.module_eval %{ module #{ mailers }; end } if mailers
# mod.module_eval %{
# Layout = Lotus::Layout.dup
# Presenter = Lotus::Presenter.dup
# }
duplicated.configure do
namespace [mod, mailers].compact.join '::'
@@ -220,17 +209,13 @@ def self.included(base)
conf.add_mailer(base)
base.class_eval do
extend Inheritable.dup
extend Dsl.dup
# extend Rendering.dup
# extend Escape.dup
include Utils::ClassAttribute
class_attribute :configuration
self.configuration = conf.duplicate
self.templates(Hash.new)
end
conf.copy!(base)
@@ -118,12 +118,12 @@ def namespace(value = nil)
@namespace
end
end
# Set the root path where to search for templates
#
# If not set, this value defaults to the current directory.
#
# When this method is called with an argument, it will set the corresponding instance variable.
# When this method is called with an argument, it will set the corresponding instance variable.
# When called without, it will return the already set value, or the default.
#
# @overload root(value)
@@ -178,67 +178,6 @@ def root(value = nil)
#
# @see Lotus::Mailer.configure
# @see Lotus::Mailer.duplicate
#
# @example Including shared utilities
# require 'lotus/mailer'
#
# module UrlHelpers
# def comments_path
# '/'
# end
# end
#
# Lotus::Mailer.configure do
# prepare do
# include UrlHelpers
# end
# end
#
# Lotus::Mailer.load!
#
# module Comments
# class New
# # The following include will cause UrlHelpers to be included too.
# # This makes `comments_path` available in the mailer context
# include Lotus::Mailer
#
# def form
# %(<form action="#{ comments_path }" method="POST"></form>)
# end
# end
# end
#
# @example Preparing multiple times
# require 'lotus/mailer'
#
# Lotus::Mailer.configure do
# prepare do
# include UrlHelpers
# end
#
# prepare do
# format :json
# end
# end
#
# Lotus::Mailer.configure do
# prepare do
# include FormattingHelpers
# end
# end
#
# Lotus::Mailer.load!
#
# module Articles
# class Index
# # The following include will cause the inclusion of:
# # * UrlHelpers
# # * FormattingHelpers
# #
# # It also sets the mailer to render only JSON
# include Lotus::Mailer
# end
# end
def prepare(&blk)
if block_given?
@modules.push(blk)
@@ -265,8 +204,6 @@ def duplicate
Configuration.new.tap do |c|
c.namespace = namespace
c.root = root
# c.layout = @layout # lazy loading of the class
# c.load_paths = load_paths.dup
c.modules = modules.dup
end
end
@@ -282,9 +219,6 @@ def reset!
root(DEFAULT_ROOT)
@mailers = Set.new
# @layouts = Set.new
# @load_paths = Utils::LoadPaths.new(root)
# @layout = nil
@modules = []
end
@@ -307,8 +241,6 @@ def copy!(base)
protected
attr_writer :root
attr_writer :namespace
# attr_writer :load_paths
# attr_writer :layout
attr_writer :modules
end
end
@@ -115,13 +115,6 @@ def template(format = nil, value = nil)
# @return [Hash] the Hash with the templates
#
# @since 0.1.0
#
# @example fetch templates
# require 'lotus/mailer'
# class InvoiceMailer
# include Lotus::Mailer
# self.templates
# end
def templates(value = nil)
if value.nil?
# If no templates are given, use the default templates instead

This file was deleted.

Oops, something went wrong.
@@ -17,7 +17,6 @@ class StringMailer
from "noreply@example.com"
to "noreply1@example.com"
subject "This is the subject"
end
class ProcMailer
@@ -43,8 +42,5 @@ def customized_subject
class ArrayMailer
include Lotus::Mailer
from "noreply@example.com"
to ["noreply1@example.com", "noreply2@example.com"]
subject "This is the subject"
end

0 comments on commit 8e0c837

Please sign in to comment.