Permalink
Browse files

indent = 2 and some refinements

  • Loading branch information...
1 parent 82d2788 commit cdac99b50d0306a661b5fb1ca66a89a795233de9 @jmettraux jmettraux committed Jul 18, 2008
Showing with 1,089 additions and 1,088 deletions.
  1. +57 −57 Rakefile
  2. +65 −65 lib/rufus/verbs.rb
  3. +77 −77 lib/rufus/verbs/conditional.rb
  4. +210 −210 lib/rufus/verbs/cookies.rb
  5. +170 −170 lib/rufus/verbs/digest.rb
  6. +455 −454 lib/rufus/verbs/endpoint.rb
  7. +51 −51 lib/rufus/verbs/verbose.rb
  8. +4 −4 lib/rufus/verbs/version.rb
View
114 Rakefile
@@ -15,30 +15,30 @@ require 'lib/rufus/verbs/version' # Rufus::Verbs::VERSION
spec = Gem::Specification.new do |s|
- s.name = "rufus-verbs"
- s.version = Rufus::Verbs::VERSION
- s.authors = [ "John Mettraux" ]
- s.email = "john at openwfe dot org"
- s.homepage = "http://rufus.rubyforge.org/rufus-verbs"
- s.platform = Gem::Platform::RUBY
- s.summary = "GET, POST, PUT, DELETE, with something around"
- #s.license = "MIT"
-
- s.require_path = "lib"
- #s.autorequire = "rufus-verbs"
- s.test_file = "test/test.rb"
- s.has_rdoc = true
- s.extra_rdoc_files = [ 'README.txt' ]
-
- [ 'rufus-lru' ].each do |d|
- s.requirements << d
- s.add_dependency d
- end
-
- files = FileList[ "{bin,docs,lib,test}/**/*" ]
- files.exclude "rdoc"
- files.exclude "extras"
- s.files = files.to_a
+ s.name = "rufus-verbs"
+ s.version = Rufus::Verbs::VERSION
+ s.authors = [ "John Mettraux" ]
+ s.email = "john at openwfe dot org"
+ s.homepage = "http://rufus.rubyforge.org/rufus-verbs"
+ s.platform = Gem::Platform::RUBY
+ s.summary = "GET, POST, PUT, DELETE, with something around"
+ #s.license = "MIT"
+
+ s.require_path = "lib"
+ #s.autorequire = "rufus-verbs"
+ s.test_file = "test/test.rb"
+ s.has_rdoc = true
+ s.extra_rdoc_files = [ 'README.txt' ]
+
+ [ 'rufus-lru' ].each do |d|
+ s.requirements << d
+ s.add_dependency d
+ end
+
+ files = FileList[ "{bin,docs,lib,test}/**/*" ]
+ files.exclude "rdoc"
+ files.exclude "extras"
+ s.files = files.to_a
end
#
@@ -53,32 +53,32 @@ task :default => [ :clean, :repackage ]
# TESTING
Rake::TestTask.new(:test) do |t|
- t.libs << "test"
- t.test_files = FileList['test/test.rb']
- t.verbose = true
+ t.libs << "test"
+ t.test_files = FileList['test/test.rb']
+ t.verbose = true
end
#
# PACKAGING
Rake::GemPackageTask.new(spec) do |pkg|
- #pkg.need_tar = true
+ #pkg.need_tar = true
end
Rake::PackageTask.new("rufus-verbs", Rufus::Verbs::VERSION) do |pkg|
- pkg.need_zip = true
- pkg.package_files = FileList[
- "Rakefile",
- "*.txt",
- "lib/**/*",
- "test/**/*"
- ].to_a
- #pkg.package_files.delete("MISC.txt")
- class << pkg
- def package_name
- "#{@name}-#{@version}-src"
- end
+ pkg.need_zip = true
+ pkg.package_files = FileList[
+ "Rakefile",
+ "*.txt",
+ "lib/**/*",
+ "test/**/*"
+ ].to_a
+ #pkg.package_files.delete("MISC.txt")
+ class << pkg
+ def package_name
+ "#{@name}-#{@version}-src"
end
+ end
end
#
@@ -89,23 +89,23 @@ ALLISON="/Library/Ruby/Gems/1.8/gems/allison-2.0.3/lib/allison.rb"
Rake::RDocTask.new do |rd|
- rd.main = "README.txt"
+ rd.main = "README.txt"
- rd.rdoc_dir = "html/rufus-verbs"
+ rd.rdoc_dir = "html/rufus-verbs"
- rd.rdoc_files.include(
- "README.txt",
- "CHANGELOG.txt",
- "LICENSE.txt",
- "CREDITS.txt",
- "lib/**/*.rb")
+ rd.rdoc_files.include(
+ "README.txt",
+ "CHANGELOG.txt",
+ "LICENSE.txt",
+ "CREDITS.txt",
+ "lib/**/*.rb")
- rd.title = "rufus-verbs rdoc"
+ rd.title = "rufus-verbs rdoc"
- rd.options << '-N' # line numbers
- rd.options << '-S' # inline source
+ rd.options << '-N' # line numbers
+ rd.options << '-S' # inline source
- rd.template = ALLISON if File.exist?(ALLISON)
+ rd.template = ALLISON if File.exist?(ALLISON)
end
@@ -114,12 +114,12 @@ end
task :upload_website => [ :clean, :rdoc ] do
- account = "jmettraux@rubyforge.org"
- webdir = "/var/www/gforge-projects/rufus"
+ 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 html/rufus-verbs #{account}:#{webdir}/"
- sh "mv html/rufus-verbs html/rufus_verbs"
- sh "rsync -azv -e ssh html/rufus_verbs #{account}:#{webdir}/"
+ sh "mv html/rufus-verbs html/rufus_verbs"
+ sh "rsync -azv -e ssh html/rufus_verbs #{account}:#{webdir}/"
end
View
@@ -39,94 +39,94 @@
module Rufus::Verbs
- #
- # GET
- #
- def get (*args)
+ #
+ # GET
+ #
+ def get (*args)
- EndPoint.request :get, args
- end
-
- #
- # POST
- #
- def post (*args, &block)
+ EndPoint.request :get, args
+ end
- EndPoint.request :post, args, &block
- end
+ #
+ # POST
+ #
+ def post (*args, &block)
- #
- # PUT
- #
- def put (*args, &block)
+ EndPoint.request :post, args, &block
+ end
- EndPoint.request :put, args, &block
- end
+ #
+ # PUT
+ #
+ def put (*args, &block)
- #
- # DELETE
- #
- def delete (*args)
+ EndPoint.request :put, args, &block
+ end
- EndPoint.request :delete, args
- end
+ #
+ # DELETE
+ #
+ def delete (*args)
- #
- # HEAD
- #
- def head (*args)
+ EndPoint.request :delete, args
+ end
- EndPoint.request :head, args
- end
+ #
+ # HEAD
+ #
+ def head (*args)
- #
- # OPTIONS
- #
- def options (*args)
+ EndPoint.request :head, args
+ end
- EndPoint.request :options, args
- end
+ #
+ # OPTIONS
+ #
+ def options (*args)
- #
- # Opens a file or a URI (GETs it and return the reply). Will tolerate
- # a HTTP[S] URI or a file path.
- #
- # It is not named open() in order not to collide with File.open and
- # open-uri's open.
- #
- def fopen (uri, *args, &block)
+ EndPoint.request :options, args
+ end
- # should I really care about blocks here ? ...
+ #
+ # Opens a file or a URI (GETs it and return the reply). Will tolerate
+ # a HTTP[S] URI or a file path.
+ #
+ # It is not named open() in order not to collide with File.open and
+ # open-uri's open.
+ #
+ def fopen (uri, *args, &block)
- u = URI.parse uri.to_s
+ # should I really care about blocks here ? ...
- return File.open(uri.to_s, &block) \
- if u.scheme == nil
+ u = URI.parse uri.to_s
- return File.open(uri.to_s[5..-1], &block) \
- if u.scheme == 'file'
+ return File.open(uri.to_s, &block) \
+ if u.scheme == nil
- if u.scheme == 'http' or u.scheme == 'https'
+ return File.open(uri.to_s[5..-1], &block) \
+ if u.scheme == 'file'
- r = EndPoint.request(:get, [ uri ] + args) \
+ if u.scheme == 'http' or u.scheme == 'https'
- if block
- block.call r
- return
- end
+ r = EndPoint.request(:get, [ uri ] + args) \
- class << r
- def read
- self.body
- end
- end unless r.respond_to?(:read)
+ if block
+ block.call r
+ return
+ end
- return r
+ class << r
+ def read
+ self.body
end
+ end unless r.respond_to?(:read)
- raise "can't handle scheme '#{u.scheme}' for #{u.to_s}"
+ return r
end
- extend self
+ raise "can't handle scheme '#{u.scheme}' for #{u.to_s}"
+ end
+
+ extend self
end
Oops, something went wrong.

0 comments on commit cdac99b

Please sign in to comment.