sendgrid_cli_mailer 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,11 +25,11 @@ Or install it yourself as:
25
25
 
26
26
  You can send a message with a body specified via arguments:
27
27
 
28
- sg_mailer --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --body 'Short Body' --user 'sg@foo.com' --key '1234'"
28
+ sg_mailer mail --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --body 'Short Body' --user 'sg@foo.com' --key '1234'"
29
29
 
30
30
  Or use STDOUT/Redirection to send a message body:
31
31
 
32
- cat /some/file | sg_mailer --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --user 'sg@foo.com' --key '1234'"
32
+ cat /some/file | sg_mailer mail --from 'admin@yourjoint.com' --to 'hank@me.com' --subject 'Testing CLI' --user 'sg@foo.com' --key '1234'"
33
33
 
34
34
  NOTE: if you supply both the STDIN will win.
35
35
 
data/bin/sg_cli ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ require 'sendgrid_toolkit'
3
+ require "thor"
4
+
5
+
6
+ class SendgridCliMailerCommand < Thor
7
+ desc "mail", "Sends an email via SendGrid API"
8
+ method_option :user, :aliases => "-u", :desc => "SendGrid API User", :required => true
9
+ method_option :key, :aliases => "-k", :desc => "SendGrid API key", :required => true
10
+ method_option :to, :aliases => "-t", :desc => "Email 'to' address", :required => true
11
+ method_option :from, :aliases => "-f", :desc => "Email 'from' address", :required => true
12
+ method_option :subject, :aliases => "-s", :desc => "Email 'subject'", :required => true
13
+ method_option :body, :aliases => "-b", :desc => "Email 'body'", :required => false
14
+ def mail
15
+ stdin_body = $stdin.read if $stdin.stat.size > 0
16
+ body = stdin_body || options.body || "No Message Body"
17
+ SendgridToolkit::Mail.new(options[:user], options[:key]).send_mail :to => options[:to], :from => options[:from],
18
+ :subject => options[:subject], :text => body
19
+ end
20
+ end
21
+ SendgridCliMailerCommand.start()
22
+
@@ -1,3 +1,3 @@
1
1
  module SendgridCliMailer
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -3,10 +3,10 @@ require File.expand_path('../lib/sendgrid_cli_mailer/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Hank Beaver"]
6
- gem.email = ["hank.beaver@blinqmedia.com"]
6
+ gem.email = ["hbeaver@gmail.com"]
7
7
  gem.description = %q{Simple CLI mailer for Sendgrid via API}
8
8
  gem.summary = %q{Provides a sg_mailer CLI to send mail to your Sendgrid account}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/blasterpal/sendgrid_cli_mailer"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = SendgridCliMailer::VERSION
17
17
  gem.add_dependency "sendgrid_toolkit", "~>1.2"
18
- gem.add_dependency "commander", "~> 4.1"
18
+ gem.add_dependency "thor" , "~> 0.16.0"
19
19
 
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid_cli_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-10 00:00:00.000000000 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sendgrid_toolkit
@@ -28,13 +28,13 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.2'
30
30
  - !ruby/object:Gem::Dependency
31
- name: commander
31
+ name: thor
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '4.1'
37
+ version: 0.16.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '4.1'
45
+ version: 0.16.0
46
46
  description: Simple CLI mailer for Sendgrid via API
47
47
  email:
48
- - hank.beaver@blinqmedia.com
48
+ - hbeaver@gmail.com
49
49
  executables:
50
- - sg_mailer
50
+ - sg_cli
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
@@ -56,11 +56,10 @@ files:
56
56
  - LICENSE
57
57
  - README.md
58
58
  - Rakefile
59
- - bin/sg_mailer
60
- - lib/sendgrid_cli_mailer.rb
59
+ - bin/sg_cli
61
60
  - lib/sendgrid_cli_mailer/version.rb
62
61
  - sendgrid_cli_mailer.gemspec
63
- homepage: ''
62
+ homepage: https://github.com/blasterpal/sendgrid_cli_mailer
64
63
  licenses: []
65
64
  post_install_message:
66
65
  rdoc_options: []
data/bin/sg_mailer DELETED
@@ -1,6 +0,0 @@
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
-
@@ -1,40 +0,0 @@
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