From f254157aff27fe324ebd08c11c5b8a7ec6e847d1 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Thu, 6 Jan 2011 22:40:35 -0500 Subject: [PATCH] bundlerize + clean gemspec --- .rspec | 0 Gemfile | 18 +----- LICENSE | 58 -------------------- README.md | 5 ++ Rakefile | 37 +------------ VERSION | 1 - autotest/discover.rb | 1 - em-http-request.gemspec | 119 +++++++++------------------------------- lib/em-http.rb | 29 ++++------ lib/em-http/version.rb | 5 ++ spec/request_spec.rb | 2 +- 11 files changed, 52 insertions(+), 223 deletions(-) create mode 100644 .rspec delete mode 100644 LICENSE delete mode 100644 VERSION delete mode 100644 autotest/discover.rb create mode 100644 lib/em-http/version.rb diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..e69de29b diff --git a/Gemfile b/Gemfile index 790a3309..857c670d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,17 +1,3 @@ -source :gemcutter +source "http://rubygems.org" -gem 'eventmachine', '~> 0.12.9' -gem 'addressable', '~> 2.0.0' -gem 'escape_utils' - - -group :development do - gem 'autotest' - gem 'ruby-debug19', :require => 'ruby-debug' - gem 'jeweler' - gem 'rspec', '~> 2.0.0' - gem 'em-websocket' - - gem 'rack' - gem 'mongrel', '~> 1.2.0.pre2', :require => ['mongrel', 'http11'] -end +gemspec \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 4a99f6f0..00000000 --- a/LICENSE +++ /dev/null @@ -1,58 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the GPL -(see COPYING.txt file), or the conditions below: - - 1. You may make and give away verbatim copies of the source form of the - software without restriction, provided that you duplicate all of the - original copyright notices and associated disclaimers. - - 2. You may modify your copy of the software in any way, provided that - you do at least ONE of the following: - - a) place your modifications in the Public Domain or otherwise - make them Freely Available, such as by posting said - modifications to Usenet or an equivalent medium, or by allowing - the author to include your modifications in the software. - - b) use the modified software only within your corporation or - organization. - - c) rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided. - - d) make other distribution arrangements with the author. - - 3. You may distribute the software in object code or executable - form, provided that you do at least ONE of the following: - - a) distribute the executables and library files of the software, - together with instructions (in the manual page or equivalent) - on where to get the original distribution. - - b) accompany the distribution with the machine-readable source of - the software. - - c) give non-standard executables non-standard names, with - instructions on where to get the original software distribution. - - d) make other distribution arrangements with the author. - - 4. You may modify and include the part of the software into any other - software (possibly commercial). But some files in the distribution - are not written by the author, so that they are not under this terms. - - They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some - files under the ./missing directory. See each file for the copying - condition. - - 5. The scripts and library files supplied as input to or produced as - output from the software do not automatically fall under the - copyright of the software, but belong to whomever generated them, - and may be sold commercially, and may be aggregated with this - software. - - 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. - diff --git a/README.md b/README.md index d6bb0222..62fcdd71 100644 --- a/README.md +++ b/README.md @@ -166,3 +166,8 @@ WebSocket example http.disconnect { puts "oops, dropped connection?" } } + +License +------- + +(MIT License) - Copyright (c) 2011 Ilya Grigorik \ No newline at end of file diff --git a/Rakefile b/Rakefile index ef847507..527dd690 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,13 @@ require 'bundler' + Bundler.setup Bundler.require :default, :development require 'rake' require 'rake/clean' -require 'rake/rdoctask' require 'rake/gempackagetask' require 'rspec/core/rake_task' + require 'fileutils' include FileUtils @@ -20,15 +21,6 @@ end # Default Rake task is compile task :default => :compile -# RDoc -Rake::RDocTask.new(:rdoc) do |task| - task.rdoc_dir = 'doc' - task.title = 'EventMachine::HttpRequest' - task.options = %w(--title HttpRequest --main README.md --line-numbers) - task.rdoc_files.include(['lib/**/*.rb']) - task.rdoc_files.include(['README.md', 'LICENSE']) -end - # Rebuild parser Ragel task :ragel do Dir.chdir "ext/http11_client" do @@ -85,27 +77,4 @@ setup_extension("http11_client", "http11_client") task :compile => [:em_buffer, :http11_client] CLEAN.include ['build/*', '**/*.o', '**/*.so', '**/*.a', '**/*.log', 'pkg'] -CLEAN.include ['ext/buffer/Makefile', 'lib/em_buffer.*', 'lib/http11_client.*'] - -begin - require 'jeweler' - Jeweler::Tasks.new do |gemspec| - gemspec.name = "em-http-request" - gemspec.summary = "EventMachine based, async HTTP Request interface" - gemspec.description = gemspec.summary - gemspec.email = "ilya@igvita.com" - gemspec.homepage = "http://github.com/igrigorik/em-http-request" - gemspec.authors = ["Ilya Grigorik"] - gemspec.required_ruby_version = ">= 1.8.6" - gemspec.extensions = ["ext/buffer/extconf.rb" , "ext/http11_client/extconf.rb"] - gemspec.add_dependency('eventmachine', '>= 0.12.9') - gemspec.add_dependency('addressable', '>= 2.0.0') - gemspec.add_dependency('escape_utils') - gemspec.rubyforge_project = "em-http-request" - gemspec.files = FileList[`git ls-files`.split] - end - - Jeweler::GemcutterTasks.new -rescue LoadError - puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" -end +CLEAN.include ['ext/buffer/Makefile', 'lib/em_buffer.*', 'lib/http11_client.*'] \ No newline at end of file diff --git a/VERSION b/VERSION deleted file mode 100644 index b005e307..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.15 diff --git a/autotest/discover.rb b/autotest/discover.rb deleted file mode 100644 index 47355c93..00000000 --- a/autotest/discover.rb +++ /dev/null @@ -1 +0,0 @@ -Autotest.add_discovery { 'rspec2' } diff --git a/em-http-request.gemspec b/em-http-request.gemspec index 537c3236..ff0f9007 100644 --- a/em-http-request.gemspec +++ b/em-http-request.gemspec @@ -1,101 +1,32 @@ -# Generated by jeweler -# DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "em-http/version" Gem::Specification.new do |s| - s.name = %q{em-http-request} - s.version = "0.2.15" + s.name = "em-http-request" + s.version = EventMachine::HttpRequest::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["Ilya Grigorik"] + s.email = ["ilya@igvita.com"] + s.homepage = "http://github.com/igrigorik/em-http-request" + s.summary = "EventMachine based, async HTTP Request client" + s.description = s.summary + s.rubyforge_project = "em-http-request" - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = ["Ilya Grigorik"] - s.date = %q{2010-10-06} - s.description = %q{EventMachine based, async HTTP Request interface} - s.email = %q{ilya@igvita.com} - s.extensions = ["ext/buffer/extconf.rb", "ext/http11_client/extconf.rb"] - s.extra_rdoc_files = [ - "LICENSE", - "README.md" - ] - s.files = [ - ".gitignore", - "Changelog.md", - "Gemfile", - "LICENSE", - "README.md", - "Rakefile", - "VERSION", - "autotest/discover.rb", - "em-http-request.gemspec", - "examples/fetch.rb", - "examples/fibered-http.rb", - "examples/oauth-tweet.rb", - "examples/socks5.rb", - "examples/websocket-handler.rb", - "examples/websocket-server.rb", - "ext/buffer/em_buffer.c", - "ext/buffer/extconf.rb", - "ext/http11_client/ext_help.h", - "ext/http11_client/extconf.rb", - "ext/http11_client/http11_client.c", - "ext/http11_client/http11_parser.c", - "ext/http11_client/http11_parser.h", - "ext/http11_client/http11_parser.rl", - "lib/em-http-request.rb", - "lib/em-http.rb", - "lib/em-http/client.rb", - "lib/em-http/core_ext/bytesize.rb", - "lib/em-http/decoders.rb", - "lib/em-http/http_options.rb", - "lib/em-http/mock.rb", - "lib/em-http/multi.rb", - "lib/em-http/request.rb", - "spec/encoding_spec.rb", - "spec/fixtures/google.ca", - "spec/helper.rb", - "spec/mock_spec.rb", - "spec/multi_spec.rb", - "spec/request_spec.rb", - "spec/stallion.rb", - "spec/stub_server.rb" - ] - s.homepage = %q{http://github.com/igrigorik/em-http-request} - s.rdoc_options = ["--charset=UTF-8"] - s.require_paths = ["lib"] - s.required_ruby_version = Gem::Requirement.new(">= 1.8.6") - s.rubyforge_project = %q{em-http-request} - s.rubygems_version = %q{1.3.7} - s.summary = %q{EventMachine based, async HTTP Request interface} - s.test_files = [ - "spec/encoding_spec.rb", - "spec/helper.rb", - "spec/mock_spec.rb", - "spec/multi_spec.rb", - "spec/request_spec.rb", - "spec/stallion.rb", - "spec/stub_server.rb", - "examples/fetch.rb", - "examples/fibered-http.rb", - "examples/oauth-tweet.rb", - "examples/socks5.rb", - "examples/websocket-handler.rb", - "examples/websocket-server.rb" - ] + s.add_dependency "eventmachine", ">= 0.12.9" + s.add_dependency "addressable", ">= 2.0.0" + s.add_dependency "escape_utils" - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 3 + s.add_development_dependency "rspec" + s.add_development_dependency "rake" + s.add_development_dependency "em-websocket" + s.add_development_dependency "rack" + s.add_development_dependency "mongrel", "~> 1.2.0.pre2" - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 0.12.9"]) - s.add_runtime_dependency(%q, [">= 2.0.0"]) - else - s.add_dependency(%q, [">= 0.12.9"]) - s.add_dependency(%q, [">= 2.0.0"]) - end - else - s.add_dependency(%q, [">= 0.12.9"]) - s.add_dependency(%q, [">= 2.0.0"]) - end -end + s.extensions = ["ext/buffer/extconf.rb", "ext/http11_client/extconf.rb"] + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] +end \ No newline at end of file diff --git a/lib/em-http.rb b/lib/em-http.rb index a81a2efe..e680b988 100644 --- a/lib/em-http.rb +++ b/lib/em-http.rb @@ -1,9 +1,3 @@ -#-- -# Copyright (C)2008 Ilya Grigorik -# You can redistribute this under the terms of the Ruby license -# See file LICENSE for details -#++ - require 'eventmachine' require 'escape_utils' require 'addressable/uri' @@ -11,16 +5,15 @@ require 'base64' require 'socket' -require 'lib/http11_client' -require 'lib/em_buffer' - -require 'lib/em-http/core_ext/bytesize' -require 'lib/em-http/http_header' -require 'lib/em-http/http_encoding' -require 'lib/em-http/http_options' -require 'lib/em-http/client' -require 'lib/em-http/multi' -require 'lib/em-http/request' -require 'lib/em-http/decoders' -require 'lib/em-http/mock' +require 'http11_client' +require 'em_buffer' +require 'em-http/core_ext/bytesize' +require 'em-http/http_header' +require 'em-http/http_encoding' +require 'em-http/http_options' +require 'em-http/client' +require 'em-http/multi' +require 'em-http/request' +require 'em-http/decoders' +require 'em-http/mock' \ No newline at end of file diff --git a/lib/em-http/version.rb b/lib/em-http/version.rb new file mode 100644 index 00000000..b1644457 --- /dev/null +++ b/lib/em-http/version.rb @@ -0,0 +1,5 @@ +module EventMachine + class HttpRequest + VERSION = "0.3.0" + end +end \ No newline at end of file diff --git a/spec/request_spec.rb b/spec/request_spec.rb index 3609f41f..1b2fe30e 100644 --- a/spec/request_spec.rb +++ b/spec/request_spec.rb @@ -370,7 +370,7 @@ def failed(http=nil) http.errback { fail } start = Time.now.to_i http.callback { - (start - Time.now.to_i).should be_close(0,1) + (start - Time.now.to_i).should be_within(1).of(0) EventMachine.stop } }