goatmail 1.1.1 → 1.2.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
- SHA1:
3
- metadata.gz: 13683a9c7ec6109131989e5717ff34615b43b50f
4
- data.tar.gz: ffdb73b2ac5a73f746987623261c059c0faf9bd9
2
+ SHA256:
3
+ metadata.gz: 60129bf941275eb62aca03cf40690205bc98ea6a5c32a9405b14eeb4adbd0126
4
+ data.tar.gz: f5be5dd481df2a40d39b290d0f0cdf1805db1062eb1f7a3321bb5be7e86d75ff
5
5
  SHA512:
6
- metadata.gz: 4b4fdd461cc450689780927f4d4db370ec147eb877d2ea49d4a5504741f6e3b730d9d124a88a0785a91ffe8406864e55330ada740ccd7a8b256824a7e96b338c
7
- data.tar.gz: 15ef1105ee23da4adf259ac1de0c50f35545320e387c586c2e6195ef71e9bc9ce2abf97a793af9b50f8772e75c08bc9520831eb445fcf4bc1927c9ab31a76cad
6
+ metadata.gz: 1e603fe208760588d06212425270dd15f4891fd1a4bd4ce04bf90803c61cc9d2e7e16c79b9693c2aae4a47f06a088f05c8baef5d0fca499e9aea7b90b2dadaca
7
+ data.tar.gz: e3b4bad9eb816d10b81cb80e39f948014620f44ab2666e3019f7f6c3f1a58f969c89a2b6c6f9414a8cbb81e4c5faca8e07c492770feff7710c00ed0f0a01c62c
@@ -1,23 +1,23 @@
1
1
  language: ruby
2
- before_install: gem install bundler --pre
2
+ cache: bundler
3
+ before_install:
4
+ - gem install bundler
3
5
  install:
4
- - gem update --system
5
6
  - bundle update
6
- script: xvfb-run rake
7
+ script: xvfb-run bundle exec rake
7
8
  rvm:
8
- - 2.0.0
9
- - 2.1
10
- - 2.2
11
- - rbx-2
12
- - jruby
9
+ - 2.2.9
10
+ - 2.3.6
11
+ - 2.4.3
12
+ - 2.5.0
13
13
  - ruby-head
14
14
  - jruby-head
15
+ - rbx-3
15
16
  branches:
16
17
  only:
17
18
  - master
18
19
  matrix:
19
20
  allow_failures:
20
- - rvm: rbx-2
21
21
  - rvm: ruby-head
22
22
  - rvm: jruby-head
23
-
23
+ - rvm: rbx-3
data/README.md CHANGED
@@ -39,6 +39,8 @@ Sample::Application.routes.draw do
39
39
  end
40
40
  ```
41
41
 
42
+ If you use the Rails 5, Please use a combination with the Sinatra 2.0 later version.
43
+
42
44
  ## Padrino Setup
43
45
 
44
46
  Then set the delivery method and mount app in `config/apps.rb`
@@ -58,6 +60,19 @@ end
58
60
  Padrino.mount('SampleProject::App', :app_file => Padrino.root('app/app.rb')).to('/')
59
61
  ```
60
62
 
63
+ If an exception occurs that "Gem Load Error is: undefined method 'version' for Padrino:Module", please try this:
64
+
65
+ ```ruby
66
+ # Gemfile
67
+ gem 'goatmail', :group => :development, :require => false
68
+
69
+ # config/boot.rb
70
+ Padrino.before_load do
71
+ require 'goatmail'
72
+ end
73
+ ```
74
+
75
+
61
76
  ## Sinatra Sample
62
77
 
63
78
  ```ruby
@@ -83,8 +98,10 @@ map '/' do
83
98
  run Sample::App.new
84
99
  end
85
100
 
86
- map '/inbox' do
87
- run Goatmail::App.new
101
+ if ENV['RACK_ENV'] == 'development'
102
+ map '/inbox' do
103
+ run Goatmail::App.new
104
+ end
88
105
  end
89
106
  ```
90
107
 
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 2.0.0'
22
22
 
23
- spec.add_dependency "letter_opener"
23
+ spec.add_dependency "letter_opener", '>= 1.5.0'
24
24
  spec.add_dependency "sinatra"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -2,9 +2,9 @@ require 'goatmail/delivery_method'
2
2
  require 'goatmail/app'
3
3
 
4
4
  module Goatmail
5
-
6
5
  class << self
7
6
  def location
7
+ @location ||= LetterOpener.configuration.location
8
8
  @location ||= Rails.root.join('tmp/goatmail') if defined? Rails
9
9
  @location ||= Padrino.root('tmp/goatmail') if defined? Padrino
10
10
  @location
@@ -14,7 +14,6 @@ module Goatmail
14
14
  @location = path
15
15
  end
16
16
  end
17
-
18
17
  end
19
18
 
20
19
  require "goatmail/railtie" if defined? Rails::Railtie
@@ -4,18 +4,21 @@ module Goatmail
4
4
  class DeliveryMethod < LetterOpener::DeliveryMethod
5
5
 
6
6
  def initialize(options = {})
7
+ options[:location] ||= Goatmail.location
8
+ super
7
9
  raise InvalidOption, "A location option is required when using the Goatmail delivery method" if Goatmail.location.nil?
8
- self.settings = options
9
10
  end
10
11
 
11
12
  def deliver!(mail)
12
- location = File.join(Goatmail.location, "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
13
- messages = LetterOpener::Message.rendered_messages(location, mail)
13
+ validate_mail!(mail)
14
+ location = File.join(settings[:location], "#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
15
+ messages = LetterOpener::Message.rendered_messages(mail, location: location, message_template: settings[:message_template])
14
16
  meta_data = {
15
17
  subject: mail.subject.to_s,
16
18
  to: mail.to.join(", "),
17
19
  from: mail.from.join(', ')
18
20
  }
21
+
19
22
  File.open(File.join(location, 'meta'), 'wb') {|f| Marshal.dump(meta_data, f)}
20
23
  messages
21
24
  end
@@ -2,7 +2,7 @@ module Goatmail
2
2
  class Railtie < Rails::Railtie
3
3
  initializer "goatmail.add_delivery_method" do
4
4
  ActiveSupport.on_load :action_mailer do
5
- ActionMailer::Base.add_delivery_method :goatmail, Goatmail::DeliveryMethod, location: Rails.root.join("tmp", "goatmail")
5
+ ActionMailer::Base.add_delivery_method :goatmail, Goatmail::DeliveryMethod, location: Goatmail.location
6
6
  end
7
7
  end
8
8
  end if defined? Rails::Railtie
@@ -1,5 +1,5 @@
1
1
  module Goatmail
2
- VERSION = "1.1.1" unless defined? Goatmail::VERSION
2
+ VERSION = "1.2.0" unless defined? Goatmail::VERSION
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goatmail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi Yabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2018-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: letter_opener
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sinatra
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  requirements: []
237
237
  rubyforge_project:
238
- rubygems_version: 2.4.5.1
238
+ rubygems_version: 2.7.3
239
239
  signing_key:
240
240
  specification_version: 4
241
241
  summary: Sinatra-based letter_opener web interface