Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New build system and rspec upgrade

Now using bundler to manage dependencies, 
rake-compiler to build the extension and rspec
has been upgrade to version 2.3.
  • Loading branch information...
commit 4309062036b8ef86d3eae64b63e1cdf927c122e0 1 parent 9de9336
@toland authored
View
0  .rspec
No changes.
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm gemset use patron
View
2  Gemfile
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
31 Gemfile.lock
@@ -0,0 +1,31 @@
+PATH
+ remote: .
+ specs:
+ patron (0.4.10)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.2)
+ rake (0.8.7)
+ rake-compiler (0.7.5)
+ rake
+ rcov (0.9.9)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (>= 1.0.0)
+ patron!
+ rake-compiler (~> 0.7.5)
+ rcov (~> 0.9.9)
+ rspec (~> 2.3.0)
View
95 Rakefile
@@ -21,73 +21,22 @@
## THE SOFTWARE.
##
## -------------------------------------------------------------------
-require 'yaml'
require 'rake/clean'
require 'rake/rdoctask'
-require 'spec/rake/spectask'
-require 'jeweler'
-require 'yard'
-
-require 'rbconfig'
-include Config
-
-EXT_DIR = 'ext/patron'
-SESSION_SO = "#{EXT_DIR}/session_ext.#{CONFIG['DLEXT']}"
-SESSION_SRC = "#{EXT_DIR}/session_ext.c"
-
-CLEAN.include FileList["#{EXT_DIR}/*"].exclude(/^.*\.(rb|c)$/)
-CLOBBER.include %w( doc coverage pkg )
-
-module Git
- class Lib
- def tag(tag)
- # Force an annotated tag
- command('tag', [tag, '-a', '-m', tag])
- end
- end
-end
-
-Jeweler::Tasks.new do |s|
- s.name = 'patron'
- s.platform = Gem::Platform::RUBY
- s.author = 'Phillip Toland'
- s.email = 'phil.toland@gmail.com'
- s.homepage = 'http://github.com/toland/Patron'
- s.rubyforge_project = 'patron'
- s.summary = 'Patron HTTP client'
- s.description = 'Ruby HTTP client library based on libcurl'
-
- s.extensions << 'ext/patron/extconf.rb'
- s.require_paths << 'ext'
-
- s.files = FileList['README.txt',
- 'VERSION.yml',
- 'LICENSE',
- 'Rakefile',
- 'lib/**/*',
- 'spec/*',
- 'ext/patron/*.{rb,c}']
-
- # rdoc
- s.has_rdoc = true
- s.extra_rdoc_files = ['README.txt']
- s.rdoc_options = ['--quiet',
- '--title', "Patron documentation",
- '--opname', 'index.html',
- '--line-numbers',
- '--main', 'README.txt',
- '--inline-source']
+require 'rake/extensiontask'
+require 'rspec/core/rake_task'
+require 'bundler'
+
+Rake::ExtensionTask.new do |ext|
+ ext.name = 'session_ext' # indicate the name of the extension.
+ ext.ext_dir = 'ext/patron' # search for 'hello_world' inside it.
+ ext.lib_dir = 'lib/patron' # put binaries into this folder.
end
-file SESSION_SO => SESSION_SRC do
- cd EXT_DIR do
- ruby 'extconf.rb'
- sh 'make'
- end
-end
+Bundler::GemHelper.install_tasks
-desc "Compile extension"
-task :compile => SESSION_SO
+CLEAN.include FileList["ext/patron/*"].exclude(/^.*\.(rb|c)$/)
+CLOBBER.include %w( doc coverage pkg )
desc "Start an IRB shell"
task :shell => :compile do
@@ -98,33 +47,23 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Patron documentation'
rdoc.main = 'README.txt'
- rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.txt')
rdoc.rdoc_files.include('lib/**/*.rb')
end
-YARD::Rake::YardocTask.new do |t|
- t.files = ['lib/**/*.rb']
- t.options = ['--readme', 'README.txt']
-end
-
desc "Run specs"
-Spec::Rake::SpecTask.new(:spec) do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/**/*_spec.rb']
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = %w( --colour --format progress )
+ t.pattern = 'spec/**/*_spec.rb'
end
task :spec => [:compile]
desc "Run specs with RCov"
-Spec::Rake::SpecTask.new('spec:rcov') do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
+RSpec::Core::RakeTask.new('spec:rcov') do |t|
+ t.pattern = 'spec/**/*_spec.rb'
t.rcov = true
- t.rcov_opts << '--sort coverage'
- t.rcov_opts << '--comments'
- t.rcov_opts << '--exclude spec'
- t.rcov_opts << '--exclude lib/magneto.rb'
- t.rcov_opts << '--exclude /Library/Ruby/Gems'
+ t.rcov_opts = %q(--sort coverage --comments --exclude "spec")
end
task :default => :spec
View
5 VERSION.yml
@@ -1,5 +0,0 @@
----
-:major: 0
-:minor: 4
-:patch: 10
-:build:
View
8 lib/patron.rb
@@ -22,7 +22,6 @@
## THE SOFTWARE.
##
## -------------------------------------------------------------------
-require 'yaml'
require 'pathname'
cwd = Pathname(__FILE__).dirname
@@ -33,11 +32,6 @@
module Patron #:nodoc:
# Returns the version number of the Patron library as a string
def self.version
- cwd = Pathname(__FILE__).dirname.expand_path.to_s
- yaml = YAML.load_file(cwd + '/../VERSION.yml')
- major = (yaml['major'] || yaml[:major]).to_i
- minor = (yaml['minor'] || yaml[:minor]).to_i
- patch = (yaml['patch'] || yaml[:patch]).to_i
- "#{major}.#{minor}.#{patch}"
+ VERSION
end
end
View
3  lib/patron/version.rb
@@ -0,0 +1,3 @@
+module Patron
+ VERSION = "0.4.10"
+end
View
74 patron.gemspec
@@ -1,63 +1,27 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+require File.expand_path("../lib/patron/version", __FILE__)
Gem::Specification.new do |s|
- s.name = %q{patron}
- s.version = "0.4.10"
+ s.name = "patron"
+ s.version = Patron::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Phillip Toland"]
+ s.email = ["phil.toland@gmail.com"]
+ s.homepage = "https://github.com/toland/patron"
+ s.summary = "Patron HTTP Client"
+ s.description = "Ruby HTTP client library based on libcurl"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Phillip Toland"]
- s.date = %q{2010-11-06}
- s.description = %q{Ruby HTTP client library based on libcurl}
- s.email = %q{phil.toland@gmail.com}
- s.extensions = ["ext/patron/extconf.rb", "ext/patron/extconf.rb"]
- s.extra_rdoc_files = [
- "README.txt"
- ]
- s.files = [
- "LICENSE",
- "README.txt",
- "Rakefile",
- "VERSION.yml",
- "ext/patron/extconf.rb",
- "ext/patron/session_ext.c",
- "lib/patron.rb",
- "lib/patron/error.rb",
- "lib/patron/proxy_type.rb",
- "lib/patron/request.rb",
- "lib/patron/response.rb",
- "lib/patron/session.rb",
- "spec/patron_spec.rb",
- "spec/request_spec.rb",
- "spec/response_spec.rb",
- "spec/session_spec.rb",
- "spec/spec.opts",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://github.com/toland/Patron}
- s.rdoc_options = ["--quiet", "--title", "Patron documentation", "--opname", "index.html", "--line-numbers", "--main", "README.txt", "--inline-source"]
- s.require_paths = ["lib", "ext", "ext"]
- s.rubyforge_project = %q{patron}
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Patron HTTP client}
- s.test_files = [
- "spec/patron_spec.rb",
- "spec/request_spec.rb",
- "spec/response_spec.rb",
- "spec/session_spec.rb",
- "spec/spec_helper.rb"
- ]
+ s.required_rubygems_version = ">= 1.3.6"
+ s.rubyforge_project = "patron"
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.add_development_dependency "bundler", ">= 1.0.0"
+ s.add_development_dependency "rake-compiler", "~> 0.7.5"
+ s.add_development_dependency "rspec", "~> 2.3.0"
+ s.add_development_dependency "rcov", "~> 0.9.9"
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
+ s.files = `git ls-files`.split("\n")
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
+ s.require_paths = ["lib", "ext"]
+ s.extensions = ["ext/patron/extconf.rb"]
end
View
24 spec/session_spec.rb
@@ -142,7 +142,7 @@
end
it "should upload a file with :put" do
- response = @session.put_file("/test", "VERSION.yml")
+ response = @session.put_file("/test", "LICENSE")
body = YAML::load(response.body)
body.request_method.should == "PUT"
end
@@ -152,7 +152,7 @@
end
it "should use chunked encoding when uploading a file with :put" do
- response = @session.put_file("/test", "VERSION.yml")
+ response = @session.put_file("/test", "LICENSE")
body = YAML::load(response.body)
body.header['transfer-encoding'].first.should == "chunked"
end
@@ -170,15 +170,15 @@
end
it "should upload a file with :post" do
- response = @session.post_file("/test", "VERSION.yml")
+ response = @session.post_file("/test", "LICENSE")
body = YAML::load(response.body)
body.request_method.should == "POST"
end
-
+
it "should upload a multipart with :post" do
- response = @session.post_multipart("/test", { :test_data => "123" }, { :test_file => "VERSION.yml" } )
+ response = @session.post_multipart("/test", { :test_data => "123" }, { :test_file => "LICENSE" } )
body = YAML::load(response.body)
- body.request_method.should == "POST"
+ body.request_method.should == "POST"
end
it "should raise when no file is provided to :post" do
@@ -186,7 +186,7 @@
end
it "should use chunked encoding when uploading a file with :post" do
- response = @session.post_file("/test", "VERSION.yml")
+ response = @session.post_file("/test", "LICENSE")
body = YAML::load(response.body)
body.header['transfer-encoding'].first.should == "chunked"
end
@@ -220,17 +220,17 @@
threads << Thread.new do
session = Patron::Session.new
session.base_url = "http://localhost:9001"
- session.post_file("/test", "VERSION.yml")
+ session.post_file("/test", "LICENSE")
end
end
threads.each {|t| t.join }
end
it "should limit the buffer_size" do
- # Buffer size is tricky to test, as it only affects the buffer size for each
- # read and it's not really visible at this, higher level. It's also only a
- # suggestion rather than a command so it may not even take affect. Currently
- # we just test that the response completes without any issues, it would be nice
+ # Buffer size is tricky to test, as it only affects the buffer size for each
+ # read and it's not really visible at this, higher level. It's also only a
+ # suggestion rather than a command so it may not even take affect. Currently
+ # we just test that the response completes without any issues, it would be nice
# to have a more robust test here.
@session.buffer_size = 1
View
6 spec/spec.opts
@@ -1,6 +0,0 @@
---colour
---format
-progress
---loadby
-mtime
---reverse
View
10 spec/spec_helper.rb
@@ -21,15 +21,7 @@
## THE SOFTWARE.
##
## -------------------------------------------------------------------
-require 'test/unit'
-
-begin
- require 'spec'
-rescue LoadError
- require 'rubygems'
- gem 'rspec'
- require 'spec'
-end
+require 'rspec'
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../ext')
Please sign in to comment.
Something went wrong with that request. Please try again.