actionmailer_interceptor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e7255444ae5b1375453de612784db355ee4ffef6
4
+ data.tar.gz: 388833eb7fc3bbe4d2253e28625953cd37f67840
5
+ SHA512:
6
+ metadata.gz: 1dff1aebcc76f355e01c22aae100828d44e2f2a03759e3f8c0b38de3ebb86ee8de0c9d9fca864594bf673d757e7e13c90b19b2466d10be47eac5e56eb35d6a86
7
+ data.tar.gz: 5654284b8fb34eec3a58deb269c4a1354ede84ba32bf7de2b2aac6af6ca6b0b1dba5cbcc85d888acce3a66aab9202711b408f813dc68a572012bda01031ba591
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ Gemfile.lock
31
+ .ruby-version
32
+ .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
36
+
37
+ .idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # actionmailer_interceptor
2
+ Intercepts and forwards emails to the given address in the specified environments
3
+
4
+ # installation
5
+
6
+ in Gemfile:
7
+
8
+ `gem 'actionmailer_interceptor'
9
+
10
+ in `config/initializers/actionmailer_interceptor.rb`:
11
+
12
+ ```
13
+ interceptor = ActionmailerInterceptor::MailerInterceptor.new(redirection_email: my_email@example.com)
14
+
15
+ if Rails.env.development? || Rails.env.staging?
16
+ ActionMailer::Base.register_interceptor(interceptor)
17
+ end
18
+ ```
@@ -0,0 +1,21 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'actionmailer_interceptor/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'actionmailer_interceptor'
7
+ s.version = ActionmailerInterceptor::VERSION.dup
8
+ s.platform = Gem::Platform::RUBY
9
+ s.date = '2015-12-14'
10
+ s.summary = ' Intercepts and forwards emails to the given address in the specified environments.'
11
+ s.description = ' Intercepts and forwards emails to the given address in the specified environments.'
12
+ s.authors = ['Marko Bošković']
13
+ s.email = 'marko@bosskovic@gmail.com'
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = []
16
+ s.homepage = 'https://github.com/bosskovic/actionmailer_interceptor'
17
+ s.license = 'MIT'
18
+
19
+ s.add_runtime_dependency 'activesupport'
20
+ s.add_development_dependency 'bundler'
21
+ end
@@ -0,0 +1,2 @@
1
+ require 'actionmailer_interceptor/mailer_interceptor'
2
+ require 'actionmailer_interceptor/version'
@@ -0,0 +1,21 @@
1
+ module ActionmailerInterceptor
2
+ class MailInterceptor
3
+ attr_accessor :redirection_email
4
+
5
+ def initialize(options={})
6
+ @redirection_email = options[:redirection_email]
7
+ end
8
+
9
+ def self.delivering_email(message)
10
+ original_recipients = ' ['
11
+ [:to, :cc, :bcc].each do |field|
12
+ unless message.send(field).blank?
13
+ original_recipients << "#{field}: #{message.send(field).join(', ')}"
14
+ end
15
+ end
16
+ original_recipients << ']'
17
+ message.subject += original_recipients
18
+ message.to = @redirection_email
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module ActionmailerInterceptor
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: actionmailer_interceptor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marko Bošković
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: " Intercepts and forwards emails to the given address in the specified
42
+ environments."
43
+ email: marko@bosskovic@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - Gemfile
51
+ - README.md
52
+ - actionmailer_interceptor.gemspec
53
+ - lib/actionmailer_interceptor.rb
54
+ - lib/actionmailer_interceptor/mailer_interceptor.rb
55
+ - lib/actionmailer_interceptor/version.rb
56
+ homepage: https://github.com/bosskovic/actionmailer_interceptor
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.4.8
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Intercepts and forwards emails to the given address in the specified environments.
80
+ test_files: []