smtp_url 0.2.0 → 0.3.0
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 +7 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +47 -0
- data/Rakefile +4 -0
- data/lib/smtp_url/railtie.rb +7 -5
- data/lib/smtp_url/version.rb +1 -1
- data/smtp_url.gemspec +1 -1
- data/spec/smtp_url/railtie_spec.rb +26 -41
- data/spec/spec_helper.rb +2 -4
- metadata +10 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 17025cd859ef992718f80462e0ac4b9efaff4c11
|
4
|
+
data.tar.gz: fcc37463b58047802ac5e5a0e65ca847a11589d7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d7d243bac1f54c7f759086f4cd5f60970da9c288f7ff2235a2d7ffab87ea19d5de72d42940c811879c2820e70352037621004120d1d73821b6bf50887a4d4f5c
|
7
|
+
data.tar.gz: 6c4f85909334e369b1e31ee77bb76aea42a3344929afcdb7c7b051c3905469fcb4d0fc66796307b901e5f7f433fccf7f402404b944fd221c94cfd6ddff1e31fd
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,50 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
actionpack (3.2.3)
|
5
|
+
activemodel (= 3.2.3)
|
6
|
+
activesupport (= 3.2.3)
|
7
|
+
builder (~> 3.0.0)
|
8
|
+
erubis (~> 2.7.0)
|
9
|
+
journey (~> 1.0.1)
|
10
|
+
rack (~> 1.4.0)
|
11
|
+
rack-cache (~> 1.2)
|
12
|
+
rack-test (~> 0.6.1)
|
13
|
+
sprockets (~> 2.1.2)
|
14
|
+
activemodel (3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
builder (~> 3.0.0)
|
4
17
|
activesupport (3.2.3)
|
5
18
|
i18n (~> 0.6)
|
6
19
|
multi_json (~> 1.0)
|
20
|
+
builder (3.0.4)
|
7
21
|
diff-lcs (1.1.3)
|
22
|
+
erubis (2.7.0)
|
23
|
+
hike (1.2.3)
|
8
24
|
i18n (0.6.0)
|
25
|
+
journey (1.0.4)
|
26
|
+
json (1.8.1)
|
27
|
+
metaclass (0.0.4)
|
28
|
+
mocha (1.0.0)
|
29
|
+
metaclass (~> 0.0.1)
|
9
30
|
multi_json (1.3.5)
|
31
|
+
rack (1.4.5)
|
32
|
+
rack-cache (1.2)
|
33
|
+
rack (>= 0.4)
|
34
|
+
rack-ssl (1.3.4)
|
35
|
+
rack
|
36
|
+
rack-test (0.6.2)
|
37
|
+
rack (>= 1.0)
|
38
|
+
railties (3.2.3)
|
39
|
+
actionpack (= 3.2.3)
|
40
|
+
activesupport (= 3.2.3)
|
41
|
+
rack-ssl (~> 1.3.2)
|
42
|
+
rake (>= 0.8.7)
|
43
|
+
rdoc (~> 3.4)
|
44
|
+
thor (~> 0.14.6)
|
45
|
+
rake (10.1.0)
|
46
|
+
rdoc (3.12.2)
|
47
|
+
json (~> 1.4)
|
10
48
|
rspec (2.10.0)
|
11
49
|
rspec-core (~> 2.10.0)
|
12
50
|
rspec-expectations (~> 2.10.0)
|
@@ -15,10 +53,19 @@ GEM
|
|
15
53
|
rspec-expectations (2.10.0)
|
16
54
|
diff-lcs (~> 1.1.3)
|
17
55
|
rspec-mocks (2.10.1)
|
56
|
+
sprockets (2.1.3)
|
57
|
+
hike (~> 1.2)
|
58
|
+
rack (~> 1.0)
|
59
|
+
tilt (~> 1.1, != 1.3.0)
|
60
|
+
thor (0.14.6)
|
61
|
+
tilt (1.4.1)
|
18
62
|
|
19
63
|
PLATFORMS
|
20
64
|
ruby
|
21
65
|
|
22
66
|
DEPENDENCIES
|
23
67
|
activesupport
|
68
|
+
mocha
|
69
|
+
railties
|
70
|
+
rake
|
24
71
|
rspec
|
data/Rakefile
ADDED
data/lib/smtp_url/railtie.rb
CHANGED
@@ -2,11 +2,13 @@ require "smtp_url/parser"
|
|
2
2
|
|
3
3
|
module SmtpURL
|
4
4
|
class Railtie < Rails::Railtie
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
initializer 'configure action_mailer' do
|
6
|
+
if ENV["SMTP_URL"]
|
7
|
+
config.action_mailer.delivery_method = :smtp
|
8
|
+
config.action_mailer.smtp_settings = SmtpURL::Parser.new(ENV["SMTP_URL"]).parse
|
9
|
+
else
|
10
|
+
Rails.logger.warn "SmtpURL did not setup your email delivery because the SMTP_URL env var was missing"
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
data/lib/smtp_url/version.rb
CHANGED
data/smtp_url.gemspec
CHANGED
@@ -1,58 +1,43 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'smtp_url/railtie'
|
2
3
|
|
3
4
|
module Rails
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
class << self
|
6
|
+
attr_accessor :logger
|
7
|
+
end
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
describe SmtpURL::Railtie do
|
11
|
+
before do
|
12
|
+
Rails::Railtie::Configuration.any_instance.stub(:action_mailer).and_return(mock_config)
|
13
|
+
Rails.logger = Logger.new(STDOUT)
|
14
|
+
SmtpURL::Railtie.any_instance.stub(:instance_variable_defined?).and_return(false)
|
12
15
|
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
MailerConfig.new
|
17
|
-
end
|
17
|
+
let(:mock_config) do
|
18
|
+
mock('mock_config').as_null_object
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
context 'with SMTP_URL defined' do
|
22
|
+
before do
|
23
|
+
ENV['SMTP_URL'] = 'smtp://localhost:1025'
|
22
24
|
end
|
23
25
|
|
24
|
-
|
26
|
+
it "should setup action_mailer settings when SMTP_URL is set" do
|
27
|
+
mock_config.should_receive(:delivery_method=).with(:smtp)
|
28
|
+
mock_config.should_receive(:smtp_settings=)
|
29
|
+
SmtpURL::Railtie.run_initializers
|
25
30
|
end
|
26
|
-
end
|
27
31
|
|
28
|
-
|
29
|
-
|
32
|
+
after do
|
33
|
+
ENV['SMTP_URL'] = nil
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
require 'smtp_url/railtie'
|
39
|
-
|
40
|
-
describe SmtpURL::Railtie do
|
41
|
-
|
42
|
-
it "should log a warning if SMTP_URL is not set" do
|
43
|
-
Rails::Logger.any_instance.expects(:warn).with('SmtpURL did not setup your email delivery because the SMTP_URL env var was missing')
|
44
|
-
load 'smtp_url/railtie.rb'
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should setup action_mailer settings when SMTP_URL is set" do
|
48
|
-
ENV['SMTP_URL'] = 'smtp://localhost:1025'
|
49
|
-
Rails::MailerConfig.any_instance.expects(:delivery_method=).with(:smtp)
|
50
|
-
Rails::MailerConfig.any_instance.expects(:smtp_settings=)
|
51
|
-
load 'smtp_url/railtie.rb'
|
37
|
+
context 'without SMTP_URL defined' do
|
38
|
+
it "should log a warning if SMTP_URL is not set" do
|
39
|
+
Rails.logger.should_receive(:warn).with('SmtpURL did not setup your email delivery because the SMTP_URL env var was missing')
|
40
|
+
SmtpURL::Railtie.run_initializers
|
41
|
+
end
|
52
42
|
end
|
53
43
|
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require "rspec"
|
1
|
+
require 'rspec'
|
2
|
+
require 'action_controller/railtie'
|
4
3
|
|
5
4
|
RSpec.configure do |config|
|
6
5
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
7
6
|
config.run_all_when_everything_filtered = true
|
8
7
|
config.filter_run :focus
|
9
|
-
config.mock_framework = :mocha
|
10
8
|
config.order = 'random'
|
11
9
|
end
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smtp_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel Farrell
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
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
26
|
version: '0'
|
30
27
|
description: Allows smtp settings to be defined as URL in environment variable, then
|
@@ -37,6 +34,7 @@ extra_rdoc_files: []
|
|
37
34
|
files:
|
38
35
|
- Gemfile
|
39
36
|
- Gemfile.lock
|
37
|
+
- Rakefile
|
40
38
|
- Readme.md
|
41
39
|
- lib/smtp_url.rb
|
42
40
|
- lib/smtp_url/invalid_url_exception.rb
|
@@ -49,30 +47,28 @@ files:
|
|
49
47
|
- spec/spec_helper.rb
|
50
48
|
homepage: https://github.com/danielfarrell/smtp_url
|
51
49
|
licenses: []
|
50
|
+
metadata: {}
|
52
51
|
post_install_message:
|
53
52
|
rdoc_options: []
|
54
53
|
require_paths:
|
55
54
|
- lib
|
56
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
56
|
requirements:
|
59
|
-
- -
|
57
|
+
- - ">="
|
60
58
|
- !ruby/object:Gem::Version
|
61
59
|
version: '0'
|
62
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
61
|
requirements:
|
65
|
-
- -
|
62
|
+
- - ">="
|
66
63
|
- !ruby/object:Gem::Version
|
67
64
|
version: '0'
|
68
65
|
requirements: []
|
69
66
|
rubyforge_project:
|
70
|
-
rubygems_version:
|
67
|
+
rubygems_version: 2.4.5
|
71
68
|
signing_key:
|
72
|
-
specification_version:
|
69
|
+
specification_version: 4
|
73
70
|
summary: Convert an smtp url into mail/action mailer friendly hashes
|
74
71
|
test_files:
|
75
72
|
- spec/smtp_url/parser_spec.rb
|
76
73
|
- spec/smtp_url/railtie_spec.rb
|
77
74
|
- spec/spec_helper.rb
|
78
|
-
has_rdoc:
|