java_bin 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - 1.8.7
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.4.1 (2012/09/3)
2
+ * Adds travis ci support.
3
+ * Adds bundler support.
4
+ * First working version with rsolr 1.0.8.
5
+
1
6
  0.4.0 (2011/6/21)
2
7
  * solr 3.1 support
3
8
  * RailsInstaller support
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jeweler'
4
+ gem 'rake-compiler'
5
+ gem 'json'
6
+
7
+ group :test do
8
+ gem 'rsolr'
9
+ gem 'mocha'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ builder (3.0.0)
5
+ git (1.2.5)
6
+ jeweler (1.8.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rdoc
11
+ json (1.7.5)
12
+ metaclass (0.0.1)
13
+ mocha (0.12.3)
14
+ metaclass (~> 0.0.1)
15
+ rake (0.9.2.2)
16
+ rake-compiler (0.8.1)
17
+ rake
18
+ rdoc (3.12)
19
+ json (~> 1.4)
20
+ rsolr (1.0.8)
21
+ builder (>= 2.1.2)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ jeweler
28
+ json
29
+ mocha
30
+ rake-compiler
31
+ rsolr
data/README.rdoc CHANGED
@@ -32,7 +32,7 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
32
32
 
33
33
  * Ruby1.8.7 or later (include 1.9.x)
34
34
  * (recommended) C compiler (gcc or vc++): you can also use java_bin without c extension, but 'pure' is 30 times slower than 'ext'.
35
- * JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2 pre1 on Ubuntu Linux 9.10 (32bit) and MRI 1.8.6, YARV 1.9.1 on Windows Vista (32bit), and Apache Solr 1.4
35
+ * JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2, YARV 1.9.3 on Ubuntu Linux 9.10 (32bit) and MRI 1.8.6, YARV 1.9.1 on Windows Vista (32bit), and Apache Solr 1.4, 3.1
36
36
 
37
37
  == Install
38
38
 
@@ -75,12 +75,10 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
75
75
 
76
76
  == TODO
77
77
 
78
- * Solr 3.1 support
79
- * max os x supoort
80
78
  * more parse speed
81
79
  * license
82
80
  * shared string over parsing
83
- * builder(writer)作成
81
+ * builder(writer)
84
82
  * JRuby support
85
83
 
86
84
  == References
@@ -106,4 +104,4 @@ Toshinori Kajihara <mailto:kennyj@gmail.com>
106
104
 
107
105
  == Copyright
108
106
 
109
- Copyright (c) 2010 kennyj. See LICENSE for details.
107
+ Copyright (c) 2010 - 2012 kennyj. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,5 +1,13 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'rake/extensiontask'
4
+
5
+ Rake::ExtensionTask.new do |ext|
6
+ ext.name = 'parser' # indicate the name of the extension.
7
+ ext.ext_dir = 'ext/java_bin/ext' # search for 'hello_world' inside it.
8
+ ext.lib_dir = 'lib/java_bin/ext' # put binaries into this folder.
9
+ ext.tmp_dir = 'tmp' # temporary folder used during compilation.
10
+ end
3
11
 
4
12
  begin
5
13
  require 'jeweler'
@@ -38,11 +46,11 @@ rescue LoadError
38
46
  end
39
47
  end
40
48
 
41
- task :test => :check_dependencies
49
+ task :test => :compile
42
50
 
43
51
  task :default => :test
44
52
 
45
- require 'rake/rdoctask'
53
+ require 'rdoc/task'
46
54
  Rake::RDocTask.new do |rdoc|
47
55
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
56
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/how_to_release.txt CHANGED
@@ -1,3 +1,13 @@
1
+ * rvm use 1.9.3
2
+ * bundle update
3
+ * rake
4
+ * JavaBin=pure rake
5
+ * rvm use 1.9.2
6
+ * bundle update
7
+ * rake
8
+ * JavaBin=pure rake
9
+ * rvm use ree
10
+ * bundle update
1
11
  * rake
2
12
  * JavaBin=pure rake
3
13
  * vim CHANGELOG
data/java_bin.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{java_bin}
8
- s.version = "0.4.0"
7
+ s.name = "java_bin"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kennyj"]
12
- s.date = %q{2011-06-21}
13
- s.description = %q{Apache Solr JavaBin format (binary format) implementation for Ruby.}
14
- s.email = %q{kennyj@gmail.com}
12
+ s.date = "2012-09-03"
13
+ s.description = "Apache Solr JavaBin format (binary format) implementation for Ruby."
14
+ s.email = "kennyj@gmail.com"
15
15
  s.extensions = ["ext/java_bin/ext/extconf.rb"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
@@ -19,7 +19,10 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
+ ".travis.yml",
22
23
  "CHANGELOG",
24
+ "Gemfile",
25
+ "Gemfile.lock",
23
26
  "LICENSE",
24
27
  "README.rdoc",
25
28
  "Rakefile",
@@ -52,20 +55,30 @@ Gem::Specification.new do |s|
52
55
  "lib/solr_ruby_support.rb",
53
56
  "test/helper.rb",
54
57
  "test/test_java_bin_parser.rb",
58
+ "test/test_rsolr_support.rb",
55
59
  "test/xxx_performance.rb"
56
60
  ]
57
- s.homepage = %q{http://github.com/kennyj/java_bin}
61
+ s.homepage = "http://github.com/kennyj/java_bin"
58
62
  s.require_paths = ["lib", "ext"]
59
- s.rubygems_version = %q{1.6.2}
60
- s.summary = %q{Apache Solr JavaBin format implementation for Ruby.}
63
+ s.rubygems_version = "1.8.24"
64
+ s.summary = "Apache Solr JavaBin format implementation for Ruby."
61
65
 
62
66
  if s.respond_to? :specification_version then
63
67
  s.specification_version = 3
64
68
 
65
69
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
71
+ s.add_runtime_dependency(%q<rake-compiler>, [">= 0"])
72
+ s.add_runtime_dependency(%q<json>, [">= 0"])
66
73
  else
74
+ s.add_dependency(%q<jeweler>, [">= 0"])
75
+ s.add_dependency(%q<rake-compiler>, [">= 0"])
76
+ s.add_dependency(%q<json>, [">= 0"])
67
77
  end
68
78
  else
79
+ s.add_dependency(%q<jeweler>, [">= 0"])
80
+ s.add_dependency(%q<rake-compiler>, [">= 0"])
81
+ s.add_dependency(%q<json>, [">= 0"])
69
82
  end
70
83
  end
71
84
 
@@ -1,7 +1,7 @@
1
1
  # vim:fileencoding=utf-8
2
2
  module JavaBin
3
3
  # JavaBin version
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/lib/rsolr_support.rb CHANGED
@@ -4,15 +4,22 @@ if defined? RSolr::Client
4
4
 
5
5
  class RSolr::Client
6
6
  protected
7
-
8
- def map_params(params)
9
- params ||= {}
10
- {:wt=>:javabin}.merge(params)
7
+
8
+ def send_and_receive_with_java_bin(path, opts={})
9
+ if opts[:params].nil?
10
+ opts[:params]={}
11
+ end
12
+ opts[:params][:wt] = :javabin
13
+
14
+ send_and_receive_without_java_bin(path, opts)
11
15
  end
12
-
13
- def adapt_response_with_java_bin(connection_response)
14
- data = adapt_response_without_java_bin(connection_response)
15
- data = JavaBin.parser.new.parse(data) if data.raw[:params][:wt] == :javabin
16
+
17
+ alias_method :send_and_receive_without_java_bin, :send_and_receive
18
+ alias_method :send_and_receive, :send_and_receive_with_java_bin
19
+
20
+ def adapt_response_with_java_bin(request, response)
21
+ data = adapt_response_without_java_bin(request, response)
22
+ data = JavaBin.parser.new.parse(data) if request[:params][:wt] == :javabin
16
23
  data
17
24
  end
18
25
 
data/test/helper.rb CHANGED
@@ -1,10 +1,17 @@
1
1
  # vim:fileencoding=utf-8
2
2
  require 'rubygems'
3
+ require 'bundler'
3
4
  require 'test/unit'
4
5
 
6
+ ENV['TZ']='JST-9'
5
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
6
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+
10
+ Bundler.require(:test)
11
+
7
12
  require 'java_bin'
8
13
 
9
14
  class Test::Unit::TestCase
15
+ READ_UTF8 = (RUBY_VERSION >= '1.9' ? 'rb:utf-8' : 'rb')
16
+ READ_ASCII = (RUBY_VERSION >= '1.9' ? 'rb:ascii' : 'rb')
10
17
  end
@@ -14,9 +14,6 @@ end
14
14
 
15
15
  class TestJavaBinParser < Test::Unit::TestCase
16
16
 
17
- READ_UTF8 = (RUBY_VERSION >= '1.9' ? 'rb:utf-8' : 'rb')
18
- READ_ASCII = (RUBY_VERSION >= '1.9' ? 'rb:ascii' : 'rb')
19
-
20
17
  private
21
18
  def write_v_int(i, output)
22
19
  while ((i & ~0x7F) != 0)
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestRSolrSupportTest < Test::Unit::TestCase
4
+ def test_queries_are_performed_with_javabin
5
+
6
+ rsolr_connection=mock()
7
+ rsolr_connection.expects(:execute).
8
+ with { |rsolr_client, params|
9
+ assert_equal({:wt => :javabin}, params[:params])
10
+ true
11
+ }.
12
+ returns(:status => 200,
13
+ :headers => '',
14
+ :body => open(File.join(File.dirname(__FILE__), '..', 'fixtures', 'javabin2.dat'), READ_ASCII).read)
15
+
16
+ RSolr::Connection.expects(:new).returns(rsolr_connection)
17
+
18
+ rsolr = RSolr.connect
19
+
20
+ assert_equal({"status" => 0,
21
+ "QTime" => 0,
22
+ "params" =>
23
+ {"indent" => "on",
24
+ "start" => "0",
25
+ "q" => "*:*\r\n",
26
+ "wt" => "javabin",
27
+ "version" => "2.2",
28
+ "rows" => "100"}}, rsolr.select(:q => 'whatever')['responseHeader'])
29
+ end
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: java_bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-21 00:00:00.000000000 +09:00
13
- default_executable:
14
- dependencies: []
12
+ date: 2012-09-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jeweler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake-compiler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
15
62
  description: Apache Solr JavaBin format (binary format) implementation for Ruby.
16
63
  email: kennyj@gmail.com
17
64
  executables: []
@@ -22,7 +69,10 @@ extra_rdoc_files:
22
69
  - README.rdoc
23
70
  files:
24
71
  - .document
72
+ - .travis.yml
25
73
  - CHANGELOG
74
+ - Gemfile
75
+ - Gemfile.lock
26
76
  - LICENSE
27
77
  - README.rdoc
28
78
  - Rakefile
@@ -55,8 +105,8 @@ files:
55
105
  - lib/solr_ruby_support.rb
56
106
  - test/helper.rb
57
107
  - test/test_java_bin_parser.rb
108
+ - test/test_rsolr_support.rb
58
109
  - test/xxx_performance.rb
59
- has_rdoc: true
60
110
  homepage: http://github.com/kennyj/java_bin
61
111
  licenses: []
62
112
  post_install_message:
@@ -78,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
128
  version: '0'
79
129
  requirements: []
80
130
  rubyforge_project:
81
- rubygems_version: 1.6.2
131
+ rubygems_version: 1.8.24
82
132
  signing_key:
83
133
  specification_version: 3
84
134
  summary: Apache Solr JavaBin format implementation for Ruby.