mailtime 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d1034ff118c9f1f13f3585d33f7d6ea7de54484
4
- data.tar.gz: 4a14aed6613149b9887928f3bf82c82acd6de04b
3
+ metadata.gz: 4164639a2246ede181bb3431c3e79d8762d65a26
4
+ data.tar.gz: 3fc802e69ac88adeeaeb4e47e00a3b090405ee92
5
5
  SHA512:
6
- metadata.gz: 4c765236c8b6e7871d83c41bc3811649652bea36cb25a31f0c8b8207ad23846cd5e67a7aad19020f1a8a72e33a0ba8d0a4501c2c0fa4f18866e6eb8b1a6b74db
7
- data.tar.gz: a9c3adcf5423fda4105fdc225bc63dcc25857d323cad62d3c3281c1fbeeba65744f6a7cd91809f68dd858739f0cba274fd57fdcae1de5c0502eb7ece43a235b9
6
+ metadata.gz: 4338930085c6a3f4ba5fab74fd05f2d74d06c8a8e0faa73eda55fc241de424282a4696b70c887e093941e66cb5814fd6f8d0730272ec87386ea886e48fea7a35
7
+ data.tar.gz: 23df378aabf1e7f46023aede7697df32534211ab022b400ef1fccad15a62909c82add99afe9f9147380c2d02bbcc4eeb47eb1028ea55b80479141e66d626f08d
data/Rakefile CHANGED
@@ -1,9 +1,11 @@
1
1
  require 'bundler/gem_tasks'
2
- task :default => :spec
3
2
 
4
3
  require 'rake/testtask'
5
4
 
6
- Rake::TestTask.new do |t|
7
- t.libs << 'test'
8
- t.pattern = 'test/*_test.rb'
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/test_*.rb"]
9
9
  end
10
+
11
+ task :default => :test
@@ -18,9 +18,9 @@ module Mailtime
18
18
  yield(configuration)
19
19
  end
20
20
 
21
- if defined?(ActiveRecord::Base)
21
+ if defined?(::ActiveRecord::Base)
22
22
  require 'mailtime/acts_as_mailtime_loggable'
23
- ActiveRecord::Base.extend Mailtime::ActsAsMailtimeLoggable
23
+ ::ActiveRecord::Base.extend Mailtime::ActsAsMailtimeLoggable
24
24
  end
25
25
 
26
26
  end
@@ -31,4 +31,5 @@ require 'mailtime/renderers/null'
31
31
  require 'mailtime/processor/processor'
32
32
  require 'mailtime/railtie'
33
33
  require 'mailtime/active_record/models/concerns/mail_log_concern'
34
- require 'mailtime/active_record/models/concerns/mail_template_concern'
34
+ require 'mailtime/active_record/models/concerns/mail_template_concern'
35
+ require 'mailtime/active_record/models/concerns/renderer_concern'
@@ -3,6 +3,8 @@ module Mailtime
3
3
  # outlined in mail_template_concern.rb
4
4
  module MailLogConcern
5
5
 
6
+ extend ::ActiveSupport::Concern
7
+
6
8
  included do
7
9
  self.table_name = 'mailtime_mail_logs'
8
10
  belongs_to :loggable, :polymorphic => true
@@ -24,7 +24,7 @@ module Mailtime
24
24
 
25
25
  def mail_layout
26
26
  return NullLayout.new unless self[:mail_layout].present?
27
-
27
+ self[:mail_layout]
28
28
  end
29
29
 
30
30
  def additional_headers
@@ -9,7 +9,7 @@ module Mailtime
9
9
  renderers.each do |r|
10
10
  return r if r.renders.include? self.extension
11
11
  end
12
- Mailtime::Renderer::ErbRenderer
12
+ Mailtime::Renderers::ErbRenderer
13
13
  end
14
14
 
15
15
  # render against the mail
@@ -5,7 +5,7 @@ module Mailtime
5
5
  class MailLayout < ActiveRecord::Base
6
6
 
7
7
  include Mailtime::MailLayoutConcern
8
- include Mailtime::Renderer
8
+ include Mailtime::RendererConcern
9
9
 
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Mailtime
5
5
  class MailTemplate < ActiveRecord::Base
6
6
 
7
7
  include Mailtime::MailTemplateConcern
8
- include Mailtime::Renderer
8
+ include Mailtime::RendererConcern
9
9
 
10
10
  end
11
11
  end
@@ -4,7 +4,7 @@ module Mailtime
4
4
  def acts_as_mailtime_loggable(attr = 'email', opts = {})
5
5
  include Mailtime::Loggable
6
6
  opts[:fields] ||= [:to]
7
- Mailtime.configuration.loggable_lookups << { self.to_s => {:attribute => attr, :fields => opts[:fields]} }
7
+ Mailtime.loggable_lookups << { self.to_s => {:attribute => attr, :fields => opts[:fields]} }
8
8
  end
9
9
 
10
10
  end
@@ -1,5 +1,11 @@
1
1
  module Mailtime
2
2
 
3
+ @@loggable_lookups = []
4
+
5
+ def self.loggable_lookups
6
+ @@loggable_lookups
7
+ end
8
+
3
9
  class Configuration
4
10
  attr_accessor :mailers,
5
11
  :render,
@@ -18,7 +24,7 @@ module Mailtime
18
24
  @log_fields = [:to]
19
25
  @fallback = true
20
26
  @reject_scope_keys = ['devise_mapping', 'scope_name']
21
- @loggable_lookups = []
27
+ @loggable_lookups = Mailtime.loggable_lookups
22
28
  @yield_keyword = '{{ mailtime_yield }}'
23
29
  @valid_formats = %w{html text}
24
30
  end
@@ -27,10 +33,6 @@ module Mailtime
27
33
  @mailers << klass
28
34
  end
29
35
 
30
- def mailers
31
- @mailers
32
- end
33
-
34
36
  def loggables
35
37
  @loggable_lookups.each_with_object({}) do |k,h|
36
38
  key = k.keys.first
@@ -3,6 +3,7 @@ require 'mailtime/renderers/mail_renderer'
3
3
  require 'mailtime/renderers/base_renderer'
4
4
  require 'mailtime/renderers/erb_renderer'
5
5
  require 'mailtime/processor/mail_log_service'
6
+ require 'mailtime/processor/processor'
6
7
 
7
8
  module Mailtime
8
9
  class Processor
@@ -3,7 +3,7 @@ require 'mailtime'
3
3
 
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "Include your code in the controller" do
6
- ActiveSupport.on_load(:action_controller) do
6
+ ::ActiveSupport.on_load(:action_controller) do
7
7
  include Mailtime
8
8
  end
9
9
  end
@@ -1,5 +1,3 @@
1
- require 'erb'
2
-
3
1
  module Mailtime
4
2
  module Renderers
5
3
  class BaseRenderer
@@ -1,5 +1,3 @@
1
- require 'erb'
2
-
3
1
  module Mailtime
4
2
  module Renderers
5
3
  class ErbRenderer < BaseRenderer
@@ -33,6 +33,10 @@ module Mailtime
33
33
  NullLayout.new
34
34
  end
35
35
 
36
+ def renderer
37
+ Mailtime::Renderers::ErbRenderer
38
+ end
39
+
36
40
  # doesn't do anything since we already know the mail.
37
41
  def render(mail)
38
42
  @content
@@ -1,3 +1,3 @@
1
1
  module Mailtime
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -29,8 +29,12 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_development_dependency 'minitest', '~> 4.7.3'
33
-
32
+ spec.add_development_dependency "rails", "4.2"
33
+ spec.add_development_dependency "rake", ">= 10.0"
34
+ spec.add_development_dependency "minitest"
35
+ spec.add_development_dependency "minitest-reporters"
36
+ spec.add_development_dependency "mocha"
37
+ spec.add_development_dependency "rubocop", ">= 0.37.0"
34
38
  spec.requirements << 'Rails <= 3.2'
35
39
 
36
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Brody
@@ -10,20 +10,90 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: minitest
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-reporters
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
18
88
  - !ruby/object:Gem::Version
19
- version: 4.7.3
89
+ version: 0.37.0
20
90
  type: :development
21
91
  prerelease: false
22
92
  version_requirements: !ruby/object:Gem::Requirement
23
93
  requirements:
24
- - - "~>"
94
+ - - ">="
25
95
  - !ruby/object:Gem::Version
26
- version: 4.7.3
96
+ version: 0.37.0
27
97
  description:
28
98
  email:
29
99
  - josh@josh.mn
@@ -87,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
157
  requirements:
88
158
  - Rails <= 3.2
89
159
  rubyforge_project:
90
- rubygems_version: 2.4.3
160
+ rubygems_version: 2.4.8
91
161
  signing_key:
92
162
  specification_version: 4
93
163
  summary: Manage the mails you send from Rails.