actionmailer-with-request 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 25400e6c63a4368d905d31e9515fd6f586313914
4
+ data.tar.gz: '08ad57e560161d0e98c6e89627a221a4ec343561'
5
+ SHA512:
6
+ metadata.gz: 2a8fef1b17eb43a4145fee2ca76122970bbe5626d1d66228efbb0fe805c96e10410d0971050ac836590dd22ec8e289735a5550a068a9bf95217e8a6d25e32848
7
+ data.tar.gz: c320af0011018e009a8c224b1f6bfe2b8ab74d2a9cc91f944e847e3c445f6f68b4eda58d40f7caa08a3aee77b5bac42aea064712b825af611e980eb1b68ea166
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ #### Release 0.5.0
4
+
5
+ - CHANGED: Minimum Rails version is now 5.
6
+ - CHANGED: Minimum Ruby version is now 2.2.2+ as Rails 5.
7
+
8
+ #### Release 0.4.0
9
+
10
+ - CHANGED: Fix to avoid thread collision.
11
+
12
+ #### Release 0.3.0
13
+
14
+ - CHANGED: Minimum Rails version is now 3.
15
+
16
+ #### Release 0.2.0
17
+
18
+ - CHANGED: Minimum Rails version is now 2.
19
+
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in macair:actionmailer_with_request.gemspec
4
3
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
1
+ Copyright (c) 2009-2016 Simone Carletti <weppos@weppos.net>
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -8,31 +8,31 @@ http://www.simonecarletti.com/blog/2009/10/actionmailer-and-host-value/
8
8
 
9
9
  ## Requirements
10
10
 
11
- - Rails 3
11
+ - Rails 5
12
12
 
13
- Please note
14
-
15
- - ActionMailerWithRequest >= 0.3 requires Rails 3.
16
- - Use ActionMailerWithRequest 0.2.x with Rails 2.
13
+ For an older versions of Ruby use a previous release.
17
14
 
18
15
 
19
16
  ## Installation
20
17
 
21
- $ gem install actionmailer-with-request
18
+ You can install the gem manually:
22
19
 
20
+ ```shell
21
+ $ gem install actionmailer-with-request
22
+ ```
23
23
 
24
- ## Author
24
+ Or use Bundler and define it as a dependency in your `Gemfile`:
25
25
 
26
- - [Simone Carletti](http://www.simonecarletti.com/) <weppos@weppos.net>
26
+ ```ruby
27
+ gem 'actionmailer-with-request'
28
+ ```
27
29
 
28
30
 
29
- ## Contributors
31
+ ## Changelog
30
32
 
31
- - Eric Anderson
32
- - Didier Lafforgue
33
+ See the [CHANGELOG.md](CHANGELOG.md) file for details.
33
34
 
34
35
 
35
36
  ## License
36
37
 
37
- Copyright (c) 2009-2012 Simone Carletti.
38
- This is Free Software distributed under the MIT license.
38
+ Copyright (c) 2009-2017 [Simone Carletti](https://simonecarletti.com/). This is Free Software distributed under the MIT license.
data/Rakefile CHANGED
@@ -1,6 +1 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- task :default do
5
- puts "No tasks here!"
6
- end
1
+ require "bundler/gem_tasks"
@@ -1,20 +1,20 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
3
+ require "actionmailer_with_request/version"
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = "actionmailer-with-request"
6
- s.version = "0.4.0"
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = "Simone Carletti"
9
- s.email = "weppos@weppos.net"
10
- s.homepage = "http://github.com/weppos/actionmailer_with_request"
11
- s.summary = "Let's ActionMailer know about the website."
7
+ s.version = ActionMailerWithRequest::VERSION
8
+ s.authors = ["Simone Carletti"]
9
+ s.email = ["weppos@weppos.net"]
10
+ s.homepage = "https://github.com/weppos/actionmailer_with_request"
11
+ s.summary = "Let's ActionMailer know about the website"
12
12
  s.description = "Let's ActionMailer know about the request context to avoid having to set a number of defaults manually."
13
13
 
14
+ s.require_paths = ["lib"]
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.require_paths = ["lib"]
17
+ s.license = 'MIT'
18
18
 
19
- s.add_dependency "rails", ">= 3"
19
+ s.add_dependency "rails", ">= 5"
20
20
  end
@@ -1,9 +1,11 @@
1
+ require_relative "actionmailer_with_request/version"
2
+
1
3
  module ActionMailerWithRequest
2
4
 
3
- module ControllerMixin
5
+ module RequestRecorder
4
6
  def self.included(base)
5
7
  base.class_eval do
6
- before_filter :store_request
8
+ before_action :store_request
7
9
  end
8
10
  end
9
11
 
@@ -12,35 +14,31 @@ module ActionMailerWithRequest
12
14
  end
13
15
  end
14
16
 
15
- module MailerDefaultUrlOptions
16
- def self.included(base)
17
- base.class_eval <<-RUBY, __FILE__, __LINE__ + 1
18
- # Extends ActionMailer#default_url_options capabilities
19
- # by merging the latest request context into the default url options.
20
- #
21
- # Returns the default url options Hash.
22
- def default_url_options_with_current_request(*args)
23
- defaults = {}
24
- request = Thread.current["actiondispatch.request"]
25
-
26
- if request
27
- host = request.host
28
- port = request.port
29
- protocol = request.protocol
30
- standard_port = request.standard_port
31
-
32
- defaults[:protocol] = protocol
33
- defaults[:host] = host
34
- defaults[:port] = port if port != standard_port
35
- end
36
-
37
- default_url_options_without_current_request(*args).merge(defaults)
38
- end
39
-
40
- alias_method_chain :default_url_options, :current_request
41
- RUBY
17
+ module DefaultUrlOptionsOverride
18
+ # Extends ActionMailer#default_url_options capabilities
19
+ # by merging the latest request context into the default url options.
20
+ #
21
+ # Returns the default url options Hash.
22
+ def default_url_options(*args)
23
+ defaults = {}
24
+ request = Thread.current["actiondispatch.request"]
25
+
26
+ if request
27
+ host = request.host
28
+ port = request.port
29
+ protocol = request.protocol
30
+ standard_port = request.standard_port
31
+
32
+ defaults[:protocol] = protocol
33
+ defaults[:host] = host
34
+ defaults[:port] = port if port != standard_port
35
+ end
36
+
37
+ super.merge(defaults)
42
38
  end
39
+ end
43
40
 
41
+ module RequestAccess
44
42
  # Get the current request. This assists in making request-based
45
43
  # e-mail addresses. For example:
46
44
  #
@@ -56,8 +54,9 @@ module ActionMailerWithRequest
56
54
 
57
55
  class Railtie < Rails::Railtie
58
56
  initializer 'actionmailer.with_request' do
59
- ActionController::Base.send :include, ActionMailerWithRequest::ControllerMixin
60
- ActionMailer::Base.send :include, ActionMailerWithRequest::MailerDefaultUrlOptions
57
+ ActionController::Base.send :include, ActionMailerWithRequest::RequestRecorder
58
+ ActionMailer::Base.prepend ActionMailerWithRequest::DefaultUrlOptionsOverride
59
+ ActionMailer::Base.include ActionMailerWithRequest::RequestAccess
61
60
  end
62
61
  end
63
62
  end
@@ -0,0 +1,3 @@
1
+ module ActionMailerWithRequest
2
+ VERSION = "0.5.0".freeze
3
+ end
metadata CHANGED
@@ -1,76 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailer-with-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Simone Carletti
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-15 00:00:00.000000000 Z
11
+ date: 2017-01-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: '3'
19
+ version: '5'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '3'
26
+ version: '5'
30
27
  description: Let's ActionMailer know about the request context to avoid having to
31
28
  set a number of defaults manually.
32
- email: weppos@weppos.net
29
+ email:
30
+ - weppos@weppos.net
33
31
  executables: []
34
32
  extensions: []
35
33
  extra_rdoc_files: []
36
34
  files:
37
- - .gitignore
35
+ - ".gitignore"
36
+ - CHANGELOG.md
38
37
  - Gemfile
39
38
  - LICENSE.txt
40
39
  - README.md
41
40
  - Rakefile
42
41
  - actionmailer-with-request.gemspec
43
- - init.rb
44
42
  - lib/actionmailer-with-request.rb
45
43
  - lib/actionmailer_with_request.rb
46
- homepage: http://github.com/weppos/actionmailer_with_request
47
- licenses: []
44
+ - lib/actionmailer_with_request/version.rb
45
+ homepage: https://github.com/weppos/actionmailer_with_request
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
48
49
  post_install_message:
49
50
  rdoc_options: []
50
51
  require_paths:
51
52
  - lib
52
53
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
54
  requirements:
55
- - - ! '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
- segments:
59
- - 0
60
- hash: -2861886898297731627
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
- - - ! '>='
60
+ - - ">="
65
61
  - !ruby/object:Gem::Version
66
62
  version: '0'
67
- segments:
68
- - 0
69
- hash: -2861886898297731627
70
63
  requirements: []
71
64
  rubyforge_project:
72
- rubygems_version: 1.8.24
65
+ rubygems_version: 2.5.2
73
66
  signing_key:
74
- specification_version: 3
75
- summary: Let's ActionMailer know about the website.
67
+ specification_version: 4
68
+ summary: Let's ActionMailer know about the website
76
69
  test_files: []
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'actionmailer_with_request'