thincloud-postmark 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in thincloud-postmark.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 New Leaders
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,71 @@
1
+ # Thincloud::Postmark
2
+
3
+ ## Description
4
+
5
+ [Postmark](http://postmarkapp.com) configuration for Rails apps.
6
+
7
+ ## Requirements
8
+
9
+ This gem requires Rails 3.2+ and has been tested on the following versions:
10
+
11
+ * 3.2
12
+
13
+ This gem has been tested against the following Ruby versions:
14
+
15
+ * 1.9.3
16
+
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ ``` ruby
23
+ gem "thincloud-postmark"
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ ```
29
+ $ bundle
30
+ ```
31
+
32
+ Or install it yourself as:
33
+
34
+ ```
35
+ $ gem install thincloud-postmark
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ This gem adds a generator to Rails, `thincloud:postmark`. Running the generator will install a Postmark initializer and a mail interceptor for non-production environments.
41
+
42
+ * Invoke the generator:
43
+
44
+ ```
45
+ $ rails generate thincloud:postmark
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
55
+
56
+
57
+ ## Contributing
58
+
59
+ 1. [Fork it](https://github.com/newleaders/thincloud-postmark/fork_select)
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
62
+ 4. Push to the branch (`git push origin my-new-feature`)
63
+ 5. [Create a Pull Request](hhttps://github.com/newleaders/thincloud-postmark/pull/new)
64
+
65
+
66
+ ## License
67
+
68
+ * Freely distributable and licensed under the MIT-style license. See LICENSE file for details.
69
+ * Copyright (c) 2012 New Leaders
70
+ * [https://newleaders.com](https://newleaders.com)
71
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,30 @@
1
+ require "rails"
2
+
3
+ module Thincloud
4
+ module Generators
5
+ class PostmarkGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ desc "Generates Postmark configuration for Rails app"
9
+
10
+ def postmark
11
+
12
+ gem "postmark-rails", "~> 0.4.1"
13
+
14
+ copy_file "action_mailer.rb", "config/initializers/action_mailer.rb"
15
+ copy_file "postmark.rb", "config/initializers/postmark.rb"
16
+ copy_file "mail_interceptor.rb", "lib/mail_interceptor.rb"
17
+
18
+ say_status "", ""
19
+ say_status "success", "Initial Postmark configuration has been created"
20
+ say_status "", "Don't forget to run `bundle`"
21
+ say_status "", ""
22
+ say_status "", "In application.rb, add:"
23
+ say_status "", %Q[ config.action_mailer.default_url_options = { host: "mydomain.com" } ]
24
+ say_status "", "In lib/mail_interceptor.rb:"
25
+ say_status "", "Set email address to your own pattern "
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,2 @@
1
+ require "mail_interceptor"
2
+ Mail.register_interceptor(MailInterceptor) unless Rails.env.production?
@@ -0,0 +1,7 @@
1
+ class MailInterceptor
2
+ def self.delivering_email(message)
3
+ message.subject = "#{message.to} #{message.subject}"
4
+ message.to = "#{ENV["USER"]}@newleaders.com"
5
+ message.bcc = nil
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # ActionMailer Postmark setup
2
+ Postmark.secure = true
3
+ Rails.application.config.action_mailer.delivery_method = :postmark
4
+ Rails.application.config.action_mailer.postmark_settings = {
5
+ api_key: ENV["POSTMARK_API_KEY"] || "POSTMARK_API_TEST"
6
+ }
@@ -0,0 +1,7 @@
1
+ require "thincloud-postmark/version"
2
+
3
+ module Thincloud
4
+ module Postmark
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Thincloud
2
+ module Postmark
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/thincloud-postmark/version", __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Robert Bousquet", "Phil Cohen"]
6
+ gem.email = ["rbousquet@newleaders.com", "pcohen@newleaders.com"]
7
+ gem.description = "Postmark configuration for Rails apps."
8
+ gem.summary = "Postmark configuration for Rails apps."
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "thincloud-postmark"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Thincloud::Postmark::VERSION
17
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thincloud-postmark
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Bousquet
9
+ - Phil Cohen
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-08-17 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: Postmark configuration for Rails apps.
16
+ email:
17
+ - rbousquet@newleaders.com
18
+ - pcohen@newleaders.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - Gemfile
25
+ - LICENSE
26
+ - README.md
27
+ - Rakefile
28
+ - lib/generators/thincloud/postmark/postmark_generator.rb
29
+ - lib/generators/thincloud/postmark/templates/action_mailer.rb
30
+ - lib/generators/thincloud/postmark/templates/mail_interceptor.rb
31
+ - lib/generators/thincloud/postmark/templates/postmark.rb
32
+ - lib/thincloud-postmark.rb
33
+ - lib/thincloud-postmark/version.rb
34
+ - thincloud-postmark.gemspec
35
+ homepage: ''
36
+ licenses: []
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 1.8.24
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Postmark configuration for Rails apps.
59
+ test_files: []