jruby-http-reactor 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -1
- data/VERSION +1 -1
- data/examples/opml.rb +8 -12
- data/examples/textfile.rb +12 -16
- data/jruby-http-reactor.gemspec +4 -3
- data/lib/http_reactor.rb +2 -4
- metadata +5 -2
data/Rakefile
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/rdoctask'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
$VERBOSE=nil
|
3
6
|
|
4
7
|
desc 'Default: run tests.'
|
5
8
|
task :default => [:test]
|
6
9
|
|
7
10
|
desc 'Run tests.'
|
8
|
-
task :test do
|
11
|
+
task :test do |t|
|
12
|
+
$LOAD_PATH << 'vendor'
|
9
13
|
require File.dirname(__FILE__) + '/test/client_test'
|
10
14
|
end
|
11
15
|
|
@@ -28,6 +32,7 @@ begin
|
|
28
32
|
gemspec.homepage = "http://github.com/aeden/jruby-http-reactor"
|
29
33
|
gemspec.description = ""
|
30
34
|
gemspec.authors = ["Anthony Eden"]
|
35
|
+
gemspec.require_paths << 'vendor'
|
31
36
|
gemspec.files.exclude 'docs/**/*'
|
32
37
|
gemspec.files.exclude '.gitignore'
|
33
38
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/examples/opml.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
1
|
+
#!/usr/bin/env jruby -rubygems -Ilib -Ivendor
|
2
2
|
#
|
3
|
-
# Usage: jruby examples/opml.rb opml.xml
|
3
|
+
# Usage: jruby -rubygems -Ilib -Ivendor examples/opml.rb opml.xml
|
4
|
+
# Alt usage: ./examples/opml.rb opml.xml
|
4
5
|
#
|
5
6
|
# Dependencies:
|
6
7
|
#
|
7
8
|
# hpricot (0.6.164)
|
8
|
-
# threadify (1.1.0) (optional, uncomment in code)
|
9
9
|
|
10
10
|
require 'uri'
|
11
|
-
require 'rubygems'
|
12
11
|
require 'hpricot'
|
13
|
-
|
14
|
-
require File.dirname(__FILE__) + '/../lib/http_reactor'
|
12
|
+
require 'http_reactor'
|
15
13
|
|
16
14
|
def requests
|
17
15
|
@requests ||= begin
|
@@ -22,10 +20,8 @@ def requests
|
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
#end
|
23
|
+
HttpReactor::Client.new(requests) do |response, context|
|
24
|
+
puts "Response: #{response.status_line.status_code}"
|
25
|
+
puts "Content length: #{response.body.length}"
|
26
|
+
end
|
31
27
|
puts "Processed #{requests.length} feeds"
|
data/examples/textfile.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
1
|
+
#!/usr/bin/env jruby -Ilib -Ivendor
|
2
2
|
#
|
3
|
-
# Usage: jruby examples/textfile.rb urls.txt
|
4
|
-
#
|
5
|
-
# Dependencies:
|
6
|
-
#
|
7
|
-
# threadify (1.1.0) (optional, uncomment in code)
|
3
|
+
# Usage: jruby -Ilib -Ivendor examples/textfile.rb urls.txt
|
4
|
+
# Alt usage: examples/textfile urls.txt
|
8
5
|
|
9
6
|
require 'uri'
|
10
|
-
require '
|
11
|
-
require File.dirname(__FILE__) + '/../lib/http_reactor'
|
7
|
+
require 'http_reactor'
|
12
8
|
|
13
9
|
def requests
|
14
10
|
@requests ||= begin
|
@@ -24,12 +20,12 @@ def requests
|
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
23
|
+
|
24
|
+
HttpReactor::Client.new(requests) do |response, context|
|
25
|
+
request = context.get_attribute('http_target_request')
|
26
|
+
puts "Request URI: #{request.uri}"
|
27
|
+
puts "Response: #{response.status_line.status_code}"
|
28
|
+
puts "Content length: #{response.body.length}"
|
29
|
+
end
|
30
|
+
|
35
31
|
puts "Processed #{requests.length} feeds"
|
data/jruby-http-reactor.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jruby-http-reactor}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Anthony Eden"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-20}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{anthonyeden@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Rakefile",
|
23
23
|
"VERSION",
|
24
24
|
"examples/opml.rb",
|
25
|
+
"examples/textfile.rb",
|
25
26
|
"jruby-http-reactor.gemspec",
|
26
27
|
"lib/http_reactor.rb",
|
27
28
|
"lib/http_reactor/client.rb",
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |s|
|
|
34
35
|
]
|
35
36
|
s.homepage = %q{http://github.com/aeden/jruby-http-reactor}
|
36
37
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
+
s.require_paths = ["lib", "vendor", "vendor"]
|
38
39
|
s.rubygems_version = %q{1.3.5}
|
39
40
|
s.summary = %q{JRuby NIO HTTP client.}
|
40
41
|
s.test_files = [
|
data/lib/http_reactor.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'java'
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require 'httpcore-4.0.1.jar'
|
3
|
+
require 'httpcore-nio-4.0.1.jar'
|
4
4
|
|
5
5
|
# The Ruby module that contains wrappers for the the Apache
|
6
6
|
# HTTP NIO implementation.
|
7
7
|
module HttpReactor
|
8
8
|
end
|
9
9
|
|
10
|
-
$:.unshift(File.dirname(__FILE__))
|
11
|
-
|
12
10
|
require 'http_reactor/request'
|
13
11
|
require 'http_reactor/response'
|
14
12
|
require 'http_reactor/client'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-http-reactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Eden
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- Rakefile
|
29
29
|
- VERSION
|
30
30
|
- examples/opml.rb
|
31
|
+
- examples/textfile.rb
|
31
32
|
- jruby-http-reactor.gemspec
|
32
33
|
- lib/http_reactor.rb
|
33
34
|
- lib/http_reactor/client.rb
|
@@ -46,6 +47,8 @@ rdoc_options:
|
|
46
47
|
- --charset=UTF-8
|
47
48
|
require_paths:
|
48
49
|
- lib
|
50
|
+
- vendor
|
51
|
+
- vendor
|
49
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
53
|
requirements:
|
51
54
|
- - ">="
|