ffi-msgpack 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3a260107c1e0dcaa23053676b0f50e717f4fd76fac6a02ca6590ab793036dd23
4
+ data.tar.gz: e5d5dd73f89aab88b608a59318add3d8ae0253623719b487225a2e8424d43344
5
+ SHA512:
6
+ metadata.gz: 9e38b21d7ff3672a9a2d527b31b1652861a0c3976cd1cfc8dceb0ec1953e4af7f108fa0793f0e43d672a3b6dc1195288807676a65bd1501255162785d95f9817
7
+ data.tar.gz: ecdc03adbf7e1b384ef1088ac693e002e0c5276109b7c1a3c602b4166a2690a1a6c62b9d028333ea6010d3b4ddff71fd2c093ec72cc3f768e669369519356ff7
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: ['**']
8
+
9
+ jobs:
10
+ tests:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby:
16
+ - 2.4
17
+ - 2.5
18
+ - 2.6
19
+ - 2.7
20
+ - jruby
21
+ name: Ruby ${{ matrix.ruby }}
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby }}
28
+ - name: Install libmsgpack
29
+ run: |
30
+ sudo apt update -y && \
31
+ sudo apt install -y --no-install-recommends --no-install-suggests libmsgpack-dev
32
+ - name: Install dependencies
33
+ run: bundle install --jobs 4 --retry 3
34
+ - name: Run tests
35
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
- doc
2
- pkg
1
+ /Gemfile.lock
2
+ /doc/
3
+ /pkg/
4
+ /vendor/bundle
@@ -1,11 +1,17 @@
1
+ ### 0.2.2 / 2020-11-28
2
+
3
+ * Support loading `libmsgpackc` as well as `libmsgpackc.so.2`, if
4
+ `libmsgpack` cannot be found.
5
+
1
6
  ### 0.2.1 / 2012-05-11
2
7
 
3
- * Temporarily drop support for [Rubinius](http://rubini.us/) due to [missing
4
- FFI::Union](https://github.com/rubinius/rubinius/issues/1717).
8
+ * Require ffi ~> 1.0.
5
9
  * Load `libmsgpack.so.3` if `libmsgpack.so` does not exist.
6
10
  * Use `:string`, `:buffer_out`, `:buffer_in` FFI types.
7
11
  * {FFI::MsgPack::MsgObject#set!} now raises a TypeError when given
8
12
  ambigious values.
13
+ * Temporarily drop support for [Rubinius](http://rubini.us/) due to [missing
14
+ FFI::Union](https://github.com/rubinius/rubinius/issues/1717).
9
15
 
10
16
  ### 0.2.0 / 2011-02-18
11
17
 
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'kramdown', '~> 2.0'
10
+ gem 'yard', '~> 0.9'
11
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2012 Hal Brodigan
1
+ Copyright (c) 2010-2020 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -80,10 +80,6 @@ Enumerates over each unpacked Object from a stream:
80
80
 
81
81
  ## Requirements
82
82
 
83
- * [Ruby](http://ruby-lang.org/) >= 1.8.7 or
84
- [JRruby](http://jruby.org) >= 1.6
85
- * [Rubinius](http://rubini.us/) is not currently supported due to
86
- [Issue 1717](https://github.com/rubinius/rubinius/issues/1717)
87
83
  * [libmsgpack](http://msgpack.sourceforge.net/) >= 0.5.0
88
84
  * [ffi](http://github.com/ffi/ffi) ~> 1.0
89
85
 
@@ -93,6 +89,6 @@ Enumerates over each unpacked Object from a stream:
93
89
 
94
90
  ## License
95
91
 
96
- Copyright (c) 2010-2012 Hal Brodigan
92
+ Copyright (c) 2010-2020 Hal Brodigan
97
93
 
98
94
  See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -1,36 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
- begin
5
- gem 'rubygems-tasks', '~> 0.1'
6
- require 'rubygems/tasks'
3
+ require 'rubygems/tasks'
4
+ Gem::Tasks.new
7
5
 
8
- Gem::Tasks.new
9
- rescue LoadError => e
10
- warn e.message
11
- warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
12
- end
13
-
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
17
-
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
24
8
  task :test => :spec
25
9
  task :default => :spec
26
10
 
27
- begin
28
- gem 'yard', '~> 0.7'
29
- require 'yard'
30
-
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new
@@ -2,126 +2,59 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- files = if File.directory?('.git')
7
- `git ls-files`.split($/)
8
- elsif File.directory?('.hg')
9
- `hg manifest`.split($/)
10
- elsif File.directory?('.svn')
11
- `svn ls -R`.split($/).select { |path| File.file?(path) }
12
- else
13
- Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
14
- end
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
15
7
 
16
- filter_files = lambda { |paths|
17
- case paths
18
- when Array
19
- (files & paths)
20
- when String
21
- (files & Dir[paths])
22
- end
23
- }
24
-
25
- version = {
26
- :file => 'lib/ffi/msgpack/version.rb',
27
- :constant => 'FFI::MsgPack::VERSION'
28
- }
29
-
30
- defaults = {
31
- 'name' => File.basename(File.dirname(__FILE__)),
32
- 'files' => files,
33
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
34
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
35
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
36
- }
37
-
38
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
39
-
40
- gemspec.name = metadata.fetch('name',defaults[:name])
41
- gemspec.version = if metadata['version']
42
- metadata['version']
43
- elsif File.file?(version[:file])
44
- require File.join('.',version[:file])
45
- eval(version[:constant])
46
- end
47
-
48
- gemspec.summary = metadata.fetch('summary',metadata['description'])
49
- gemspec.description = metadata.fetch('description',metadata['summary'])
50
-
51
- case metadata['license']
52
- when Array
53
- gemspec.licenses = metadata['license']
54
- when String
55
- gemspec.license = metadata['license']
56
- end
57
-
58
- case metadata['authors']
59
- when Array
60
- gemspec.authors = metadata['authors']
61
- when String
62
- gemspec.author = metadata['authors']
63
- end
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
64
12
 
65
- gemspec.email = metadata['email']
66
- gemspec.homepage = metadata['homepage']
13
+ require 'ffi/msgpack/version'
14
+ FFI::MsgPack::VERSION
15
+ end
67
16
 
68
- case metadata['require_paths']
69
- when Array
70
- gemspec.require_paths = metadata['require_paths']
71
- when String
72
- gemspec.require_path = metadata['require_paths']
73
- end
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
74
23
 
75
- gemspec.files = filter_files[metadata['files']]
24
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
76
25
 
77
- gemspec.executables = metadata['executables']
78
- gemspec.extensions = metadata['extensions']
26
+ gem.files = `git ls-files`.split($/)
27
+ gem.files = glob[gemspec['files']] if gemspec['files']
79
28
 
80
- if Gem::VERSION < '1.7.'
81
- gemspec.default_executable = gemspec.executables.first
29
+ gem.executables = gemspec.fetch('executables') do
30
+ glob['bin/*'].map { |path| File.basename(path) }
82
31
  end
32
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
83
33
 
84
- gemspec.test_files = filter_files[metadata['test_files']]
85
-
86
- unless gemspec.files.include?('.document')
87
- gemspec.extra_rdoc_files = metadata['extra_doc_files']
88
- end
89
-
90
- gemspec.post_install_message = metadata['post_install_message']
91
- gemspec.requirements = metadata['requirements']
92
-
93
- if gemspec.respond_to?(:required_ruby_version=)
94
- gemspec.required_ruby_version = metadata['required_ruby_version']
95
- end
34
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
35
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
36
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
96
37
 
97
- if gemspec.respond_to?(:required_rubygems_version=)
98
- gemspec.required_rubygems_version = metadata['required_ruby_version']
99
- end
38
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
39
+ %w[ext lib].select { |dir| File.directory?(dir) }
40
+ })
100
41
 
101
- parse_versions = lambda { |versions|
102
- case versions
103
- when Array
104
- versions.map { |v| v.to_s }
105
- when String
106
- versions.split(/,\s*/)
107
- end
108
- }
42
+ gem.requirements = gemspec['requirements']
43
+ gem.required_ruby_version = gemspec['required_ruby_version']
44
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
45
+ gem.post_install_message = gemspec['post_install_message']
109
46
 
110
- if metadata['dependencies']
111
- metadata['dependencies'].each do |name,versions|
112
- gemspec.add_dependency(name,parse_versions[versions])
113
- end
114
- end
47
+ split = lambda { |string| string.split(/,\s*/) }
115
48
 
116
- if metadata['runtime_dependencies']
117
- metadata['runtime_dependencies'].each do |name,versions|
118
- gemspec.add_runtime_dependency(name,parse_versions[versions])
49
+ if gemspec['dependencies']
50
+ gemspec['dependencies'].each do |name,versions|
51
+ gem.add_dependency(name,split[versions])
119
52
  end
120
53
  end
121
54
 
122
- if metadata['development_dependencies']
123
- metadata['development_dependencies'].each do |name,versions|
124
- gemspec.add_development_dependency(name,parse_versions[versions])
55
+ if gemspec['development_dependencies']
56
+ gemspec['development_dependencies'].each do |name,versions|
57
+ gem.add_development_dependency(name,split[versions])
125
58
  end
126
59
  end
127
60
  end
@@ -1,5 +1,5 @@
1
1
  name: ffi-msgpack
2
- version: 0.2.1
2
+ version: 0.2.2
3
3
  summary: FFI bindings for msgpack
4
4
  description: Ruby FFI bindings for the msgpack library.
5
5
  license: MIT
@@ -14,6 +14,4 @@ dependencies:
14
14
  ffi: ~> 1.0
15
15
 
16
16
  development_dependencies:
17
- rubygems-tasks: ~> 0.1
18
- rspec: ~> 2.4
19
- yard: ~> 0.7
17
+ bundler: ~> 2.0
@@ -259,7 +259,7 @@ module FFI
259
259
 
260
260
  @objects = nil
261
261
  @memory = FFI::MemoryPointer.new(:uchar, value.length)
262
- @memory.put_bytes(0,value)
262
+ @memory.write_bytes(value)
263
263
 
264
264
  self[:type] = :raw
265
265
 
@@ -271,7 +271,7 @@ module FFI
271
271
  #
272
272
  # Sets the Msg Objects value to an Array value.
273
273
  #
274
- # @param [Array] value
274
+ # @param [Array] values
275
275
  # The Array value.
276
276
  #
277
277
  # @since 0.2.0
@@ -294,7 +294,7 @@ module FFI
294
294
  #
295
295
  # Sets the Msg Objects value to a Map value.
296
296
  #
297
- # @param [Hash] value
297
+ # @param [Hash] values
298
298
  # The Map value.
299
299
  #
300
300
  # @since 0.2.0
@@ -34,7 +34,7 @@ module FFI
34
34
  # The raw data.
35
35
  #
36
36
  def to_s
37
- self[:ptr].get_bytes(0,self[:size])
37
+ self[:ptr].read_bytes(self[:size])
38
38
  end
39
39
 
40
40
  end
@@ -8,7 +8,7 @@ module FFI
8
8
  module MsgPack
9
9
  extend FFI::Library
10
10
 
11
- ffi_lib ['msgpack', 'libmsgpack.so.3']
11
+ ffi_lib %w[msgpack libmsgpack.so.3 msgpackc libmsgpackc.so.2]
12
12
 
13
13
  begin
14
14
  attach_function :msgpack_version, [], :string
@@ -100,7 +100,7 @@ module FFI
100
100
  self[:callback] = Proc.new do |data_ptr,packed_buffer,length|
101
101
  @total += length
102
102
 
103
- packed = packed_buffer.get_bytes(0,length)
103
+ packed = packed_buffer.read_bytes(length)
104
104
 
105
105
  if block.arity == 2
106
106
  block.call(packed,length)
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/array'
3
5
 
@@ -5,10 +7,10 @@ describe Array do
5
7
  subject { [1, 2] }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\x92\x01\x02"
14
+ expect(subject.to_msgpack).to be == "\x92\x01\x02"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/false_class'
3
5
 
@@ -5,10 +7,10 @@ describe FalseClass do
5
7
  subject { false }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xC2"
14
+ expect(subject.to_msgpack).to be == "\xC2"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/float'
3
5
 
@@ -5,10 +7,10 @@ describe Float do
5
7
  subject { 0.2 }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xCB?\xC9\x99\x99\x99\x99\x99\x9A"
14
+ expect(subject.to_msgpack).to be == "\xCB?\xC9\x99\x99\x99\x99\x99\x9A"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/hash'
3
5
 
@@ -5,10 +7,10 @@ describe Hash do
5
7
  subject { {1 => 'a', 2 => 'b'} }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\x82\x01\xA1a\x02\xA1b"
14
+ expect(subject.to_msgpack).to be == "\x82\x01\xA1a\x02\xA1b"
13
15
  end
14
16
  end
@@ -9,6 +9,6 @@ describe Integer do
9
9
  end
10
10
 
11
11
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\x02"
12
+ expect(subject.to_msgpack).to eq("\x02")
13
13
  end
14
14
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/nil_class'
3
5
 
@@ -5,10 +7,10 @@ describe NilClass do
5
7
  subject { nil }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xC0"
14
+ expect(subject.to_msgpack).to be == "\xC0"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/string'
3
5
 
@@ -5,10 +7,10 @@ describe String do
5
7
  subject { "hello" }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xA5hello"
14
+ expect(subject.to_msgpack).to be == "\xA5hello"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/symbol'
3
5
 
@@ -5,10 +7,10 @@ describe Symbol do
5
7
  subject { :hello }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xA5hello"
14
+ expect(subject.to_msgpack).to be == "\xA5hello"
13
15
  end
14
16
  end
@@ -1,3 +1,5 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi/msgpack/extensions/true_class'
3
5
 
@@ -5,10 +7,10 @@ describe TrueClass do
5
7
  subject { true }
6
8
 
7
9
  it "should be packable" do
8
- should be_kind_of(FFI::MsgPack::Packable)
10
+ expect(subject).to be_kind_of(FFI::MsgPack::Packable)
9
11
  end
10
12
 
11
13
  it "should pack to a msg" do
12
- subject.to_msgpack.should == "\xC3"
14
+ expect(subject.to_msgpack).to be == "\xC3"
13
15
  end
14
16
  end
@@ -10,15 +10,15 @@ describe MsgPack::MsgObject do
10
10
  it "should create nil Msg Objects from NilClasses" do
11
11
  obj = MsgPack::MsgObject.new_object(nil)
12
12
 
13
- obj.type.should == :nil
13
+ expect(obj.type).to eq(:nil)
14
14
  end
15
15
 
16
16
  it "should create new nil Msg Objects" do
17
- @obj.type.should == :nil
17
+ expect(@obj.type).to eq(:nil)
18
18
  end
19
19
 
20
20
  it "should return a Ruby nil value" do
21
- @obj.to_ruby.should == nil
21
+ expect(@obj.to_ruby).to eq(nil)
22
22
  end
23
23
  end
24
24
 
@@ -28,21 +28,21 @@ describe MsgPack::MsgObject do
28
28
  end
29
29
 
30
30
  it "should create new boolean Msg Objects" do
31
- @obj.type.should == :boolean
31
+ expect(@obj.type).to eq(:boolean)
32
32
 
33
- @obj[:values][:boolean].should == 1
33
+ expect(@obj[:values][:boolean]).to eq(1)
34
34
  end
35
35
 
36
36
  it "should create boolean Msg Objects from TrueClass/FalseClass" do
37
37
  obj1 = MsgPack::MsgObject.new_object(true)
38
- obj1.type.should == :boolean
38
+ expect(obj1.type).to eq(:boolean)
39
39
 
40
40
  obj2 = MsgPack::MsgObject.new_object(false)
41
- obj2.type.should == :boolean
41
+ expect(obj2.type).to eq(:boolean)
42
42
  end
43
43
 
44
44
  it "should return a Ruby true/false value" do
45
- @obj.to_ruby.should == true
45
+ expect(@obj.to_ruby).to eq(true)
46
46
  end
47
47
  end
48
48
 
@@ -52,18 +52,18 @@ describe MsgPack::MsgObject do
52
52
  end
53
53
 
54
54
  it "should create new positive integer Msg Objects" do
55
- @obj.type.should == :positive_integer
56
- @obj[:values][:u64].should == 10
55
+ expect(@obj.type).to eq(:positive_integer)
56
+ expect(@obj[:values][:u64]).to eq(10)
57
57
  end
58
58
 
59
59
  it "should create positive integer Msg Objects from Integers" do
60
60
  obj1 = MsgPack::MsgObject.new_object(10)
61
61
 
62
- obj1.type.should == :positive_integer
62
+ expect(obj1.type).to eq(:positive_integer)
63
63
  end
64
64
 
65
65
  it "should return a Ruby Integer" do
66
- @obj.to_ruby.should == 10
66
+ expect(@obj.to_ruby).to eq(10)
67
67
  end
68
68
  end
69
69
 
@@ -73,18 +73,18 @@ describe MsgPack::MsgObject do
73
73
  end
74
74
 
75
75
  it "should create new negative integer Msg Objects" do
76
- @obj.type.should == :negative_integer
77
- @obj[:values][:i64].should == -1
76
+ expect(@obj.type).to eq(:negative_integer)
77
+ expect(@obj[:values][:i64]).to eq(-1)
78
78
  end
79
79
 
80
80
  it "should create negative integer Msg Objects from Integers" do
81
81
  obj1 = MsgPack::MsgObject.new_object(-1)
82
82
 
83
- obj1.type.should == :negative_integer
83
+ expect(obj1.type).to eq(:negative_integer)
84
84
  end
85
85
 
86
86
  it "should return a Ruby Integer" do
87
- @obj.to_ruby.should == -1
87
+ expect(@obj.to_ruby).to eq(-1)
88
88
  end
89
89
  end
90
90
 
@@ -94,18 +94,18 @@ describe MsgPack::MsgObject do
94
94
  end
95
95
 
96
96
  it "should create new floating-point Msg Objects" do
97
- @obj.type.should == :double
98
- @obj[:values][:dec].should == 0.002
97
+ expect(@obj.type).to eq(:double)
98
+ expect(@obj[:values][:dec]).to eq(0.002)
99
99
  end
100
100
 
101
101
  it "should create floating-point Msg Objects from Floats" do
102
102
  obj1 = MsgPack::MsgObject.new_object(0.002)
103
103
 
104
- obj1.type.should == :double
104
+ expect(obj1.type).to eq(:double)
105
105
  end
106
106
 
107
107
  it "should return a Ruby Float" do
108
- @obj.to_ruby.should == 0.002
108
+ expect(@obj.to_ruby).to eq(0.002)
109
109
  end
110
110
  end
111
111
 
@@ -116,26 +116,26 @@ describe MsgPack::MsgObject do
116
116
  end
117
117
 
118
118
  it "should create new raw Msg Objects" do
119
- @obj.type.should == :raw
119
+ expect(@obj.type).to eq(:raw)
120
120
 
121
- @obj[:values][:raw].length.should == @binary.length
122
- @obj[:values][:raw].to_s.should == @binary
121
+ expect(@obj[:values][:raw].length).to eq(@binary.length)
122
+ expect(@obj[:values][:raw].to_s).to eq(@binary)
123
123
  end
124
124
 
125
125
  it "should create raw Msg Objects from Strings" do
126
126
  obj = MsgPack::MsgObject.new_object(@binary)
127
127
 
128
- obj.type.should == :raw
128
+ expect(obj.type).to eq(:raw)
129
129
  end
130
130
 
131
131
  it "should create raw Msg Objects from Symbols" do
132
132
  obj = MsgPack::MsgObject.new_object(:example)
133
133
 
134
- obj.type.should == :raw
134
+ expect(obj.type).to eq(:raw)
135
135
  end
136
136
 
137
137
  it "should return a String" do
138
- @obj.to_ruby.should == @binary
138
+ expect(@obj.to_ruby).to eq(@binary)
139
139
  end
140
140
  end
141
141
 
@@ -146,19 +146,19 @@ describe MsgPack::MsgObject do
146
146
  end
147
147
 
148
148
  it "should create new array Msg Objects" do
149
- @obj.type.should == :array
149
+ expect(@obj.type).to eq(:array)
150
150
 
151
- @obj[:values][:array].length.should == @array.length
151
+ expect(@obj[:values][:array].length).to eq(@array.length)
152
152
  end
153
153
 
154
154
  it "should create array Msg Objects from Arrays" do
155
155
  obj = MsgPack::MsgObject.new_object(@array)
156
156
 
157
- obj.type.should == :array
157
+ expect(obj.type).to eq(:array)
158
158
  end
159
159
 
160
160
  it "should return a Ruby Array" do
161
- @obj.to_ruby.should == @array
161
+ expect(@obj.to_ruby).to eq(@array)
162
162
  end
163
163
  end
164
164
 
@@ -175,56 +175,56 @@ describe MsgPack::MsgObject do
175
175
  end
176
176
 
177
177
  it "should create new map Msg Objects" do
178
- @obj.type.should == :map
178
+ expect(@obj.type).to eq(:map)
179
179
 
180
- @obj[:values][:map].length.should == @hash.length
180
+ expect(@obj[:values][:map].length).to eq(@hash.length)
181
181
  end
182
182
 
183
183
  it "should create map Msg Objects from Hashes" do
184
184
  obj = MsgPack::MsgObject.new_object(@hash)
185
185
 
186
- obj.type.should == :map
186
+ expect(obj.type).to eq(:map)
187
187
  end
188
188
 
189
189
  it "should return a Ruby Hash" do
190
- @obj.to_ruby.should == @hash
190
+ expect(@obj.to_ruby).to eq(@hash)
191
191
  end
192
192
  end
193
193
 
194
194
  it "should create highly nested Msg Objects" do
195
195
  obj = MsgPack::MsgObject.new_object({'one' => {2 => [3.0]}})
196
196
 
197
- obj[:type].should == :map
197
+ expect(obj[:type]).to eq(:map)
198
198
  map = obj[:values][:map]
199
- map[:size].should == 1
199
+ expect(map[:size]).to eq(1)
200
200
 
201
201
  pair = MsgPack::MsgKeyValue.new(map[:ptr])
202
202
 
203
203
  key = pair[:key]
204
- key[:type].should == :raw
204
+ expect(key[:type]).to eq(:raw)
205
205
 
206
206
  raw = key[:values][:raw]
207
- raw[:ptr].get_bytes(0,raw[:size]).should == 'one'
207
+ expect(raw[:ptr].read_bytes(raw[:size])).to eq('one')
208
208
 
209
209
  value = pair[:value]
210
- value[:type].should == :map
210
+ expect(value[:type]).to eq(:map)
211
211
 
212
212
  map = value[:values][:map]
213
- map[:size].should == 1
213
+ expect(map[:size]).to eq(1)
214
214
 
215
215
  pair = MsgPack::MsgKeyValue.new(map[:ptr])
216
216
  key = pair[:key]
217
- key[:type].should == :positive_integer
218
- key[:values][:i64].should == 2
217
+ expect(key[:type]).to eq(:positive_integer)
218
+ expect(key[:values][:i64]).to eq(2)
219
219
 
220
220
  value = pair[:value]
221
- value[:type].should == :array
221
+ expect(value[:type]).to eq(:array)
222
222
 
223
223
  array = value[:values][:array]
224
- array[:size].should == 1
224
+ expect(array[:size]).to eq(1)
225
225
 
226
226
  value = MsgPack::MsgObject.new(array[:ptr])
227
- value[:type].should == :double
228
- value[:values][:dec].should == 3.0
227
+ expect(value[:type]).to eq(:double)
228
+ expect(value[:values][:dec]).to eq(3.0)
229
229
  end
230
230
  end
@@ -9,15 +9,15 @@ describe MsgPack::Packer do
9
9
  end
10
10
 
11
11
  it "should write packed messages to a buffer" do
12
- @packer.buffer.should == "\x01"
12
+ expect(@packer.buffer).to eq("\x01")
13
13
  end
14
14
 
15
15
  it "should track the number of bytes written" do
16
- @packer.total.should == 1
16
+ expect(@packer.total).to eq(1)
17
17
  end
18
18
 
19
19
  it "should be convertable to a String" do
20
- @packer.to_s.should == "\x01"
20
+ expect(@packer.to_s).to eq("\x01")
21
21
  end
22
22
  end
23
23
 
@@ -32,7 +32,7 @@ describe MsgPack::Packer do
32
32
  end
33
33
  packer << 1
34
34
 
35
- @buffer.should == ["\x01"]
35
+ expect(@buffer).to eq(["\x01"])
36
36
  end
37
37
 
38
38
  it "should track the number of bytes written" do
@@ -41,7 +41,7 @@ describe MsgPack::Packer do
41
41
  end
42
42
  packer << 1
43
43
 
44
- packer.total.should == 1
44
+ expect(packer.total).to eq(1)
45
45
  end
46
46
 
47
47
  it "should accept a secondary length argument" do
@@ -50,13 +50,13 @@ describe MsgPack::Packer do
50
50
  end
51
51
  packer << 1
52
52
 
53
- @buffer.should == [["\x01", 1]]
53
+ expect(@buffer).to eq([["\x01", 1]])
54
54
  end
55
55
 
56
56
  it "should not be convertable to a String" do
57
57
  packer = MsgPack::Packer.create { |packed| }
58
58
 
59
- packer.to_s.should == nil
59
+ expect(packer.to_s).to eq(nil)
60
60
  end
61
61
  end
62
62
  end
@@ -1,4 +1,3 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
3
2
 
4
3
  require 'ffi'
@@ -18,17 +18,17 @@ describe MsgPack::Unpacker do
18
18
  @unpacker << @packed
19
19
  size2 = @unpacker[:used]
20
20
 
21
- (size2 - size1).should == @packed.length
21
+ expect(size2 - size1).to eq(@packed.length)
22
22
  end
23
23
 
24
24
  it "should enqueue data from IO objects into the buffer" do
25
25
  io = StringIO.new(@packed)
26
26
 
27
27
  size1 = @unpacker[:used]
28
- @unpacker.read(io).should == true
28
+ expect(@unpacker.read(io)).to eq(true)
29
29
  size2 = @unpacker[:used]
30
30
 
31
- (size2 - size1).should == @packed.length
31
+ expect(size2 - size1).to eq(@packed.length)
32
32
  end
33
33
  end
34
34
 
@@ -46,7 +46,7 @@ describe MsgPack::Unpacker do
46
46
  objs << [obj.type, obj.values[:u64]]
47
47
  end
48
48
 
49
- objs.should == expected
49
+ expect(objs).to eq(expected)
50
50
  end
51
51
 
52
52
  it "should unpack each Msg Object from a stream" do
@@ -63,7 +63,7 @@ describe MsgPack::Unpacker do
63
63
  objs << [obj.type, obj.values[:u64]]
64
64
  end
65
65
 
66
- objs.should == expected
66
+ expect(objs).to eq(expected)
67
67
  end
68
68
  end
69
69
  end
metadata CHANGED
@@ -1,80 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Postmodern
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-12 00:00:00.000000000 Z
11
+ date: 2020-11-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: ffi
16
14
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
15
  requirements:
19
- - - ~>
16
+ - - "~>"
20
17
  - !ruby/object:Gem::Version
21
18
  version: '1.0'
19
+ name: ffi
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: rubygems-tasks
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '0.1'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '0.1'
46
- - !ruby/object:Gem::Dependency
47
- name: rspec
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '2.4'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '2.4'
62
- - !ruby/object:Gem::Dependency
63
- name: yard
64
28
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
29
  requirements:
67
- - - ~>
30
+ - - "~>"
68
31
  - !ruby/object:Gem::Version
69
- version: '0.7'
32
+ version: '2.0'
33
+ name: bundler
70
34
  type: :development
71
35
  prerelease: false
72
36
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
37
  requirements:
75
- - - ~>
38
+ - - "~>"
76
39
  - !ruby/object:Gem::Version
77
- version: '0.7'
40
+ version: '2.0'
78
41
  description: Ruby FFI bindings for the msgpack library.
79
42
  email: postmodern.mod3@gmail.com
80
43
  executables: []
@@ -84,11 +47,13 @@ extra_rdoc_files:
84
47
  - LICENSE.txt
85
48
  - README.md
86
49
  files:
87
- - .gemtest
88
- - .gitignore
89
- - .rspec
90
- - .yardopts
50
+ - ".gemtest"
51
+ - ".github/workflows/ruby.yml"
52
+ - ".gitignore"
53
+ - ".rspec"
54
+ - ".yardopts"
91
55
  - ChangeLog.md
56
+ - Gemfile
92
57
  - LICENSE.txt
93
58
  - README.md
94
59
  - Rakefile
@@ -137,39 +102,25 @@ files:
137
102
  homepage: https://github.com/postmodern/ffi-msgpack
138
103
  licenses:
139
104
  - MIT
140
- post_install_message:
105
+ metadata: {}
106
+ post_install_message:
141
107
  rdoc_options: []
142
108
  require_paths:
143
109
  - lib
144
110
  required_ruby_version: !ruby/object:Gem::Requirement
145
- none: false
146
111
  requirements:
147
- - - ! '>='
112
+ - - ">="
148
113
  - !ruby/object:Gem::Version
149
114
  version: '0'
150
115
  required_rubygems_version: !ruby/object:Gem::Requirement
151
- none: false
152
116
  requirements:
153
- - - ! '>='
117
+ - - ">="
154
118
  - !ruby/object:Gem::Version
155
119
  version: '0'
156
120
  requirements:
157
121
  - libmsgpack >= 0.5.0
158
- rubyforge_project:
159
- rubygems_version: 1.8.24
160
- signing_key:
161
- specification_version: 3
122
+ rubygems_version: 3.0.6
123
+ signing_key:
124
+ specification_version: 4
162
125
  summary: FFI bindings for msgpack
163
- test_files:
164
- - spec/extensions/array_spec.rb
165
- - spec/extensions/false_class_spec.rb
166
- - spec/extensions/float_spec.rb
167
- - spec/extensions/hash_spec.rb
168
- - spec/extensions/integer_spec.rb
169
- - spec/extensions/nil_class_spec.rb
170
- - spec/extensions/string_spec.rb
171
- - spec/extensions/symbol_spec.rb
172
- - spec/extensions/true_class_spec.rb
173
- - spec/msg_object_spec.rb
174
- - spec/packer_spec.rb
175
- - spec/unpacker_spec.rb
126
+ test_files: []