boss-protocol 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48d7d49095b00c5a6c7c1fc9c349e623cb52bc62
4
- data.tar.gz: e15a3c17f710e7e07af4922ab85a70a01990e6a9
3
+ metadata.gz: 88325e367e81c6d045667b628bd2f048eb7309bb
4
+ data.tar.gz: 08b1938498936324561d7d68b4f3acb58c354f6e
5
5
  SHA512:
6
- metadata.gz: 5d8586643c80b3bf34e73e624ca496733ad7e3c5e659f8021d59a42f4c4cb936f4e5385aaaeb0a874197febd98c31a0d56a13b1f7fce1624eb5eecc017de812b
7
- data.tar.gz: d4835694296bd13626adaaeb10bc5cc1d950e53f1a1c71d9a5d868f38028f7bdc4f1baf8a8e97c1df511767c6dae49f7afbbdad9259329f332f3e2656e178248
6
+ metadata.gz: 2a3a36cfc30b669be43b47788da11e934a82b21890d1c2a24eb227a6fc9fdd695189a1cb6811dc45af5bd066d1448781a41cb7278d4c12cb034f8198df978fde
7
+ data.tar.gz: 8e7b80832a549cfc8ef618c186af7a023ccc6b4ab738b9e0f0d0d63075df6aac19052d345d71aa99f3096bd5173d621592a5a5ead54ac1c04c61c52ce8741d45
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in boss-protocol.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'rspec'
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Boss Protocol
2
2
 
3
+ Supported version: 1.3.1 (stream mode with short binaries cached)
4
+
3
5
  BOSS is an acronym for Binary Object Streaming Specification.
4
6
 
5
7
  The bit-effective, platform-independent streamable and traversable
@@ -19,5 +19,5 @@ compression and more}
19
19
  gem.require_paths = ["lib"]
20
20
 
21
21
  #gem.add_dependency 'bzip2-ruby'
22
- gem.add_development_dependency "rspec"
22
+ gem.add_development_dependency "rspec", '>= 2.14.0'
23
23
  end
data/lib/boss-protocol.rb CHANGED
@@ -36,7 +36,7 @@ require 'zlib'
36
36
  # Attn! We removed Bzip2 compression for the sake of compatibility. We may add it back when situation
37
37
  # with bz2 implementations on various platforms will be eased
38
38
  #
39
- # 1.3 Stream mode added
39
+ # 1.3.1 Stream mode added and fixed
40
40
  #
41
41
  # 1.2 version adds support for booelans and removes support for python __reduce__ - based objects
42
42
  # as absolutely non portable. It also introduces
@@ -240,7 +240,7 @@ module Boss
240
240
  whdr TYPE_CREF, n
241
241
  false
242
242
  else
243
- # Check stream mode
243
+ # Check stream mode, bin and strings only
244
244
  if @max_string_size
245
245
  if obj.is_a?(String) && obj.length <= @max_string_size
246
246
  if @cache.length > @max_cache_entries
@@ -1,3 +1,3 @@
1
1
  module Boss
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/spec/boss_spec.rb CHANGED
@@ -114,12 +114,12 @@ describe 'Boss' do
114
114
  end
115
115
  end
116
116
 
117
- h = MyHash.new
117
+ h = MyHash.new
118
118
  h[:one] = 1
119
119
  h[:two] = 2
120
120
  round_check h
121
121
 
122
- a = MyArray.new
122
+ a = MyArray.new
123
123
  a["0"] = :zero
124
124
  a["1"] = :one
125
125
  round_check a
@@ -148,7 +148,8 @@ describe 'Boss' do
148
148
  end
149
149
 
150
150
  it 'should raise proper error' do
151
- class MyObject; end
151
+ class MyObject;
152
+ end
152
153
  -> { Boss.dump MyObject.new }.should raise_error(Boss::NotSupportedException)
153
154
  end
154
155
 
@@ -172,6 +173,35 @@ describe 'Boss' do
172
173
  (4..6).each { |n| inp.get.should == "test#{n}" }
173
174
  (4..6).each { |n| inp.get.should == "test#{n}" }
174
175
  inp.get.should == "test7"
176
+
177
+ #src2 = "gRhQe1N0cmluZyB0b28gbG9uZ3tTdHJpbmcgdG9vIGxvbmd7U3RyaW5nIHRvbyBsb25nK3Rlc3QxK3Rlc3QyK3Rlc3QzK3Rlc3Q0K3Rlc3Q1K3Rlc3Q2DRUdDRUdK3Rlc3Q3"
178
+ end
179
+
180
+ it 'should work fine with big stream mode' do
181
+ out = Boss::Formatter.new
182
+ out.stream_mode 7, 500
183
+ src = 4096.times.map { |n| s="Long string #{n}"; out << s; s }
184
+ inp = Boss::Parser.new out.string
185
+ src.each { |s| inp.get.should == s }
186
+ end
187
+
188
+ it 'should parse following code' do
189
+ src = 'gcAAAcAAAbwgn0XEfzTatIn6O75xqrvA5yOMHfndd8G1SiIyOj057yZzc3Rh
190
+ cnQgY29tbWFuZDMfQ3RvU2VyaWFsACNkYXRhDzNhbnN3ZXIjcG9uZzNzZXJp
191
+ YWwAHx0IJQ8rZmlsZXMWJyNuYW1lKzRoZXJvM2lzX2RpcmEjc2l6ZbiIK210
192
+ aW1leTZGWxaFJ02LQWRyaWFubyBDZWxlbnRhbm9dYWW4iG15O0ZbFoU9CA=='
193
+ parser = Boss::Parser.new(Base64::decode64 src)
194
+ out = []
195
+ begin
196
+ loop {
197
+ out << (x=parser.get)
198
+ }
199
+ rescue EOFError
200
+ end
201
+ x=out[-1]
202
+ x['toSerial'].should == 1
203
+ x['serial'].should == 1
204
+ x['data']['files'].length.should == 2
175
205
  end
176
206
 
177
207
  def round_check(ob)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boss-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2014-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.14.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.14.0
27
27
  description: Binary streamable bit-effective protocol to effectively store object
28
28
  tree hierarchies
29
29
  email:
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  requirements: []
66
66
  rubyforge_project:
67
- rubygems_version: 2.0.6
67
+ rubygems_version: 2.1.11
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Traversable and streamable to protocol supports lists, hashes, caching, compression