ffi-msgpack 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ doc
2
+ pkg
data/ChangeLog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.2.1 / 2012-05-11
2
+
3
+ * Temporarily drop support for [Rubinius](http://rubini.us/) due to [missing
4
+ FFI::Union](https://github.com/rubinius/rubinius/issues/1717).
5
+ * Load `libmsgpack.so.3` if `libmsgpack.so` does not exist.
6
+ * Use `:string`, `:buffer_out`, `:buffer_in` FFI types.
7
+ * {FFI::MsgPack::MsgObject#set!} now raises a TypeError when given
8
+ ambigious values.
9
+
1
10
  ### 0.2.0 / 2011-02-18
2
11
 
3
12
  * Added {FFI::MsgPack::MsgObject#set!}.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2011 Hal Brodigan
1
+ Copyright (c) 2010-2012 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
@@ -1,7 +1,7 @@
1
1
  # ffi-msgpack
2
2
 
3
- * [Source](http://github.com/postmodern/ffi-msgpack/)
4
- * [Issues](http://github.com/postmodern/ffi-msgpack/issues)
3
+ * [Source](https://github.com/postmodern/ffi-msgpack/)
4
+ * [Issues](https://github.com/postmodern/ffi-msgpack/issues)
5
5
  * [Documentation](http://rubydoc.info/ffi-msgpack)
6
6
  * [Email](mailto:postmodern.mod3 at gmail.com)
7
7
 
@@ -80,15 +80,19 @@ 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)
83
87
  * [libmsgpack](http://msgpack.sourceforge.net/) >= 0.5.0
84
- * [ffi](http://github.com/ffi/ffi) >= 0.6.0, <= 1.1.0
88
+ * [ffi](http://github.com/ffi/ffi) ~> 1.0
85
89
 
86
90
  ## Install
87
91
 
88
- $ sudo gem install ffi-msgpack
92
+ $ gem install ffi-msgpack
89
93
 
90
94
  ## License
91
95
 
92
- Copyright (c) 2010-2011 Hal Brodigan
96
+ Copyright (c) 2010-2012 Hal Brodigan
93
97
 
94
98
  See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -2,13 +2,13 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  begin
5
- gem 'ore-tasks', '~> 0.4'
6
- require 'ore/tasks'
5
+ gem 'rubygems-tasks', '~> 0.1'
6
+ require 'rubygems/tasks'
7
7
 
8
- Ore::Tasks.new
8
+ Gem::Tasks.new
9
9
  rescue LoadError => e
10
- STDERR.puts e.message
11
- STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
10
+ warn e.message
11
+ warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
12
12
  end
13
13
 
14
14
  begin
@@ -25,7 +25,7 @@ task :test => :spec
25
25
  task :default => :spec
26
26
 
27
27
  begin
28
- gem 'yard', '~> 0.6.0'
28
+ gem 'yard', '~> 0.7'
29
29
  require 'yard'
30
30
 
31
31
  YARD::Rake::YardocTask.new
data/ffi-msgpack.gemspec CHANGED
@@ -1,15 +1,127 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- begin
4
- Ore::Specification.new do |gemspec|
5
- # custom logic here
6
- end
7
- rescue NameError
8
- begin
9
- require 'ore/specification'
10
- retry
11
- rescue LoadError
12
- STDERR.puts "The 'ffi-msgpack.gemspec' file requires Ore."
13
- STDERR.puts "Run `gem install ore-core` to install Ore."
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
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
15
+
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
64
+
65
+ gemspec.email = metadata['email']
66
+ gemspec.homepage = metadata['homepage']
67
+
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
74
+
75
+ gemspec.files = filter_files[metadata['files']]
76
+
77
+ gemspec.executables = metadata['executables']
78
+ gemspec.extensions = metadata['extensions']
79
+
80
+ if Gem::VERSION < '1.7.'
81
+ gemspec.default_executable = gemspec.executables.first
82
+ end
83
+
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
96
+
97
+ if gemspec.respond_to?(:required_rubygems_version=)
98
+ gemspec.required_rubygems_version = metadata['required_ruby_version']
99
+ end
100
+
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
+ }
109
+
110
+ if metadata['dependencies']
111
+ metadata['dependencies'].each do |name,versions|
112
+ gemspec.add_dependency(name,parse_versions[versions])
113
+ end
114
+ end
115
+
116
+ if metadata['runtime_dependencies']
117
+ metadata['runtime_dependencies'].each do |name,versions|
118
+ gemspec.add_runtime_dependency(name,parse_versions[versions])
119
+ end
120
+ end
121
+
122
+ if metadata['development_dependencies']
123
+ metadata['development_dependencies'].each do |name,versions|
124
+ gemspec.add_development_dependency(name,parse_versions[versions])
125
+ end
14
126
  end
15
127
  end
data/gemspec.yml CHANGED
@@ -1,19 +1,19 @@
1
1
  name: ffi-msgpack
2
- version: 0.2.0
2
+ version: 0.2.1
3
3
  summary: FFI bindings for msgpack
4
4
  description: Ruby FFI bindings for the msgpack library.
5
5
  license: MIT
6
6
  authors: Postmodern
7
7
  email: postmodern.mod3@gmail.com
8
- homepage: http://github.com/postmodern/ffi-msgpack
8
+ homepage: https://github.com/postmodern/ffi-msgpack
9
9
  has_yard: true
10
10
 
11
11
  requirements: libmsgpack >= 0.5.0
12
12
 
13
13
  dependencies:
14
- ffi: >= 0.6.0, <= 1.1.0
14
+ ffi: ~> 1.0
15
15
 
16
16
  development_dependencies:
17
- ore-tasks: ~> 0.4
17
+ rubygems-tasks: ~> 0.1
18
18
  rspec: ~> 2.4
19
- yard: ~> 0.6.0
19
+ yard: ~> 0.7
@@ -328,7 +328,7 @@ module FFI
328
328
  # @return [MsgObject]
329
329
  # The new Msg Object.
330
330
  #
331
- # @raise [ArgumentError]
331
+ # @raise [TypeError]
332
332
  # The object was not a {Hash}, {Array}, {String}, {Symbol}, {Float},
333
333
  # {Integer}, `true`, `false` or `nil`.
334
334
  #
@@ -351,7 +351,7 @@ module FFI
351
351
  when NilClass
352
352
  set_nil!
353
353
  else
354
- raise(ArgumentError,"ambigious object to create MsgObject from: #{value.inspect}")
354
+ raise(TypeError,"ambigious object to create MsgObject from: #{value.inspect}")
355
355
  end
356
356
 
357
357
  return value
@@ -8,7 +8,7 @@ module FFI
8
8
  module MsgPack
9
9
  extend FFI::Library
10
10
 
11
- ffi_lib 'msgpack'
11
+ ffi_lib ['msgpack', 'libmsgpack.so.3']
12
12
 
13
13
  begin
14
14
  attach_function :msgpack_version, [], :string
@@ -65,7 +65,7 @@ module FFI
65
65
 
66
66
  #attach_function :msgpack_unpacker_message_size, [:pointer], :size_t
67
67
 
68
- attach_function :msgpack_unpack, [:pointer, :size_t, :pointer, :pointer, :pointer], :msgpack_unpack_return
68
+ attach_function :msgpack_unpack, [:string, :size_t, :pointer, :pointer, :pointer], :msgpack_unpack_return
69
69
 
70
70
  #attach_function :msgpack_unpacker_parsed_size, [:pointer], :size_t
71
71
 
@@ -109,7 +109,7 @@ module FFI
109
109
 
110
110
  #attach_function :msgpack_pack_raw, [:pointer, :size_t], :int
111
111
 
112
- #attach_function :msgpack_pack_raw_body, [:pointer, :pointer, :size_t], :int
112
+ #attach_function :msgpack_pack_raw_body, [:pointer, :buffer_in, :size_t], :int
113
113
 
114
114
  attach_function :msgpack_pack_object, [:pointer, MsgObject.by_value], :int
115
115
 
@@ -97,10 +97,10 @@ module FFI
97
97
  # The new callback.
98
98
  #
99
99
  def callback(&block)
100
- self[:callback] = Proc.new do |data_ptr,packed_ptr,length|
100
+ self[:callback] = Proc.new do |data_ptr,packed_buffer,length|
101
101
  @total += length
102
102
 
103
- packed = packed_ptr.get_bytes(0,length)
103
+ packed = packed_buffer.get_bytes(0,length)
104
104
 
105
105
  if block.arity == 2
106
106
  block.call(packed,length)
metadata CHANGED
@@ -1,76 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ffi-msgpack
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
4
5
  prerelease:
5
- version: 0.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Postmodern
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-02-18 00:00:00 -08:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: ffi
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.6.0
25
- - - <=
26
- - !ruby/object:Gem::Version
27
- version: 1.1.0
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
28
22
  type: :runtime
29
- version_requirements: *id001
30
- - !ruby/object:Gem::Dependency
31
- name: ore-tasks
32
23
  prerelease: false
33
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
34
25
  none: false
35
- requirements:
26
+ requirements:
36
27
  - - ~>
37
- - !ruby/object:Gem::Version
38
- version: "0.4"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !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'
39
38
  type: :development
40
- version_requirements: *id002
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
39
  prerelease: false
44
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
45
41
  none: false
46
- requirements:
42
+ requirements:
47
43
  - - ~>
48
- - !ruby/object:Gem::Version
49
- version: "2.4"
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'
50
54
  type: :development
51
- version_requirements: *id003
52
- - !ruby/object:Gem::Dependency
53
- name: yard
54
55
  prerelease: false
55
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
56
57
  none: false
57
- requirements:
58
+ requirements:
58
59
  - - ~>
59
- - !ruby/object:Gem::Version
60
- version: 0.6.0
60
+ - !ruby/object:Gem::Version
61
+ version: '2.4'
62
+ - !ruby/object:Gem::Dependency
63
+ name: yard
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '0.7'
61
70
  type: :development
62
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.7'
63
78
  description: Ruby FFI bindings for the msgpack library.
64
- email:
65
- - postmodern.mod3@gmail.com
79
+ email: postmodern.mod3@gmail.com
66
80
  executables: []
67
-
68
81
  extensions: []
69
-
70
- extra_rdoc_files:
82
+ extra_rdoc_files:
83
+ - ChangeLog.md
84
+ - LICENSE.txt
71
85
  - README.md
72
- files:
86
+ files:
73
87
  - .gemtest
88
+ - .gitignore
74
89
  - .rspec
75
90
  - .yardopts
76
91
  - ChangeLog.md
@@ -119,44 +134,42 @@ files:
119
134
  - spec/packer_spec.rb
120
135
  - spec/spec_helper.rb
121
136
  - spec/unpacker_spec.rb
122
- has_rdoc: true
123
- homepage: http://github.com/postmodern/ffi-msgpack
124
- licenses:
137
+ homepage: https://github.com/postmodern/ffi-msgpack
138
+ licenses:
125
139
  - MIT
126
140
  post_install_message:
127
141
  rdoc_options: []
128
-
129
- require_paths:
142
+ require_paths:
130
143
  - lib
131
- required_ruby_version: !ruby/object:Gem::Requirement
144
+ required_ruby_version: !ruby/object:Gem::Requirement
132
145
  none: false
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: "0"
137
- required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
151
  none: false
139
- requirements:
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: "0"
143
- requirements:
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements:
144
157
  - libmsgpack >= 0.5.0
145
- rubyforge_project: ffi-msgpack
146
- rubygems_version: 1.5.0
158
+ rubyforge_project:
159
+ rubygems_version: 1.8.24
147
160
  signing_key:
148
161
  specification_version: 3
149
162
  summary: FFI bindings for msgpack
150
- test_files:
151
- - spec/msg_object_spec.rb
152
- - spec/packer_spec.rb
153
- - spec/unpacker_spec.rb
154
- - spec/extensions/integer_spec.rb
155
- - spec/extensions/true_class_spec.rb
163
+ test_files:
156
164
  - spec/extensions/array_spec.rb
157
165
  - spec/extensions/false_class_spec.rb
158
166
  - spec/extensions/float_spec.rb
159
- - spec/extensions/symbol_spec.rb
160
- - spec/extensions/string_spec.rb
161
- - spec/extensions/nil_class_spec.rb
162
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