summaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2010-02-06 21:28:27 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2010-02-06 21:28:27 +0900
commitd5609f3207ee8b98dc1e2032cd31a23380ad5402 (patch)
treeaef84c076d47c6cb8125bb77db3c6458801d7181 /ruby
parentcd10fbc1fe39308045f0b7bf9cce5f8153f25f1d (diff)
downloadmsgpack-python-d5609f3207ee8b98dc1e2032cd31a23380ad5402.tar.gz
ruby: makegem.sh
Diffstat (limited to 'ruby')
-rw-r--r--ruby/README (renamed from ruby/gem/README)0
-rw-r--r--ruby/gem/Rakefile133
-rwxr-xr-xruby/gengem.sh21
-rwxr-xr-xruby/makegem.sh21
-rw-r--r--[-rwxr-xr-x]ruby/msgpack.gemspec26
-rw-r--r--ruby/msgpack_test.rb (renamed from ruby/test_case.rb)0
-rw-r--r--ruby/test/test_helper.rb (renamed from ruby/gem/test/test_helper.rb)0
-rw-r--r--ruby/test_format.rb122
-rw-r--r--ruby/test_pack.rb58
9 files changed, 36 insertions, 345 deletions
diff --git a/ruby/gem/README b/ruby/README
index 859ae2b..859ae2b 100644
--- a/ruby/gem/README
+++ b/ruby/README
diff --git a/ruby/gem/Rakefile b/ruby/gem/Rakefile
deleted file mode 100644
index f2fd684..0000000
--- a/ruby/gem/Rakefile
+++ /dev/null
@@ -1,133 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'rake/clean'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'rake/contrib/rubyforgepublisher'
-require 'rake/contrib/sshpublisher'
-require 'fileutils'
-include FileUtils
-
-NAME = "msgpack"
-AUTHOR = "FURUHASHI Sadayuki"
-EMAIL = "frsyuki _at_ users.sourceforge.jp"
-DESCRIPTION = "Binary-based efficient data interchange format."
-RUBYFORGE_PROJECT = "msgpack"
-HOMEPATH = "http://msgpack.sourceforge.jp/"
-BIN_FILES = %w( )
-VERS = "0.3.2"
-
-#REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
-REV = nil
-CLEAN.include ['**/.*.sw?', '*.gem', '.config']
-RDOC_OPTS = [
- '--title', "#{NAME} documentation",
- "--charset", "utf-8",
- "--opname", "index.html",
- "--line-numbers",
- "--main", "README",
- "--inline-source",
-]
-
-task :default => [:test]
-task :package => [:clean]
-
-Rake::TestTask.new("test") do |t|
- t.libs << "test"
- t.pattern = "test/**/*_test.rb"
- t.verbose = true
-end
-
-spec = Gem::Specification.new do |s|
- s.name = NAME
- s.version = VERS
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = false
- s.extra_rdoc_files = ["README", "ChangeLog", "AUTHORS"]
- s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
- s.summary = DESCRIPTION
- s.description = DESCRIPTION
- s.author = AUTHOR
- s.email = EMAIL
- s.homepage = HOMEPATH
- s.executables = BIN_FILES
- s.rubyforge_project = RUBYFORGE_PROJECT
- s.bindir = "bin"
- s.require_path = "ext"
- s.autorequire = ""
- s.test_files = Dir["test/test_*.rb"]
-
- #s.add_dependency('activesupport', '>=1.3.1')
- #s.required_ruby_version = '>= 1.8.2'
-
- s.files = %w(README ChangeLog Rakefile) +
- Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
- Dir.glob("ext/**/*.{h,c,rb}") +
- Dir.glob("examples/**/*.rb") +
- Dir.glob("tools/*.rb") +
- Dir.glob("msgpack/*.h")
-
- s.extensions = FileList["ext/**/extconf.rb"].to_a
-end
-
-Rake::GemPackageTask.new(spec) do |p|
- p.need_tar = true
- p.gem_spec = spec
-end
-
-task :install do
- name = "#{NAME}-#{VERS}.gem"
- sh %{rake package}
- sh %{sudo gem install pkg/#{name}}
-end
-
-task :uninstall => [:clean] do
- sh %{sudo gem uninstall #{NAME}}
-end
-
-
-#Rake::RDocTask.new do |rdoc|
-# rdoc.rdoc_dir = 'html'
-# rdoc.options += RDOC_OPTS
-# rdoc.template = "resh"
-# #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
-# if ENV['DOC_FILES']
-# rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
-# else
-# rdoc.rdoc_files.include('README', 'ChangeLog')
-# rdoc.rdoc_files.include('lib/**/*.rb')
-# rdoc.rdoc_files.include('ext/**/*.c')
-# end
-#end
-
-desc "Publish to RubyForge"
-task :rubyforge => [:rdoc, :package] do
- require 'rubyforge'
- Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'frsyuki').upload
-end
-
-desc 'Package and upload the release to rubyforge.'
-task :release => [:clean, :package] do |t|
- v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
- abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
- pkg = "pkg/#{NAME}-#{VERS}"
-
- rf = RubyForge.new
- puts "Logging in"
- rf.login
-
- c = rf.userconfig
-# c["release_notes"] = description if description
-# c["release_changes"] = changes if changes
- c["preformatted"] = true
-
- files = [
- "#{pkg}.tgz",
- "#{pkg}.gem"
- ].compact
-
- puts "Releasing #{NAME} v. #{VERS}"
- rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
-end
diff --git a/ruby/gengem.sh b/ruby/gengem.sh
deleted file mode 100755
index 359debf..0000000
--- a/ruby/gengem.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-mkdir -p gem/ext
-mkdir -p gem/msgpack
-cp extconf.rb gem/ext/
-cp pack.c gem/ext/
-cp pack.h gem/ext/
-cp rbinit.c gem/ext/
-cp unpack.c gem/ext/
-cp unpack.h gem/ext/
-cat test_case.rb | sed "s/require ['\"]msgpack['\"]/require File.dirname(__FILE__) + '\/test_helper.rb'/" > gem/test/msgpack_test.rb
-cp ../AUTHORS gem/AUTHORS
-cp ../ChangeLog gem/ChangeLog
-cp ../msgpack/pack_define.h gem/msgpack/
-cp ../msgpack/pack_template.h gem/msgpack/
-cp ../msgpack/unpack_define.h gem/msgpack/
-cp ../msgpack/unpack_template.h gem/msgpack/
-cp ../msgpack/sysdep.h gem/msgpack/
-
-cd gem && rake --trace package
-
diff --git a/ruby/makegem.sh b/ruby/makegem.sh
new file mode 100755
index 0000000..fd0db79
--- /dev/null
+++ b/ruby/makegem.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+mkdir -p ext
+mkdir -p msgpack
+cp extconf.rb ext/
+cp pack.c ext/
+cp pack.h ext/
+cp rbinit.c ext/
+cp unpack.c ext/
+cp unpack.h ext/
+cp ../AUTHORS ./
+cp ../ChangeLog ./
+cp ../msgpack/pack_define.h msgpack/
+cp ../msgpack/pack_template.h msgpack/
+cp ../msgpack/unpack_define.h msgpack/
+cp ../msgpack/unpack_template.h msgpack/
+cp ../msgpack/sysdep.h msgpack/
+cat msgpack_test.rb | sed "s/require ['\"]msgpack['\"]/require File.dirname(__FILE__) + '\/test_helper.rb'/" > test/msgpack_test.rb
+
+gem build msgpack.gemspec
+
diff --git a/ruby/msgpack.gemspec b/ruby/msgpack.gemspec
index 59186a4..7273881 100755..100644
--- a/ruby/msgpack.gemspec
+++ b/ruby/msgpack.gemspec
@@ -1,12 +1,16 @@
-Gem::Specification.new do |s|
- s.platform = Gem::Platform::CURRENT
- s.name = "msgpack"
- s.version = "0.3.2"
- s.summary = "MessagePack"
- s.author = "FURUHASHI Sadayuki"
- s.email = "frsyuki@users.sourceforge.jp"
- s.homepage = "http://msgpack.sourceforge.jp/"
- s.rubyforge_project = "msgpack"
- s.require_paths = ["lib", "ext"]
- s.files = ["lib/**/*", "ext/**/*"].map {|g| Dir.glob(g) }.flatten
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = "msgpack"
+ s.version = "0.3.3"
+ s.summary = "MessagePack, a binary-based efficient data interchange format."
+ s.author = "FURUHASHI Sadayuki"
+ s.email = "frsyuki@users.sourceforge.jp"
+ s.homepage = "http://msgpack.sourceforge.jp/"
+ s.rubyforge_project = "msgpack"
+ s.has_rdoc = false
+ s.extra_rdoc_files = ["README", "ChangeLog", "AUTHORS"]
+ s.require_paths = ["lib", "ext"]
+ s.files = Dir["lib/**/*", "ext/**/*", "msgpack/**/*", "test/**/*"]
+ s.test_files = Dir["test/test_*.rb"]
+ s.extensions = Dir["ext/**/extconf.rb"]
end
diff --git a/ruby/test_case.rb b/ruby/msgpack_test.rb
index 4fbcea3..4fbcea3 100644
--- a/ruby/test_case.rb
+++ b/ruby/msgpack_test.rb
diff --git a/ruby/gem/test/test_helper.rb b/ruby/test/test_helper.rb
index 3088faa..3088faa 100644
--- a/ruby/gem/test/test_helper.rb
+++ b/ruby/test/test_helper.rb
diff --git a/ruby/test_format.rb b/ruby/test_format.rb
deleted file mode 100644
index 99a27d1..0000000
--- a/ruby/test_format.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require 'msgpack'
-
-@up = MessagePack::Unpacker.new
-
-def check(bytes, should)
- puts "----"
- @up.reset
- src = bytes.pack('C*')
- ret = @up.execute(src, 0)
- if ret != src.length
- puts "** EXTRA BYTES **"
- end
- puts bytes.map{|x|"%x"%x}.join(' ')
- data = @up.data
- p data
- if data != should
- puts "** TEST FAILED **"
- p should
- end
-end
-
-# SimpleValue
-check([
- 0x93, 0xc0, 0xc2, 0xc3,
-], [nil,false,true])
-
-# Fixnum
-check([
- 0x92,
- 0x93, 0x00, 0x40, 0x7f,
- 0x93, 0xe0, 0xf0, 0xff,
-], [[0,64,127], [-32,-16,-1]])
-
-# FixArray
-check([
- 0x92,
- 0x90,
- 0x91,
- 0x91, 0xc0,
-], [[],[[nil]]])
-
-
-# FixRaw
-check([
- 0x94,
- 0xa0,
- 0xa1, ?a,
- 0xa2, ?b, ?c,
- 0xa3, ?d, ?e, ?f,
-], ["","a","bc","def"])
-
-# FixMap
-check([
- 0x82,
- 0xc2, 0x81,
- 0xc0, 0xc0,
- 0xc3, 0x81,
- 0xc0, 0x80,
-], {false=>{nil=>nil}, true=>{nil=>{}}})
-
-# unsigned int
-check([
- 0x99,
- 0xcc, 0,
- 0xcc, 128,
- 0xcc, 255,
- 0xcd, 0x00, 0x00,
- 0xcd, 0x80, 0x00,
- 0xcd, 0xff, 0xff,
- 0xce, 0x00, 0x00, 0x00, 0x00,
- 0xce, 0x80, 0x00, 0x00, 0x00,
- 0xce, 0xff, 0xff, 0xff, 0xff,
-], [0, 128, 255, 0, 32768, 65535, 0, 2147483648, 4294967295])
-
-# signed int
-check([
- 0x99,
- 0xd0, 0,
- 0xd0, 128,
- 0xd0, 255,
- 0xd1, 0x00, 0x00,
- 0xd1, 0x80, 0x00,
- 0xd1, 0xff, 0xff,
- 0xd2, 0x00, 0x00, 0x00, 0x00,
- 0xd2, 0x80, 0x00, 0x00, 0x00,
- 0xd2, 0xff, 0xff, 0xff, 0xff,
-], [0, -128, -1, 0, -32768, -1, 0, -2147483648, -1])
-
-# raw
-check([
- 0x96,
- 0xda, 0x00, 0x00,
- 0xda, 0x00, 0x01, ?a,
- 0xda, 0x00, 0x02, ?a, ?b,
- 0xdb, 0x00, 0x00, 0x00, 0x00,
- 0xdb, 0x00, 0x00, 0x00, 0x01, ?a,
- 0xdb, 0x00, 0x00, 0x00, 0x02, ?a, ?b,
-], ["", "a", "ab", "", "a", "ab"])
-
-# array
-check([
- 0x96,
- 0xdc, 0x00, 0x00,
- 0xdc, 0x00, 0x01, 0xc0,
- 0xdc, 0x00, 0x02, 0xc2, 0xc3,
- 0xdd, 0x00, 0x00, 0x00, 0x00,
- 0xdd, 0x00, 0x00, 0x00, 0x01, 0xc0,
- 0xdd, 0x00, 0x00, 0x00, 0x02, 0xc2, 0xc3
-], [[], [nil], [false,true], [], [nil], [false,true]])
-
-# map
-check([
- 0x96,
- 0xde, 0x00, 0x00,
- 0xde, 0x00, 0x01, 0xc0, 0xc2,
- 0xde, 0x00, 0x02, 0xc0, 0xc2, 0xc3, 0xc2,
- 0xdf, 0x00, 0x00, 0x00, 0x00,
- 0xdf, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xc2,
- 0xdf, 0x00, 0x00, 0x00, 0x02, 0xc0, 0xc2, 0xc3, 0xc2,
-], [{}, {nil=>false}, {true=>false, nil=>false}, {}, {nil=>false}, {true=>false, nil=>false}])
-
-
diff --git a/ruby/test_pack.rb b/ruby/test_pack.rb
deleted file mode 100644
index 6873d57..0000000
--- a/ruby/test_pack.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'msgpack'
-
-def check(data)
- puts "---"
- pack = data.to_msgpack
- p data
- puts pack.unpack('C*').map{|x|"%02x"%x}.join(' ')
- re = MessagePack::unpack(pack)
- if re != data
- p re
- puts "** TEST FAILED **"
- end
-end
-
-check 0
-check 1
-check 127
-check 128
-check 255
-check 256
-check 65535
-check 65536
-check -1
-check -32
-check -33
-check -128
-check -129
-check -32768
-check -32769
-
-check 1.0
-
-check ""
-check "a"
-check "a"*31
-check "a"*32
-
-check nil
-check true
-check false
-
-check []
-check [[]]
-check [[], nil]
-
-check( {nil=>0} )
-
-check (1<<23)
-__END__
-
-ary = []
-i = 0
-while i < (1<<16)
- ary << i
- i += 1
-end
-check ary
-