actionmailer-with-request 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/actionmailer-with-request.gemspec +4 -2
- data/lib/action_mailer_with_request/controller_mixin.rb +15 -0
- data/lib/action_mailer_with_request/mailer_default_url_options.rb +19 -0
- data/lib/action_mailer_with_request/railtie.rb +11 -0
- data/lib/actionmailer_with_request.rb +3 -32
- metadata +5 -3
- data/init.rb +0 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{actionmailer-with-request}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Simone Carletti"]
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION",
|
22
22
|
"actionmailer-with-request.gemspec",
|
23
|
-
"
|
23
|
+
"lib/action_mailer_with_request/controller_mixin.rb",
|
24
|
+
"lib/action_mailer_with_request/mailer_default_url_options.rb",
|
25
|
+
"lib/action_mailer_with_request/railtie.rb",
|
24
26
|
"lib/actionmailer_with_request.rb"
|
25
27
|
]
|
26
28
|
s.homepage = %q{http://github.com/weppos/actionmailer_with_request}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActionMailerWithRequest
|
2
|
+
module MailerDefaultUrlOptions
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
def default_url_options_with_current_request
|
7
|
+
host = Thread.current[:request].try(:host)
|
8
|
+
port = Thread.current[:request].try(:port)
|
9
|
+
default = {}
|
10
|
+
default[:host] = host if host
|
11
|
+
default[:port] = port if port and port != 80
|
12
|
+
default_url_options_without_current_request.merge(default)
|
13
|
+
end
|
14
|
+
alias_method_chain :default_url_options, :current_request
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActionMailerWithRequest
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
|
4
|
+
initializer "action_mailer_with_request.default_url_options" do |app|
|
5
|
+
ActionController::Base.send :include, ActionMailerWithRequest::ControllerMixin
|
6
|
+
ActionMailer::Base.send :include, ActionMailerWithRequest::MailerDefaultUrlOptions
|
7
|
+
|
8
|
+
Rails.logger.info("** ActionMailerWithRequest: initialized properly") if defined?(Rails)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,33 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'action_mailer_with_request/controller_mixin'
|
2
|
+
require 'action_mailer_with_request/mailer_default_url_options'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.class_eval do
|
7
|
-
before_filter :store_request
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def store_request
|
12
|
-
Thread.current[:request] = request
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
module MailerDefaultUrlOptions
|
18
|
-
|
19
|
-
def self.included(base)
|
20
|
-
base.class_eval do
|
21
|
-
def default_url_options_with_current_request
|
22
|
-
host = Thread.current[:request].try(:host)
|
23
|
-
port = Thread.current[:request].try(:port)
|
24
|
-
default = {}
|
25
|
-
default[:host] = host if host
|
26
|
-
default[:port] = port if port and port != 80
|
27
|
-
default_url_options_without_current_request.merge(default)
|
28
|
-
end
|
29
|
-
alias_method_chain :default_url_options, :current_request
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
4
|
+
require 'action_mailer_with_request/railtie'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Simone Carletti
|
@@ -32,7 +32,9 @@ files:
|
|
32
32
|
- Rakefile
|
33
33
|
- VERSION
|
34
34
|
- actionmailer-with-request.gemspec
|
35
|
-
-
|
35
|
+
- lib/action_mailer_with_request/controller_mixin.rb
|
36
|
+
- lib/action_mailer_with_request/mailer_default_url_options.rb
|
37
|
+
- lib/action_mailer_with_request/railtie.rb
|
36
38
|
- lib/actionmailer_with_request.rb
|
37
39
|
has_rdoc: true
|
38
40
|
homepage: http://github.com/weppos/actionmailer_with_request
|
data/init.rb
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
require 'actionmailer_with_request'
|
2
|
-
|
3
|
-
ActionController::Base.send :include, ActionMailerWithRequest::ControllerMixin
|
4
|
-
ActionMailer::Base.send :include, ActionMailerWithRequest::MailerDefaultUrlOptions
|
5
|
-
|
6
|
-
Rails.logger.info("** ActionMailerWithRequest: initialized properly") if defined?(Rails)
|