Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

turn into a gem

  • Loading branch information...
commit b3e767e3e3f079a3c77f3e4f908e9388ea56b068 1 parent 10f708c
Terence Lee authored
4 Gemfile
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in heroku-sendgrid-test-email.gemspec
+gemspec
2  Rakefile
View
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
23 heroku-sendgrid-test-email.gemspec
View
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "heroku-sendgrid-test-email/version"
+
+Gem::Specification.new do |s|
+ s.name = "heroku-sendgrid-test-email"
+ s.version = Heroku::Command::Sendgrid::TestEmail::VERSION
+ s.authors = ["Terence Lee"]
+ s.email = ["hone02@gmail.com"]
+ s.homepage = ""
+ s.summary = %q{Heroku plugin to test sendgrid addon}
+ s.description = %q{Heroku plugin to test sendgrid addon}
+
+ s.rubyforge_project = "heroku-sendgrid-test-email"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_dependency "heroku", "~> 2.0.0"
+ s.add_development_dependency "rake"
+end
22 init.rb
View
@@ -1,21 +1 @@
-class Heroku::Command::Sendgrid < Heroku::Command::Base
- def test_email
- app = extract_app
- vars = heroku.config_vars(app)
- to = ''
- args.each do |arg|
- key, value = arg.split("=")
- to = value if key == "to"
- end
-
- if to.empty?
- error "please specify an address to send to using to=<me@example.com>"
- else
- resource = RestClient::Resource.new("https://pony-mail-test.heroku.com")
- display resource["/mail"].post(:sendgrid_username => vars["SENDGRID_USERNAME"],
- :sendgrid_password => vars["SENDGRID_PASSWORD"],
- :sendgrid_domain => vars["SENDGRID_DOMAIN"],
- :to => to)
- end
- end
-end
+require 'heroku-sendgrid-test-email'
1  lib/heroku-sendgrid-test-email.rb
View
@@ -0,0 +1 @@
+require 'heroku-sendgrid-test-email/command/sendgrid'
23 lib/heroku-sendgrid-test-email/command/sendgrid.rb
View
@@ -0,0 +1,23 @@
+require 'heroku/command/base'
+
+class Heroku::Command::Sendgrid < Heroku::Command::Base
+ def test_email
+ app = extract_app
+ vars = heroku.config_vars(app)
+ to = ''
+ args.each do |arg|
+ key, value = arg.split("=")
+ to = value if key == "to"
+ end
+
+ if to.empty?
+ error "please specify an address to send to using to=<me@example.com>"
+ else
+ resource = RestClient::Resource.new("https://pony-mail-test.heroku.com")
+ display resource["/mail"].post(:sendgrid_username => vars["SENDGRID_USERNAME"],
+ :sendgrid_password => vars["SENDGRID_PASSWORD"],
+ :sendgrid_domain => vars["SENDGRID_DOMAIN"],
+ :to => to)
+ end
+ end
+end
9 lib/heroku-sendgrid-test-email/version.rb
View
@@ -0,0 +1,9 @@
+module Heroku
+ module Command
+ module Sendgrid
+ module TestEmail
+ VERSION = "0.0.1"
+ end
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.