sendgrid_cli_mailer 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -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 sendgrid_cli_mailer.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Hank Beaver
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.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # SendgridCliMailer
2
+
3
+ This is a simple gem I wrote so I could email from Utility servers or
4
+ servers without Rails from CLI. I chose Ruby so I wouldn't have to
5
+ depend on any SMTP deamons,etc.
6
+
7
+ Thanks @freerobby at https://github.com/freerobby/sendgrid_toolkit for
8
+ the Ruby API.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'sendgrid_cli_mailer'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install sendgrid_cli_mailer
23
+
24
+ ## Usage
25
+
26
+ You can send a message with a body specified via arguments:
27
+
28
+ sg_mailer --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --body 'Short Body' --user 'sg@foo.com' --key '1234'"
29
+
30
+ Or use STDOUT/Redirection to send a message body:
31
+
32
+ cat /some/file | sg_mailer --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --user 'sg@foo.com' --key '1234'"
33
+
34
+ NOTE: if you supply both the STDIN will win.
35
+
36
+
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+
data/bin/sg_mailer ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'sendgrid_cli_mailer'
4
+
5
+ SendgridCliMailer::Runner.new(ARGV,$stdin)
6
+
@@ -0,0 +1,3 @@
1
+ module SendgridCliMailer
2
+ VERSION = "0.4.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ require "sendgrid_cli_mailer/version"
2
+ require 'rubygems'
3
+ require 'commander/import'
4
+ require 'sendgrid_toolkit'
5
+
6
+ module SendgridCliMailer
7
+ class Runner
8
+ def initialize(args,stdin)
9
+ program :version, '0.1'
10
+ program :description, 'Sendgrid Ruby Mailer CLI'
11
+ default_command :mail
12
+
13
+ command :mail do |c|
14
+ c.syntax = "sg_mailer --from 'admin@yourjoint.com' --to 'hank@blinqmedia.com' --subject 'TEsting CLI' --body 'Short Body' --user 'sg@foo.com' --key '1234'"
15
+ c.summary = 'Use standard input for message body'
16
+ c.description = ''
17
+ c.example 'description', 'command example'
18
+ c.option '--from foo@exaple.com',String, 'from email'
19
+ c.option '--to foo2@example.com',String, 'to email'
20
+ c.option '--subject "Nice Subject"',String, 'email subject'
21
+ c.option '--body "Short Body"',String, 'email body'
22
+ c.option '--user nimda@co.com',String, 'sendgrid user'
23
+ c.option '--key 123123', String, 'sendgrid api key (same as web password)'
24
+ c.action do |args, options|
25
+ # Do something or c.when_called Sg_mailer::Commands::Mail
26
+ stdin_body = stdin.read if stdin.stat.size > 0
27
+ body = stdin_body || options.body || "No Message Body"
28
+ unless ( (%(user key to from subject) && options.__hash__.keys).size == 5)
29
+ SendgridToolkit::Mail.new(options.user, options.key).send_mail :to => options.to, :from => options.from,
30
+ :subject => options.subject, :text => body
31
+ else
32
+ puts "Command options incorrect! Try this:"
33
+ puts c.syntax
34
+ end
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/sendgrid_cli_mailer/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Hank Beaver"]
6
+ gem.email = ["hank.beaver@blinqmedia.com"]
7
+ gem.description = %q{Simple CLI mailer for Sendgrid via API}
8
+ gem.summary = %q{Provides a sg_mailer CLI to send mail to your Sendgrid account}
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 = "sendgrid_cli_mailer"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SendgridCliMailer::VERSION
17
+ gem.add_dependency "sendgrid_toolkit", "~>1.2"
18
+ gem.add_dependency "commander", "~> 4.1"
19
+
20
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sendgrid_cli_mailer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hank Beaver
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sendgrid_toolkit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: commander
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '4.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '4.1'
46
+ description: Simple CLI mailer for Sendgrid via API
47
+ email:
48
+ - hank.beaver@blinqmedia.com
49
+ executables:
50
+ - sg_mailer
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE
57
+ - README.md
58
+ - Rakefile
59
+ - bin/sg_mailer
60
+ - lib/sendgrid_cli_mailer.rb
61
+ - lib/sendgrid_cli_mailer/version.rb
62
+ - sendgrid_cli_mailer.gemspec
63
+ homepage: ''
64
+ licenses: []
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.23
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Provides a sg_mailer CLI to send mail to your Sendgrid account
87
+ test_files: []