actionmailer-with-request 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README +6 -0
- data/Rakefile +16 -0
- data/VERSION +1 -0
- data/actionmailer-with-request.gemspec +42 -0
- data/init.rb +6 -0
- data/lib/actionmailer_with_request.rb +33 -0
- metadata +68 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gem|
|
6
|
+
gem.name = "actionmailer-with-request"
|
7
|
+
gem.summary = "A simple plugin to make the Rails request context available for generating URLs in ActionMailer. Works with Rails 3 (not tested with 2.3.x)"
|
8
|
+
gem.email = "weppos@weppos.net"
|
9
|
+
gem.homepage = "http://github.com/weppos/actionmailer_with_request"
|
10
|
+
gem.authors = ["Simone Carletti"]
|
11
|
+
end
|
12
|
+
|
13
|
+
Jeweler::GemcutterTasks.new
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{actionmailer-with-request}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Simone Carletti"]
|
12
|
+
s.date = %q{2010-06-11}
|
13
|
+
s.email = %q{weppos@weppos.net}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"README"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".gitignore",
|
19
|
+
"README",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"actionmailer-with-request.gemspec",
|
23
|
+
"init.rb",
|
24
|
+
"lib/actionmailer_with_request.rb"
|
25
|
+
]
|
26
|
+
s.homepage = %q{http://github.com/weppos/actionmailer_with_request}
|
27
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.3.6}
|
30
|
+
s.summary = %q{A simple plugin to make the Rails request context available for generating URLs in ActionMailer. Works with Rails 3 (not tested with 2.3.x)}
|
31
|
+
|
32
|
+
if s.respond_to? :specification_version then
|
33
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
34
|
+
s.specification_version = 3
|
35
|
+
|
36
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
37
|
+
else
|
38
|
+
end
|
39
|
+
else
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
data/init.rb
ADDED
@@ -0,0 +1,6 @@
|
|
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)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module ActionMailerWithRequest
|
2
|
+
|
3
|
+
module ControllerMixin
|
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
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: actionmailer-with-request
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Simone Carletti
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-11 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: weppos@weppos.net
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
files:
|
30
|
+
- .gitignore
|
31
|
+
- README
|
32
|
+
- Rakefile
|
33
|
+
- VERSION
|
34
|
+
- actionmailer-with-request.gemspec
|
35
|
+
- init.rb
|
36
|
+
- lib/actionmailer_with_request.rb
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/weppos/actionmailer_with_request
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options:
|
43
|
+
- --charset=UTF-8
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.3.6
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: A simple plugin to make the Rails request context available for generating URLs in ActionMailer. Works with Rails 3 (not tested with 2.3.x)
|
67
|
+
test_files: []
|
68
|
+
|