msgpack-jruby 1.3.0-java → 1.3.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.gem
2
2
  .bundle
3
3
  pkg/*
4
- /benchmark
4
+ /benchmark
5
+ /lib/ext/msgpack_jruby.jar
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
+ -Ilib
1
2
  --color
2
3
  --format doc
3
-
4
+ spec
data/.rvmrc CHANGED
@@ -1 +1,3 @@
1
- rvm --create use jruby-1.7.1@msgpack-jruby
1
+ rvm jruby-1.6.7 gemset create msgpack-jruby
2
+ rvm jruby-1.7.2 gemset create msgpack-jruby
3
+ rvm use jruby-1.7.2@msgpack-jruby
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - jruby-18mode
4
+ - jruby-19mode
5
+ - jruby-1.7.0
6
+ - jruby-head
7
+ jdk:
8
+ - openjdk7
9
+ - oraclejdk7
10
+ - openjdk6
11
+ bundler_args: --without development
data/Gemfile CHANGED
@@ -1,9 +1,11 @@
1
1
  source :rubygems
2
2
 
3
- gem 'jruby-openssl'
3
+ gemspec
4
4
 
5
- group :test do
6
- gem 'rspec'
5
+ gem 'rake'
6
+
7
+ group :development do
8
+ gem 'jruby-openssl'
7
9
  gem 'viiite'
8
10
  gem 'ffi-ncurses'
9
11
  gem 'bson'
@@ -11,3 +13,7 @@ group :test do
11
13
  gem 'json'
12
14
  gem 'msgpack', :platforms => :mri
13
15
  end
16
+
17
+ group :test do
18
+ gem 'rspec'
19
+ end
@@ -1,3 +1,8 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ msgpack-jruby (1.3.1-java)
5
+
1
6
  GEM
2
7
  remote: http://rubygems.org/
3
8
  specs:
@@ -24,6 +29,7 @@ GEM
24
29
  msgpack (0.4.6)
25
30
  myrrha (1.2.1)
26
31
  quickl (0.4.1)
32
+ rake (10.0.2)
27
33
  rspec (2.6.0)
28
34
  rspec-core (~> 2.6.0)
29
35
  rspec-expectations (~> 2.6.0)
@@ -48,5 +54,7 @@ DEPENDENCIES
48
54
  jruby-openssl
49
55
  json
50
56
  msgpack
57
+ msgpack-jruby!
58
+ rake
51
59
  rspec
52
60
  viiite
@@ -0,0 +1,26 @@
1
+ # MessagePack for JRuby
2
+
3
+ A MessagePack implementation for JRuby, built on top of the MessagePack Java libraries. Faster and easier to use than using the C MessagePack gem in JRuby.
4
+
5
+ ## Installation
6
+
7
+ gem install msgpack-jruby
8
+
9
+ or with Bundler
10
+
11
+ gem 'msgpack-jruby', :require => 'msgpack'
12
+
13
+ ## Extra features
14
+
15
+ * Decode keys as symbols by passing `:symbolize_keys => true` to `#unpack`.
16
+ * Decode strings with their right encoding by passing `:encoding => Encoding::UTF_8` to `#unpack`.
17
+
18
+ ## Copyright
19
+
20
+ Copyright 2012 Theo Hultberg
21
+
22
+ _Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License You may obtain a copy of the License at_
23
+
24
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
25
+
26
+ _Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License._
data/Rakefile CHANGED
@@ -1,9 +1,16 @@
1
1
  $: << 'lib'
2
2
 
3
3
  require 'bundler/setup'
4
+ require 'rspec/core/rake_task'
4
5
  require 'msgpack/version'
5
6
 
6
7
 
8
+ task :default => :spec
9
+
10
+ RSpec::Core::RakeTask.new(:spec)
11
+
12
+ task :spec => :package
13
+
7
14
  task :clean do
8
15
  rm Dir['ext/java/**/*.class']
9
16
  end
@@ -89,6 +89,7 @@ public class MessagePackLibrary implements Library {
89
89
  private RubyObjectUnpacker rubyObjectUnpacker;
90
90
  private MessagePackBufferUnpacker bufferUnpacker;
91
91
  private MessagePackUnpacker streamUnpacker;
92
+ private UnpackerIterator unpackerIterator;
92
93
  private IRubyObject stream;
93
94
  private IRubyObject data;
94
95
  private RubyObjectUnpacker.CompiledOptions options;
@@ -165,6 +166,7 @@ public class MessagePackLibrary implements Library {
165
166
  byte[] bytes = data.asString().getBytes();
166
167
  if (bufferUnpacker == null) {
167
168
  bufferUnpacker = new MessagePackBufferUnpacker(msgPack);
169
+ unpackerIterator = bufferUnpacker.iterator();
168
170
  }
169
171
  bufferUnpacker.feed(bytes);
170
172
  return ctx.getRuntime().getNil();
@@ -188,7 +190,8 @@ public class MessagePackLibrary implements Library {
188
190
  return ctx.getRuntime().getNil();
189
191
  }
190
192
  if (block.isGiven()) {
191
- for (Value value : localUnpacker) {
193
+ while (unpackerIterator.hasNext()) {
194
+ Value value = unpackerIterator.next();
192
195
  IRubyObject rubyObject = rubyObjectUnpacker.valueToRubyObject(ctx.getRuntime(), value, options);
193
196
  block.yield(ctx, rubyObject);
194
197
  }
@@ -235,7 +238,8 @@ public class MessagePackLibrary implements Library {
235
238
  } else {
236
239
  streamUnpacker = new MessagePackUnpacker(msgPack, new IOInputStream(stream));
237
240
  }
241
+ unpackerIterator = streamUnpacker.iterator();
238
242
  return getStream(ctx);
239
243
  }
240
244
  }
241
- }
245
+ }
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- require_relative '../spec_helper'
4
3
  require 'stringio'
5
4
  require 'tempfile'
5
+ require 'spec_helper'
6
6
 
7
7
 
8
8
  describe ::MessagePack::Unpacker do
@@ -130,6 +130,17 @@ describe ::MessagePack::Unpacker do
130
130
  end
131
131
  objects.should == [{'foo' => 'bar'}, {'hello' => {'world' => [1, 2, 3]}}, {'x' => 'y'}]
132
132
  end
133
+
134
+ it 'handles chunked data' do
135
+ objects = []
136
+ buffer = buffer1 + buffer2 + buffer3
137
+ buffer.chars.each do |ch|
138
+ subject.feed_each(ch) do |obj|
139
+ objects << obj
140
+ end
141
+ end
142
+ objects.should == [{'foo' => 'bar'}, {'hello' => {'world' => [1, 2, 3]}}, {'x' => 'y'}]
143
+ end
133
144
  end
134
145
 
135
146
  describe '#fill' do
@@ -190,8 +201,7 @@ describe ::MessagePack::Unpacker do
190
201
  end
191
202
  end
192
203
 
193
- context 'encoding' do
194
-
204
+ context 'encoding', :encodings do
195
205
  def flatten(struct, results = [])
196
206
  case struct
197
207
  when Array
@@ -240,6 +250,5 @@ describe ::MessagePack::Unpacker do
240
250
  strings.map(&:encoding).uniq.should == [Encoding::UTF_8]
241
251
  end
242
252
  end
243
-
244
253
  end
245
254
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- require_relative 'spec_helper'
3
+ require 'spec_helper'
4
4
 
5
5
 
6
6
  describe MessagePack do
@@ -85,5 +85,11 @@ describe MessagePack do
85
85
  unpacked = MessagePack.unpack(packed, :symbolize_keys => true)
86
86
  unpacked.should == {:hello => 'world', :nested => ['object', {:structure => true}]}
87
87
  end
88
+
89
+ it 'can unpack strings with a specified encoding', :encodings do
90
+ packed = MessagePack.pack({'hello' => 'world'})
91
+ unpacked = MessagePack.unpack(packed, :encoding => Encoding::UTF_8)
92
+ unpacked['hello'].encoding.should == Encoding::UTF_8
93
+ end
88
94
  end
89
95
  end
@@ -1,3 +1,10 @@
1
- $: << File.expand_path('../../lib', __FILE__)
1
+ # encoding: utf-8
2
2
 
3
- require 'msgpack'
3
+ require 'bundler/setup'
4
+ require 'msgpack'
5
+
6
+
7
+ RSpec.configure do |c|
8
+ c.treat_symbols_as_metadata_keys_with_true_values = true
9
+ c.filter_run_excluding :encodings => !(defined? Encoding)
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack-jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: JRuby compatible MessagePack implementation that does not use FFI
15
15
  email:
@@ -18,11 +18,13 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - .gitignore
22
- - .rspec
23
- - .rvmrc
21
+ - ".gitignore"
22
+ - ".rspec"
23
+ - ".rvmrc"
24
+ - ".travis.yml"
24
25
  - Gemfile
25
26
  - Gemfile.lock
27
+ - README.mdown
26
28
  - Rakefile
27
29
  - ext/.gitignore
28
30
  - ext/java/MsgpackJrubyService.java
@@ -31,7 +33,6 @@ files:
31
33
  - ext/java/org/msgpack/jruby/RubyObjectUnpacker.java
32
34
  - lib/ext/javassist-3.15.0-GA.jar
33
35
  - lib/ext/msgpack-0.6.6.jar
34
- - lib/ext/msgpack_jruby.jar
35
36
  - lib/msgpack.rb
36
37
  - lib/msgpack/version.rb
37
38
  - msgpack-jruby.gemspec
@@ -48,7 +49,7 @@ require_paths:
48
49
  - lib
49
50
  required_ruby_version: !ruby/object:Gem::Requirement
50
51
  requirements:
51
- - - ! '>='
52
+ - - ">="
52
53
  - !ruby/object:Gem::Version
53
54
  segments:
54
55
  - 0
@@ -58,10 +59,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
59
  none: false
59
60
  required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  requirements:
61
- - - ! '>='
62
+ - - ">="
62
63
  - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
63
66
  version: !binary |-
64
67
  MA==
68
+ hash: 2
65
69
  none: false
66
70
  requirements: []
67
71
  rubyforge_project: msgpack-jruby
Binary file