Permalink
Browse files

modernization effort

the next step would be cleaning/rewriting the test suite
  • Loading branch information...
1 parent 6268381 commit ad8a3248c08946b17edd9ecaef54cd2bea5576a0 @jmettraux jmettraux committed Jan 24, 2012
Showing with 101 additions and 157 deletions.
  1. +6 −1 CHANGELOG.txt
  2. +14 −14 README.txt
  3. +49 −42 Rakefile
  4. +1 −1 lib/rufus/verbs/version.rb
  5. +29 −77 rufus-verbs.gemspec
  6. +1 −0 test/auth0_test.rb
  7. +1 −22 test/test.rb
View
7 CHANGELOG.txt
@@ -2,7 +2,12 @@
= rufus-verbs CHANGELOG.txt
-== rufus-verbs - 1.0.0 not yet released
+== rufus-verbs - 1.0.1 not yet released
+
+- digest auth fix, thanks Pierre 'Catwell' Chapuis
+
+
+== rufus-verbs - 1.0.0 released 2010/01/10
- Parses the response body if a parser in defined for its content-type (Dirk Geurs)
- EndPoint params merge with Request params (Dirk Geurs)
View
28 README.txt
@@ -62,14 +62,14 @@ using get(), post(), put() and delete() directly
post "http://resta.farian.server:7080/inventory/tools/0", :d => "hammer"
# passing the data via the :d (or :data) option
-
+
res = post "http://resta.farian.server:7080/inventory/tools/1" do
"sliver bullet"
end
# the data is generated by a block
puts res.code.to_i
- # 201... resource created, note that by default,
+ # 201... resource created, note that by default,
# an instance of Net::HTTPResponse is returned
puts get("http://resta.farian.server:7080/inventory/tools/0", :body => true)
@@ -102,8 +102,8 @@ using get(), post(), put() and delete() directly
Using get() and co via an EndPoint to share common options for a set of requests
ep = EndPoint.new(
- :host => "resta.farian.host",
- :port => 7080,
+ :host => "resta.farian.host",
+ :port => 7080,
:resource => "inventory/tools")
res = ep.get :id => 1
@@ -116,15 +116,15 @@ Using get() and co via an EndPoint to share common options for a set of requests
A ConditionalEndPoint is an EndPoint that will use conditional GETs whenever possible
ep = ConditionalEndPoint.new(
- :host => "resta.farian.zion",
- :port => 7080,
+ :host => "resta.farian.zion",
+ :port => 7080,
:resource => "inventory/tools")
res = ep.get :id => 1
# first call will retrieve the representation completely
res = ep.get :id => 1
- # the server (provided that it supports conditional GETs) only
+ # the server (provided that it supports conditional GETs) only
# returned a 304 answer, the response is returned from the
# ConditionalEndPoint cache
@@ -146,7 +146,7 @@ Digest authentication and basic authentication are available at request or endpo
res = get "http://server/doc0", :hba => [ "toto", "secretpass" ]
res = get(
- "http://server/doc1",
+ "http://server/doc1",
:digest_authentication => [ "toto", "secretpass" ])
The Rufus::Verbs module provides as well a <tt>fopen</tt> method, which mostly feels like the <tt>open</tt> method of open-uri.
@@ -190,8 +190,8 @@ see :http_basic_authentication for the basic HTTP authentication mechanism
* <b>:base</b> (string, RE)
the base of a resource path
- :base / :resource / :id -->
- "inventory" / "tools" / "7" -->
+ :base / :resource / :id -->
+ "inventory" / "tools" / "7" -->
"/inventory/tools/7"
* <b>:body</b> (boolean, RE)
@@ -213,7 +213,7 @@ the data (request body) for a put or a post.
* <b>:digest_authentication</b> (pair of strings, RE)
the pair username/password to be used for digest authentication.
-* <b>:dry_run</b> (boolean, RE)
+* <b>:dry_run</b> (boolean, RE)
when <tt>:dry_run => true</tt>, the request will be prepared but not executed and will be returned instead of the HTTP response (used for testing)
* <b>:fake_put</b> (boolean, RE)
@@ -225,13 +225,13 @@ the short version of :form_data
* <b>:form_data</b>
this option expects a hash. The (post or put) request body will then be built with this hash.
-* <b>:h</b> (a hash String => String, RE)
+* <b>:h</b> (a hash String => String, RE)
short for :headers
-* <b>:headers</b> (a hash String => String, RE)
+* <b>:headers</b> (a hash String => String, RE)
A Hash of additional request headers to pass
-* <b>:hba</b> (pair of strings, RE)
+* <b>:hba</b> (pair of strings, RE)
short for :http_basic_authentication
* <b>:host</b> (string, RE)
View
91 Rakefile
@@ -1,80 +1,87 @@
-
-require './lib/rufus/verbs/version.rb'
+$:.unshift('.') # 1.9.2
require 'rubygems'
+require 'rubygems/user_interaction' if Gem::RubyGemsVersion == '1.5.0'
+
require 'rake'
+require 'rake/clean'
+#require 'rake/rdoctask'
+require 'rdoc/task'
#
-# CLEAN
+# clean
-require 'rake/clean'
-CLEAN.include('pkg', 'tmp', 'html')
-task :default => [ :clean ]
+CLEAN.include('pkg', 'rdoc')
#
-# GEM
+# test / spec
-require 'jeweler'
+#task :spec => :check_dependencies do
+task :spec do
+ exec 'rspec spec/'
+end
+task :test => :spec
-Jeweler::Tasks.new do |gem|
+task :default => :spec
- gem.version = Rufus::Verbs::VERSION
- gem.name = 'rufus-verbs'
- gem.summary = 'GET, POST, PUT, DELETE, with something around'
- gem.description = %{
-GET, POST, PUT, DELETE, with something around.
+#
+# gem
-An HTTP client Ruby gem, with conditional GET, basic auth, and more.
- }
- gem.email = 'jmettraux@gmail.com'
- gem.homepage = 'http://github.com/jmettraux/rufus-verbs/'
- gem.authors = [ 'John Mettraux' ]
- gem.rubyforge_project = 'rufus'
+GEMSPEC_FILE = Dir['*.gemspec'].first
+GEMSPEC = eval(File.read(GEMSPEC_FILE))
+GEMSPEC.validate
- gem.test_file = 'test/test.rb'
- gem.add_dependency 'rufus-lru'
- gem.add_development_dependency 'yard', '>= 0'
+desc %{
+ builds the gem and places it in pkg/
+}
+task :build do
- # gemspec spec : http://www.rubygems.org/read/chapter/20
+ sh "gem build #{GEMSPEC_FILE}"
+ sh "mkdir pkg" rescue nil
+ sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
end
-Jeweler::GemcutterTasks.new
+desc %{
+ builds the gem and pushes it to rubygems.org
+}
+task :push => :build do
+
+ sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
+end
-#
-# DOC
-begin
+#
+# rdoc
+#
+# make sure to have rdoc 2.5.x to run that
- require 'yard'
+Rake::RDocTask.new do |rd|
- YARD::Rake::YardocTask.new do |doc|
- doc.options = [
- '-o', 'html/rufus-verbs', '--title',
- "rufus-verbs #{Rufus::Verbs::VERSION}"
- ]
- end
+ rd.main = 'README.txt'
+ rd.rdoc_dir = "rdoc/#{GEMSPEC.name}"
-rescue LoadError
+ rd.rdoc_files.include('README.rdoc', 'CHANGELOG.txt', 'lib/**/*.rb')
- task :yard do
- abort "YARD is not available : sudo gem install yard"
- end
+ rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
end
#
-# TO THE WEB
+# upload_rdoc
-task :upload_website => [ :clean, :yard ] do
+desc %{
+ upload the rdoc to rubyforge
+}
+task :upload_rdoc => [ :clean, :rdoc ] do
account = 'jmettraux@rubyforge.org'
webdir = '/var/www/gforge-projects/rufus'
- sh "rsync -azv -e ssh html/rufus-verbs #{account}:#{webdir}/"
+ sh "rsync -azv -e ssh rdoc/#{GEMSPEC.name} #{account}:#{webdir}/"
end
View
2 lib/rufus/verbs/version.rb
@@ -29,7 +29,7 @@ module Verbs
#
# The version of this rufus-verbs [gem]
#
- VERSION = '1.0.0'
+ VERSION = '1.0.1'
end
end
View
106 rufus-verbs.gemspec
@@ -1,87 +1,39 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
- s.name = %q{rufus-verbs}
- s.version = "1.0.0"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["John Mettraux"]
- s.date = %q{2010-01-11}
- s.description = %q{
+ s.name = 'rufus-verbs'
+
+ s.version = File.read(
+ File.expand_path('../lib/rufus/verbs/version.rb', __FILE__)
+ ).match(/ VERSION *= *['"]([^'"]+)/)[1]
+ # avoiding requiring version.rb...
+
+ s.platform = Gem::Platform::RUBY
+ s.authors = [ 'John Mettraux' ]
+ s.email = [ 'jmettraux@gmail.com' ]
+ s.homepage = 'http://github.com/jmettraux/rufus-verbs'
+ s.rubyforge_project = 'rufus'
+ s.summary = 'GET, POST, PUT, DELETE, with something around'
+
+ s.description = %{
GET, POST, PUT, DELETE, with something around.
-An HTTP client Ruby gem, with conditional GET, basic auth, and more.
- }
- s.email = %q{jmettraux@gmail.com}
- s.extra_rdoc_files = [
- "LICENSE.txt",
- "README.txt"
- ]
- s.files = [
- "CHANGELOG.txt",
- "CREDITS.txt",
- "LICENSE.txt",
- "README.txt",
- "Rakefile",
- "doc/rdoc-style.css",
- "lib/rufus-verbs.rb",
- "lib/rufus/verbs.rb",
- "lib/rufus/verbs/conditional.rb",
- "lib/rufus/verbs/cookies.rb",
- "lib/rufus/verbs/digest.rb",
- "lib/rufus/verbs/endpoint.rb",
- "lib/rufus/verbs/verbose.rb",
- "lib/rufus/verbs/version.rb",
- "rufus-verbs.gemspec",
- "test/auth0_test.rb",
- "test/auth1_test.rb",
- "test/base.rb",
- "test/block_test.rb",
- "test/bm.rb",
- "test/conditional_test.rb",
- "test/cookie0_test.rb",
- "test/cookie1_test.rb",
- "test/dryrun_test.rb",
- "test/escape_test.rb",
- "test/fopen_test.rb",
- "test/https_test.rb",
- "test/iconditional_test.rb",
- "test/items.rb",
- "test/proxy_test.rb",
- "test/redir_test.rb",
- "test/simple_test.rb",
- "test/test.htdigest",
- "test/test.rb",
- "test/timeout_test.rb",
- "test/uri_test.rb"
- ]
- s.homepage = %q{http://github.com/jmettraux/rufus-verbs/}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubyforge_project = %q{rufus}
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{GET, POST, PUT, DELETE, with something around}
- s.test_files = [
- "test/test.rb"
+A HTTP client Ruby gem, with conditional GET, basic auth, and more.
+ }.strip
+
+ #s.required_ruby_version = '>= 1.8.6'
+
+ #s.files = `git ls-files`.split("\n")
+ s.files = Dir[
+ 'Rakefile',
+ 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb',
+ '*.gemspec', '*.txt', '*.rdoc', '*.md'
]
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.add_runtime_dependency 'rufus-lru'
+
+ s.add_development_dependency 'rake'
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<rufus-lru>, [">= 0"])
- s.add_development_dependency(%q<yard>, [">= 0"])
- else
- s.add_dependency(%q<rufus-lru>, [">= 0"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
- else
- s.add_dependency(%q<rufus-lru>, [">= 0"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
+ s.require_path = 'lib'
end
View
1 test/auth0_test.rb
@@ -41,3 +41,4 @@ def test_0
:http_basic_authentication => [ "toto", "toto" ])
end
end
+
View
23 test/test.rb
@@ -1,24 +1,3 @@
-#require 'dryrun_test'
-#require 'iconditional_test'
-#require 'simple_test'
-#require 'auth0_test'
-#require 'auth1_test'
-#require 'redir_test'
-#require 'block_test'
-#require 'https_test'
-#require 'proxy_test'
-#require 'conditional_test'
-#require 'cookie0_test'
-#require 'cookie1_test'
-#require 'escape_test'
-#require 'uri_test'
-#require 'fopen_test'
-#require 'timeout_test'
-
-dirpath = File.dirname(__FILE__)
-
-tests = Dir.new(dirpath).entries.select { |e| e.match(/\_test\.rb$/) }.sort
-
-tests.each { |t| load "#{dirpath}/#{t}" }
+Dir[File.expand_path("../*_test.rb", __FILE__)].each { |path| load(path) }

0 comments on commit ad8a324

Please sign in to comment.