Skip to content

Commit

Permalink
Use jeweler to manage the gemspec and version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Toland committed Jan 16, 2009
1 parent d3c689f commit 9f5c447
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 42 deletions.
45 changes: 14 additions & 31 deletions Rakefile
@@ -1,12 +1,8 @@
require 'pathname'
require 'rubygems'
require 'rake'
require 'yaml'
require 'rake/clean'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'spec'
require 'spec/rake/spectask'
require Pathname('lib/patron/version')
require 'jeweler'

require 'rbconfig'
include Config
Expand All @@ -18,22 +14,8 @@ SESSION_SRC = "#{EXT_DIR}/session_ext.c"
CLEAN.include FileList["#{EXT_DIR}/*"].exclude(/^.*\.(rb|c)$/)
CLOBBER.include %w( doc coverage pkg )

desc "Compile extension"
task :compile => SESSION_SO

file SESSION_SO => SESSION_SRC do
cd EXT_DIR do
ruby 'extconf.rb'
sh 'make'
end
end


RDOC_TITLE = "Patron #{Patron::VERSION::STRING} documentation"

spec = Gem::Specification.new do |s|
Jeweler::Tasks.new do |s|
s.name = 'patron'
s.version = Patron::VERSION::STRING
s.platform = Gem::Platform::RUBY
s.author = 'Phillip Toland'
s.email = 'ptoland@thehive.com'
Expand All @@ -55,25 +37,26 @@ spec = Gem::Specification.new do |s|
# rdoc
s.has_rdoc = true
s.extra_rdoc_files = ['README.txt', 'History.txt']
s.rdoc_options = ['--quiet',
'--title', RDOC_TITLE,
s.rdoc_options = ['--quiet',
'--title', "Patron documentation",
'--opname', 'index.html',
'--line-numbers',
'--main', 'README.txt',
'--inline-source']

# Dependencies
# s.add_dependency 'gemname', '>= version'
s.add_dependency 'technicalpickles-jeweler', '>= 0.6.5'
end

Rake::GemPackageTask.new(spec) do |package|
package.gem_spec = spec
file SESSION_SO => SESSION_SRC do
cd EXT_DIR do
ruby 'extconf.rb'
sh 'make'
end
end

desc 'Build and install the gem'
task :install => :gem do
sh "sudo gem install pkg/patron-#{Patron::VERSION::STRING}.gem"
end
desc "Compile extension"
task :compile => SESSION_SO

desc "Start an IRB shell"
task :shell => :compile do
Expand All @@ -82,7 +65,7 @@ end

Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = RDOC_TITLE
rdoc.title = "Patron documentation"
rdoc.main = 'README.txt'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.txt')
Expand Down
4 changes: 4 additions & 0 deletions VERSION.yml
@@ -0,0 +1,4 @@
---
:patch: 0
:major: 0
:minor: 1
6 changes: 4 additions & 2 deletions lib/patron.rb
@@ -1,14 +1,16 @@
require 'rubygems'
require 'yaml'
require 'jeweler'
require 'pathname'

cwd = Pathname(__FILE__).dirname
$:.unshift(cwd) unless $:.include?(cwd) || $:.include?(cwd.expand_path)

require 'patron/version'
require 'patron/session'

module Patron #:nodoc:
# Returns the version number of the Patron library as a string
def self.version
Patron::VERSION::STRING
Jeweler::Version.new(File.dirname(__FILE__) + '/../').to_s
end
end
9 changes: 0 additions & 9 deletions lib/patron/version.rb

This file was deleted.

33 changes: 33 additions & 0 deletions patron.gemspec
@@ -0,0 +1,33 @@
Gem::Specification.new do |s|
s.name = %q{patron}
s.version = "1.0.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Phillip Toland"]
s.date = %q{2009-01-16}
s.description = %q{Ruby HTTP client library based on libcurl}
s.email = %q{ptoland@thehive.com}
s.extensions = ["ext/patron/extconf.rb"]
s.extra_rdoc_files = ["README.txt", "History.txt"]
s.files = ["README.txt", "History.txt", "Rakefile", "lib/patron", "lib/patron/error.rb", "lib/patron/request.rb", "lib/patron/response.rb", "lib/patron/session.rb", "lib/patron.rb", "spec/integration", "spec/spec.opts", "spec/spec_helper.rb", "spec/unit", "ext/patron/extconf.rb", "ext/patron/session_ext.c"]
s.has_rdoc = true
s.homepage = %q{http://www.thehive.com/}
s.rdoc_options = ["--quiet", "--title", "Patron documentation", "--opname", "index.html", "--line-numbers", "--main", "README.txt", "--inline-source"]
s.require_paths = ["liblibext"]
s.rubyforge_project = %q{patron}
s.rubygems_version = %q{1.2.0}
s.summary = %q{Ruby HTTP client library based on libcurl}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if current_version >= 3 then
s.add_runtime_dependency(%q<technicalpickles-jeweler>, [">= 0.6.5"])
else
s.add_dependency(%q<technicalpickles-jeweler>, [">= 0.6.5"])
end
else
s.add_dependency(%q<technicalpickles-jeweler>, [">= 0.6.5"])
end
end

0 comments on commit 9f5c447

Please sign in to comment.