msgpack 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/ChangeLog +0 -0
- data/README +29 -0
- data/Rakefile +133 -4
- data/ext/pack.c +4 -4
- data/ext/pack.h +2 -2
- data/ext/rbinit.c +1 -1
- data/ext/unpack.c +94 -78
- data/ext/unpack.h +2 -2
- data/msgpack/pack_define.h +1 -1
- data/msgpack/pack_template.h +40 -38
- data/msgpack/unpack_define.h +1 -1
- data/msgpack/unpack_template.h +49 -48
- data/test/msgpack_test.rb +150 -0
- data/test/test_helper.rb +3 -0
- metadata +33 -43
- data/License.txt +0 -13
- data/Manifest.txt +0 -23
- data/README.txt +0 -23
- data/config/hoe.rb +0 -75
- data/config/requirements.rb +0 -15
- data/lib/msgpack/version.rb +0 -9
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
@@ -0,0 +1,150 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class MessagePackTestFormat < Test::Unit::TestCase
|
6
|
+
def self.it(name, &block)
|
7
|
+
define_method("test_#{name}", &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "nil" do
|
11
|
+
check 1, nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "true" do
|
15
|
+
check 1, true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "false" do
|
19
|
+
check 1, false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "zero" do
|
23
|
+
check 1, 0
|
24
|
+
end
|
25
|
+
|
26
|
+
it "positive fixnum" do
|
27
|
+
check 1, 1
|
28
|
+
check 1, (1<<6)
|
29
|
+
check 1, (1<<7)-1
|
30
|
+
end
|
31
|
+
|
32
|
+
it "positive int 8" do
|
33
|
+
check 1, -1
|
34
|
+
check 2, (1<<7)
|
35
|
+
check 2, (1<<8)-1
|
36
|
+
end
|
37
|
+
|
38
|
+
it "positive int 16" do
|
39
|
+
check 3, (1<<8)
|
40
|
+
check 3, (1<<16)-1
|
41
|
+
end
|
42
|
+
|
43
|
+
it "positive int 32" do
|
44
|
+
check 5, (1<<16)
|
45
|
+
check 5, (1<<32)-1
|
46
|
+
end
|
47
|
+
|
48
|
+
it "positive int 64" do
|
49
|
+
check 9, (1<<32)
|
50
|
+
check 9, (1<<64)-1
|
51
|
+
end
|
52
|
+
|
53
|
+
it "negative fixnum" do
|
54
|
+
check 1, -1
|
55
|
+
check 1, -((1<<5)-1)
|
56
|
+
check 1, -(1<<5)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "negative int 8" do
|
60
|
+
check 2, -((1<<5)+1)
|
61
|
+
check 2, -(1<<7)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "negative int 16" do
|
65
|
+
check 3, -((1<<7)+1)
|
66
|
+
check 3, -(1<<15)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "negative int 32" do
|
70
|
+
check 5, -((1<<15)+1)
|
71
|
+
check 5, -(1<<31)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "negative int 64" do
|
75
|
+
check 9, -((1<<31)+1)
|
76
|
+
check 9, -(1<<63)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "double" do
|
80
|
+
check 9, 1.0
|
81
|
+
check 9, 0.1
|
82
|
+
check 9, -0.1
|
83
|
+
check 9, -1.0
|
84
|
+
end
|
85
|
+
|
86
|
+
it "fixraw" do
|
87
|
+
check_raw 1, 0
|
88
|
+
check_raw 1, (1<<5)-1
|
89
|
+
end
|
90
|
+
|
91
|
+
it "raw 16" do
|
92
|
+
check_raw 3, (1<<5)
|
93
|
+
check_raw 3, (1<<16)-1
|
94
|
+
end
|
95
|
+
|
96
|
+
it "raw 32" do
|
97
|
+
check_raw 5, (1<<16)
|
98
|
+
#check_raw 5, (1<<32)-1 # memory error
|
99
|
+
end
|
100
|
+
|
101
|
+
it "fixarray" do
|
102
|
+
check_array 1, 0
|
103
|
+
check_array 1, (1<<4)-1
|
104
|
+
end
|
105
|
+
|
106
|
+
it "array 16" do
|
107
|
+
check_array 3, (1<<4)
|
108
|
+
check_array 3, (1<<16)-1
|
109
|
+
end
|
110
|
+
|
111
|
+
it "array 32" do
|
112
|
+
check_array 5, (1<<16)
|
113
|
+
#check_array 5, (1<<32)-1 # memory error
|
114
|
+
end
|
115
|
+
|
116
|
+
# it "fixmap" do
|
117
|
+
# check_map 1, 0
|
118
|
+
# check_map 1, (1<<4)-1
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# it "map 16" do
|
122
|
+
# check_map 3, (1<<4)
|
123
|
+
# check_map 3, (1<<16)-1
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# it "map 32" do
|
127
|
+
# check_map 5, (1<<16)
|
128
|
+
# #check_map 5, (1<<32)-1 # memory error
|
129
|
+
# end
|
130
|
+
|
131
|
+
private
|
132
|
+
def check(len, obj)
|
133
|
+
v = obj.to_msgpack
|
134
|
+
assert_equal(v.length, len)
|
135
|
+
assert_equal(MessagePack.unpack(v), obj)
|
136
|
+
end
|
137
|
+
|
138
|
+
def check_raw(overhead, num)
|
139
|
+
check num+overhead, " "*num
|
140
|
+
end
|
141
|
+
|
142
|
+
def check_array(overhead, num)
|
143
|
+
check num+overhead, Array.new(num)
|
144
|
+
end
|
145
|
+
|
146
|
+
def check_map(overhead, num)
|
147
|
+
# FIXME
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,72 +1,62 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FURUHASHI Sadayuki
|
8
|
-
autorequire:
|
8
|
+
autorequire: ""
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-03-01 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.0
|
24
|
-
version:
|
25
|
-
description: An object-oriented parser generator based on Parser Expression Grammar
|
26
|
-
email:
|
27
|
-
- fr _at_ syuki.skr.jp
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Binary-based efficient data interchange format.
|
17
|
+
email: frsyuki _at_ users.sourceforge.jp
|
28
18
|
executables: []
|
29
19
|
|
30
20
|
extensions:
|
31
21
|
- ext/extconf.rb
|
32
22
|
extra_rdoc_files:
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
23
|
+
- README
|
24
|
+
- ChangeLog
|
25
|
+
- AUTHORS
|
36
26
|
files:
|
37
|
-
-
|
38
|
-
-
|
39
|
-
- README.txt
|
27
|
+
- README
|
28
|
+
- ChangeLog
|
40
29
|
- Rakefile
|
41
|
-
-
|
42
|
-
-
|
43
|
-
- ext/extconf.rb
|
44
|
-
- ext/pack.c
|
30
|
+
- test/msgpack_test.rb
|
31
|
+
- test/test_helper.rb
|
45
32
|
- ext/pack.h
|
33
|
+
- ext/unpack.h
|
34
|
+
- ext/pack.c
|
46
35
|
- ext/rbinit.c
|
47
36
|
- ext/unpack.c
|
48
|
-
- ext/
|
37
|
+
- ext/extconf.rb
|
49
38
|
- msgpack/pack_define.h
|
50
39
|
- msgpack/pack_template.h
|
51
40
|
- msgpack/unpack_define.h
|
52
41
|
- msgpack/unpack_template.h
|
53
|
-
-
|
54
|
-
- script/console
|
55
|
-
- script/destroy
|
56
|
-
- script/generate
|
57
|
-
- setup.rb
|
58
|
-
- tasks/deployment.rake
|
59
|
-
- tasks/environment.rake
|
42
|
+
- AUTHORS
|
60
43
|
has_rdoc: true
|
61
44
|
homepage: http://msgpack.rubyforge.org
|
62
|
-
post_install_message:
|
63
|
-
|
64
|
-
|
45
|
+
post_install_message:
|
65
46
|
rdoc_options:
|
47
|
+
- --title
|
48
|
+
- msgpack documentation
|
49
|
+
- --charset
|
50
|
+
- utf-8
|
51
|
+
- --opname
|
52
|
+
- index.html
|
53
|
+
- --line-numbers
|
66
54
|
- --main
|
67
|
-
- README
|
55
|
+
- README
|
56
|
+
- --inline-source
|
57
|
+
- --exclude
|
58
|
+
- ^(examples|extras)/
|
68
59
|
require_paths:
|
69
|
-
- lib
|
70
60
|
- ext
|
71
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
62
|
requirements:
|
@@ -86,6 +76,6 @@ rubyforge_project: msgpack
|
|
86
76
|
rubygems_version: 1.3.1
|
87
77
|
signing_key:
|
88
78
|
specification_version: 2
|
89
|
-
summary:
|
90
|
-
test_files:
|
91
|
-
|
79
|
+
summary: Binary-based efficient data interchange format.
|
80
|
+
test_files:
|
81
|
+
- test/test_helper.rb
|
data/License.txt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Copyright 2008 Furuhashi Sadayuki
|
2
|
-
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
you may not use this file except in compliance with the License.
|
5
|
-
You may obtain a copy of the License at
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
See the License for the specific language governing permissions and
|
13
|
-
limitations under the License.
|
data/Manifest.txt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
License.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.txt
|
4
|
-
Rakefile
|
5
|
-
config/hoe.rb
|
6
|
-
config/requirements.rb
|
7
|
-
ext/extconf.rb
|
8
|
-
ext/pack.c
|
9
|
-
ext/pack.h
|
10
|
-
ext/rbinit.c
|
11
|
-
ext/unpack.c
|
12
|
-
ext/unpack.h
|
13
|
-
msgpack/pack_define.h
|
14
|
-
msgpack/pack_template.h
|
15
|
-
msgpack/unpack_define.h
|
16
|
-
msgpack/unpack_template.h
|
17
|
-
lib/msgpack/version.rb
|
18
|
-
script/console
|
19
|
-
script/destroy
|
20
|
-
script/generate
|
21
|
-
setup.rb
|
22
|
-
tasks/deployment.rake
|
23
|
-
tasks/environment.rake
|
data/README.txt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
=MessagePack
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
|
5
|
-
Binary-based efficient data interchange format.
|
6
|
-
|
7
|
-
|
8
|
-
== LICENSE:
|
9
|
-
|
10
|
-
Copyright (C) 2008 FURUHASHI Sadayuki
|
11
|
-
|
12
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
-
you may not use this file except in compliance with the License.
|
14
|
-
You may obtain a copy of the License at
|
15
|
-
|
16
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
|
18
|
-
Unless required by applicable law or agreed to in writing, software
|
19
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
-
See the License for the specific language governing permissions and
|
22
|
-
limitations under the License.
|
23
|
-
|
data/config/hoe.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'msgpack/version'
|
2
|
-
|
3
|
-
AUTHOR = 'FURUHASHI Sadayuki' # can also be an array of Authors
|
4
|
-
EMAIL = "fr _at_ syuki.skr.jp"
|
5
|
-
DESCRIPTION = "An object-oriented parser generator based on Parser Expression Grammar"
|
6
|
-
GEM_NAME = 'msgpack' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'msgpack' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
# ['activesupport', '>= 1.3.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = MessagePack::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'msgpack documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
p.spec_extras = { # A hash of extra values to set in the gemspec.
|
67
|
-
:extensions => %w[ext/extconf.rb]
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
72
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
73
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
74
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
75
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/lib/msgpack/version.rb
DELETED
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/msgpack.rb'}"
|
9
|
-
puts "Loading msgpack gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|