Skip to content

Commit

Permalink
Upgrade release infrastructure to latest version of Jeweler, implemen…
Browse files Browse the repository at this point in the history
…t Bundler for dependency management, upgrade to rspec 2, create a .rvmrc file so that all contributors can be sure they are using the same environment.
  • Loading branch information
freerobby committed Nov 1, 2011
1 parent ee7251f commit 94cb008
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 85 deletions.
18 changes: 15 additions & 3 deletions .gitignore
@@ -1,3 +1,15 @@
pkg/ # rcov generated
doc/ coverage
.idea/*
# rdoc generated
rdoc

# yard generated
doc
.yardoc

# bundler
.bundle

# jeweler generated
pkg
3 changes: 3 additions & 0 deletions .rvmrc
@@ -0,0 +1,3 @@
export RUBYOPT="rubygems"
export RUBYLIB="."
rvm 1.9.2@sendgrid_toolkit
11 changes: 11 additions & 0 deletions Gemfile
@@ -0,0 +1,11 @@
source "http://rubygems.org"

gem "activesupport", ">= 2.3.5"
gem "httparty", ">= 0.7.6"

group :development do
gem "bundler", "~> 1.0.0"
gem "fakeweb", "~> 1.3.0"
gem "jeweler", "~> 1.6.4"
gem "rspec", "~> 2.7.0"
end
37 changes: 37 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,37 @@
GEM
remote: http://rubygems.org/
specs:
activesupport (3.1.1)
multi_json (~> 1.0)
diff-lcs (1.1.3)
fakeweb (1.3.0)
git (1.2.5)
httparty (0.8.1)
multi_json
multi_xml
jeweler (1.6.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
multi_json (1.0.3)
multi_xml (0.4.1)
rake (0.9.2.2)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)

PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 2.3.5)
bundler (~> 1.0.0)
fakeweb (~> 1.3.0)
httparty (>= 0.7.6)
jeweler (~> 1.6.4)
rspec (~> 2.7.0)
20 changes: 20 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,20 @@
Copyright (c) 2011 Robby Grossman

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -26,7 +26,13 @@ Common actions are documented below under each module. For more details, visit t
Contributing Contributing
------------ ------------


When submitting patches, please be sure you include rspec tests! * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Big thanks to [James Brennan][1] for refactoring old code and writing the Bounces, InvalidEmails and SpamReports modules. Big thanks to [James Brennan][1] for refactoring old code and writing the Bounces, InvalidEmails and SpamReports modules.


Expand Down
46 changes: 29 additions & 17 deletions Rakefile
@@ -1,22 +1,34 @@
require 'rubygems' require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake' require 'rake'


begin require 'jeweler'
require 'jeweler' Jeweler::Tasks.new do |gem|
Jeweler::Tasks.new do |gemspec| # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gemspec.name = "sendgrid_toolkit" gem.name = "sendgrid_toolkit"
gemspec.summary = "A Ruby wrapper and utility library for communicating with the Sendgrid API" gem.homepage = "http://github.com/freerobby/sendgrid_toolkit"
gemspec.description = "A Ruby wrapper and utility library for communicating with the Sendgrid API" gem.license = "MIT"
gemspec.email = "robby@freerobby.com" gem.summary = "sendgrid_toolkit = Sendgrid + Ruby"
gemspec.homepage = "http://github.com/freerobby/sendgrid_toolkit" gem.description = "A Ruby wrapper and utility library for communicating with the Sendgrid API."
gemspec.authors = ["Robby Grossman"] gem.email = "robby@freerobby.com"

gem.authors = ["Robby Grossman"]
gemspec.add_dependency "httparty" # dependencies defined in Gemfile
# Development dependencies: fakeweb, rake, jeweler, rspec
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler must be installed. Use 'sudo gem install jeweler'."
end end
Jeweler::RubygemsDotOrgTasks.new


Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each {|ext| load ext} require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "testing1213 #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
1 change: 1 addition & 0 deletions lib/sendgrid_toolkit.rb
@@ -1,3 +1,4 @@
require 'active_support/all'
require 'httparty' require 'httparty'


require 'sendgrid_toolkit/abstract_sendgrid_client' require 'sendgrid_toolkit/abstract_sendgrid_client'
Expand Down
1 change: 1 addition & 0 deletions lib/sendgrid_toolkit/statistics.rb
Expand Up @@ -2,6 +2,7 @@ module SendgridToolkit
class Statistics < AbstractSendgridClient class Statistics < AbstractSendgridClient
def retrieve(options = {}) def retrieve(options = {})
response = api_post('stats', 'get', options) response = api_post('stats', 'get', options)
response.each {|r| r['date'] = Date.parse(r['date']) if r.kind_of?(Hash) && r.has_key?('date')}
response response
end end


Expand Down
60 changes: 0 additions & 60 deletions sendgrid_toolkit.gemspec

This file was deleted.

2 changes: 1 addition & 1 deletion spec/helper.rb
@@ -1,6 +1,6 @@
require 'fakeweb' require 'fakeweb'
require 'sendgrid_toolkit' require 'sendgrid_toolkit'
require 'spec' require 'rspec'


FakeWeb.allow_net_connect = false FakeWeb.allow_net_connect = false


Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sendgrid_toolkit/abstract_sendgrid_client_spec.rb
Expand Up @@ -17,7 +17,7 @@
}.should raise_error SendgridToolkit::AuthenticationFailed }.should raise_error SendgridToolkit::AuthenticationFailed
end end
it "thows error when sendgrid response is a server error" do it "thows error when sendgrid response is a server error" do
FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/profile\.get\.json\?|, :body => 'A server error occured', :status => ['500', 'Internal Server Error']) FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/profile\.get\.json\?|, :body => '{}', :status => ['500', 'Internal Server Error'])
@obj = SendgridToolkit::AbstractSendgridClient.new("someuser", "somepass") @obj = SendgridToolkit::AbstractSendgridClient.new("someuser", "somepass")
lambda { lambda {
@obj.send(:api_post, "profile", "get", {}) @obj.send(:api_post, "profile", "get", {})
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sendgrid_toolkit/bounces_spec.rb
Expand Up @@ -42,7 +42,7 @@
}.should raise_error SendgridToolkit::EmailDoesNotExist }.should raise_error SendgridToolkit::EmailDoesNotExist
end end
it "does not choke if response does not have a 'message' field" do it "does not choke if response does not have a 'message' field" do
FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/bounces\.delete\.json\?.*email=.+|, :body => 'An internal server error occurred. Please try again later.') FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/bounces\.delete\.json\?.*email=.+|, :body => '{}')
lambda { lambda {
@obj.delete :email => "user@domain.com" @obj.delete :email => "user@domain.com"
}.should_not raise_error }.should_not raise_error
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sendgrid_toolkit/common_spec.rb
Expand Up @@ -14,7 +14,7 @@ class FakeClass < SendgridToolkit::AbstractSendgridClient
end end


it "does not choke if response does not have a 'message' field" do it "does not choke if response does not have a 'message' field" do
FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/fakeclass\.delete\.json\?.*email=.+|, :body => 'An internal server error occurred. Please try again later.') FakeWeb.register_uri(:post, %r|https://sendgrid\.com/api/fakeclass\.delete\.json\?.*email=.+|, :body => '{}')
lambda { lambda {
@fake_class.delete :email => "user@domain.com" @fake_class.delete :email => "user@domain.com"
}.should_not raise_error }.should_not raise_error
Expand Down

0 comments on commit 94cb008

Please sign in to comment.