Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade release infrastructure to latest version of Jeweler, implemen…

…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...
commit 94cb0084ecf0eae442cee7054ae6c51c98a1f349 1 parent ee7251f
@freerobby authored
View
18 .gitignore
@@ -1,3 +1,15 @@
-pkg/
-doc/
-.idea/*
+# rcov generated
+coverage
+
+# rdoc generated
+rdoc
+
+# yard generated
+doc
+.yardoc
+
+# bundler
+.bundle
+
+# jeweler generated
+pkg
View
3  .rvmrc
@@ -0,0 +1,3 @@
+export RUBYOPT="rubygems"
+export RUBYLIB="."
+rvm 1.9.2@sendgrid_toolkit
View
11 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
View
37 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)
View
20 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.
View
8 README.md
@@ -26,7 +26,13 @@ Common actions are documented below under each module. For more details, visit t
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.
View
46 Rakefile
@@ -1,22 +1,34 @@
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'
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gemspec|
- gemspec.name = "sendgrid_toolkit"
- gemspec.summary = "A Ruby wrapper and utility library for communicating with the Sendgrid API"
- gemspec.description = "A Ruby wrapper and utility library for communicating with the Sendgrid API"
- gemspec.email = "robby@freerobby.com"
- gemspec.homepage = "http://github.com/freerobby/sendgrid_toolkit"
- gemspec.authors = ["Robby Grossman"]
-
- gemspec.add_dependency "httparty"
- # Development dependencies: fakeweb, rake, jeweler, rspec
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler must be installed. Use 'sudo gem install jeweler'."
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "sendgrid_toolkit"
+ gem.homepage = "http://github.com/freerobby/sendgrid_toolkit"
+ gem.license = "MIT"
+ gem.summary = "sendgrid_toolkit = Sendgrid + Ruby"
+ gem.description = "A Ruby wrapper and utility library for communicating with the Sendgrid API."
+ gem.email = "robby@freerobby.com"
+ gem.authors = ["Robby Grossman"]
+ # dependencies defined in Gemfile
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
View
1  lib/sendgrid_toolkit.rb
@@ -1,3 +1,4 @@
+require 'active_support/all'
require 'httparty'
require 'sendgrid_toolkit/abstract_sendgrid_client'
View
1  lib/sendgrid_toolkit/statistics.rb
@@ -2,6 +2,7 @@ module SendgridToolkit
class Statistics < AbstractSendgridClient
def retrieve(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
end
View
60 sendgrid_toolkit.gemspec
@@ -1,60 +0,0 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{sendgrid_toolkit}
- s.version = "1.0.5"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = [%q{Robby Grossman}]
- s.date = %q{2011-09-19}
- s.description = %q{A Ruby wrapper and utility library for communicating with the Sendgrid API}
- s.email = %q{robby@freerobby.com}
- s.extra_rdoc_files = [
- "README.md"
- ]
- s.files = [
- "README.md",
- "Rakefile",
- "VERSION",
- "lib/sendgrid_toolkit.rb",
- "lib/sendgrid_toolkit/abstract_sendgrid_client.rb",
- "lib/sendgrid_toolkit/bounces.rb",
- "lib/sendgrid_toolkit/common.rb",
- "lib/sendgrid_toolkit/invalid_emails.rb",
- "lib/sendgrid_toolkit/sendgrid_error.rb",
- "lib/sendgrid_toolkit/spam_reports.rb",
- "lib/sendgrid_toolkit/statistics.rb",
- "lib/sendgrid_toolkit/unsubscribes.rb",
- "sendgrid_toolkit.gemspec",
- "spec/helper.rb",
- "spec/lib/sendgrid_toolkit/abstract_sendgrid_client_spec.rb",
- "spec/lib/sendgrid_toolkit/bounces_spec.rb",
- "spec/lib/sendgrid_toolkit/common_spec.rb",
- "spec/lib/sendgrid_toolkit/invalid_emails_spec.rb",
- "spec/lib/sendgrid_toolkit/spam_reports_spec.rb",
- "spec/lib/sendgrid_toolkit/statistics_spec.rb",
- "spec/lib/sendgrid_toolkit/unsubscribes_spec.rb",
- "spec/lib/sendgrid_toolkit_spec.rb",
- "spec/webconnect/sendgrid_toolkit_spec.rb"
- ]
- s.homepage = %q{http://github.com/freerobby/sendgrid_toolkit}
- s.require_paths = [%q{lib}]
- s.rubygems_version = %q{1.8.6}
- s.summary = %q{A Ruby wrapper and utility library for communicating with the Sendgrid API}
-
- if s.respond_to? :specification_version then
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<httparty>, [">= 0"])
- else
- s.add_dependency(%q<httparty>, [">= 0"])
- end
- else
- s.add_dependency(%q<httparty>, [">= 0"])
- end
-end
-
View
2  spec/helper.rb
@@ -1,6 +1,6 @@
require 'fakeweb'
require 'sendgrid_toolkit'
-require 'spec'
+require 'rspec'
FakeWeb.allow_net_connect = false
View
2  spec/lib/sendgrid_toolkit/abstract_sendgrid_client_spec.rb
@@ -17,7 +17,7 @@
}.should raise_error SendgridToolkit::AuthenticationFailed
end
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")
lambda {
@obj.send(:api_post, "profile", "get", {})
View
2  spec/lib/sendgrid_toolkit/bounces_spec.rb
@@ -42,7 +42,7 @@
}.should raise_error SendgridToolkit::EmailDoesNotExist
end
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 {
@obj.delete :email => "user@domain.com"
}.should_not raise_error
View
2  spec/lib/sendgrid_toolkit/common_spec.rb
@@ -14,7 +14,7 @@ class FakeClass < SendgridToolkit::AbstractSendgridClient
end
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 {
@fake_class.delete :email => "user@domain.com"
}.should_not raise_error
Please sign in to comment.
Something went wrong with that request. Please try again.