thincloud-postmark 0.1.1 → 0.2.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.
- data/.ruby-version +1 -0
- data/Gemfile +7 -2
- data/README.md +1 -1
- data/Rakefile +11 -0
- data/lib/generators/thincloud/postmark/postmark_generator.rb +1 -1
- data/lib/generators/thincloud/postmark/templates/thincloud_postmark.rb +3 -0
- data/lib/thincloud/postmark/configuration.rb +21 -0
- data/lib/thincloud/postmark/engine.rb +19 -0
- data/lib/{thincloud-postmark → thincloud/postmark}/version.rb +1 -1
- data/lib/thincloud-postmark.rb +4 -2
- data/test/configuration_test.rb +21 -0
- data/test/minitest_helper.rb +22 -0
- data/test/thincloud-postmark_test.rb +7 -0
- data/thincloud-postmark.gemspec +3 -1
- metadata +36 -5
- data/lib/generators/thincloud/postmark/templates/postmark.rb +0 -6
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3@thincloud-postmark
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ gem install thincloud-postmark
|
|
37
37
|
|
38
38
|
## Usage
|
39
39
|
|
40
|
-
This gem adds a generator to Rails, `thincloud:postmark`. Running the generator will install a
|
40
|
+
This gem adds a generator to Rails, `thincloud:postmark`. Running the generator will install a mail interceptor for non-production environments and a configuration initializer in `config/initializers/thincloud_postmark.rb` where your API key or environment variable can be defined.
|
41
41
|
|
42
42
|
* Invoke the generator:
|
43
43
|
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ module Thincloud
|
|
12
12
|
gem "postmark-rails", "~> 0.4.1"
|
13
13
|
|
14
14
|
copy_file "action_mailer.rb", "config/initializers/action_mailer.rb"
|
15
|
-
copy_file "
|
15
|
+
copy_file "thincloud_postmark.rb", "config/initializers/thincloud_postmark.rb"
|
16
16
|
copy_file "mail_interceptor.rb", "lib/mail_interceptor.rb"
|
17
17
|
|
18
18
|
say_status "", ""
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Thincloud
|
2
|
+
module Postmark
|
3
|
+
class << self
|
4
|
+
attr_accessor :configuration
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configure
|
8
|
+
self.configuration ||= Configuration.new
|
9
|
+
yield configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
# Public: Configuration options for the Thincloud::Postmark module
|
13
|
+
class Configuration
|
14
|
+
attr_accessor :api_key
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@api_key = "POSTMARK_API_TEST"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Engine < ::Rails::Engine
|
2
|
+
|
3
|
+
# Require the config initializer in advance so it is available for
|
4
|
+
# the "thincloud.postmark.action_mailer" initializer
|
5
|
+
initializer "thincloud.postmark.configuration", before: "thincloud.postmark.action_mailer" do
|
6
|
+
config_initializer = File.expand_path("config/initializers/thincloud_postmark.rb")
|
7
|
+
require config_initializer if File.exists?(config_initializer)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Apply the postmark settings just before ActionMailer applies them
|
11
|
+
initializer "thincloud.postmark.action_mailer", before: "action_mailer.set_configs" do
|
12
|
+
if api_key = Thincloud::Postmark.configuration.try(:api_key)
|
13
|
+
Postmark.secure = true
|
14
|
+
Rails.application.config.action_mailer.delivery_method = :postmark
|
15
|
+
Rails.application.config.action_mailer.postmark_settings = { api_key: api_key }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/thincloud-postmark.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require "rails"
|
1
2
|
require "postmark-rails"
|
2
|
-
require "thincloud
|
3
|
+
require "thincloud/postmark/configuration"
|
4
|
+
require "thincloud/postmark/engine"
|
5
|
+
require "thincloud/postmark/version"
|
3
6
|
|
4
7
|
module Thincloud
|
5
8
|
module Postmark
|
6
|
-
# Your code goes here...
|
7
9
|
end
|
8
10
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
|
3
|
+
describe Thincloud::Postmark::Configuration do
|
4
|
+
|
5
|
+
describe "api_key" do
|
6
|
+
describe "default" do
|
7
|
+
it { Thincloud::Postmark::Configuration.new.api_key.must_equal "POSTMARK_API_TEST" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "provided" do
|
11
|
+
before do
|
12
|
+
Thincloud::Postmark.configure do |config|
|
13
|
+
config.api_key = "abc123"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it { Thincloud::Postmark.configuration.api_key.must_equal "abc123" }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
if RUBY_ENGINE == "ruby"
|
2
|
+
begin
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.add_filter "test"
|
5
|
+
SimpleCov.add_filter "config"
|
6
|
+
SimpleCov.command_name "MiniTest"
|
7
|
+
SimpleCov.start
|
8
|
+
rescue LoadError
|
9
|
+
warn "unable to load SimpleCov"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
ENV["RAILS_ENV"] = "test"
|
14
|
+
|
15
|
+
require "minitest/autorun"
|
16
|
+
require "minitest/pride"
|
17
|
+
|
18
|
+
require "thincloud-postmark"
|
19
|
+
require "thincloud/postmark/configuration"
|
20
|
+
|
21
|
+
# Load support files
|
22
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
data/thincloud-postmark.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path("../lib/thincloud
|
2
|
+
require File.expand_path("../lib/thincloud/postmark/version", __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Robert Bousquet", "Phil Cohen"]
|
@@ -15,5 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Thincloud::Postmark::VERSION
|
17
17
|
|
18
|
+
gem.add_development_dependency "thincloud-test", "~> 0.3.2"
|
19
|
+
|
18
20
|
gem.add_runtime_dependency "postmark-rails", "~> 0.4.1"
|
19
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thincloud-postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,8 +10,24 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thincloud-test
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.3.2
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.3.2
|
15
31
|
- !ruby/object:Gem::Dependency
|
16
32
|
name: postmark-rails
|
17
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,6 +53,7 @@ extensions: []
|
|
37
53
|
extra_rdoc_files: []
|
38
54
|
files:
|
39
55
|
- .gitignore
|
56
|
+
- .ruby-version
|
40
57
|
- Gemfile
|
41
58
|
- LICENSE
|
42
59
|
- README.md
|
@@ -44,9 +61,14 @@ files:
|
|
44
61
|
- lib/generators/thincloud/postmark/postmark_generator.rb
|
45
62
|
- lib/generators/thincloud/postmark/templates/action_mailer.rb
|
46
63
|
- lib/generators/thincloud/postmark/templates/mail_interceptor.rb
|
47
|
-
- lib/generators/thincloud/postmark/templates/
|
64
|
+
- lib/generators/thincloud/postmark/templates/thincloud_postmark.rb
|
48
65
|
- lib/thincloud-postmark.rb
|
49
|
-
- lib/thincloud
|
66
|
+
- lib/thincloud/postmark/configuration.rb
|
67
|
+
- lib/thincloud/postmark/engine.rb
|
68
|
+
- lib/thincloud/postmark/version.rb
|
69
|
+
- test/configuration_test.rb
|
70
|
+
- test/minitest_helper.rb
|
71
|
+
- test/thincloud-postmark_test.rb
|
50
72
|
- thincloud-postmark.gemspec
|
51
73
|
homepage: http://newleaders.github.com/thincloud-postmark
|
52
74
|
licenses: []
|
@@ -60,16 +82,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
82
|
- - ! '>='
|
61
83
|
- !ruby/object:Gem::Version
|
62
84
|
version: '0'
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
hash: -3057873401400622908
|
63
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
89
|
none: false
|
65
90
|
requirements:
|
66
91
|
- - ! '>='
|
67
92
|
- !ruby/object:Gem::Version
|
68
93
|
version: '0'
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
hash: -3057873401400622908
|
69
97
|
requirements: []
|
70
98
|
rubyforge_project:
|
71
99
|
rubygems_version: 1.8.24
|
72
100
|
signing_key:
|
73
101
|
specification_version: 3
|
74
102
|
summary: Postmark configuration for Rails apps.
|
75
|
-
test_files:
|
103
|
+
test_files:
|
104
|
+
- test/configuration_test.rb
|
105
|
+
- test/minitest_helper.rb
|
106
|
+
- test/thincloud-postmark_test.rb
|