ffi-uuid 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +9 -2
- data/VERSION +1 -1
- data/ffi-uuid.gemspec +14 -16
- data/lib/ffi/ffi_uuid_impl.rb +12 -3
- data/test/test_ffi_uuid.rb +3 -3
- metadata +5 -10
- data/.gitignore +0 -21
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
FFI Wrapper for libuuid. Access to the basic functions is provided as well as extra helpers to make usage friendlier.
|
4
4
|
|
5
5
|
== Note on Patches/Pull Requests
|
6
|
-
|
7
6
|
* Fork the project.
|
8
7
|
* Make your feature addition or bug fix.
|
9
8
|
* Add tests for it. This is important so I don't break it in a
|
@@ -12,6 +11,14 @@ FFI Wrapper for libuuid. Access to the basic functions is provided as well as ex
|
|
12
11
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
12
|
* Send me a pull request. Bonus points for topic branches.
|
14
13
|
|
14
|
+
== Contributors
|
15
|
+
Michael Mullis
|
16
|
+
textserv (via blog comment)
|
17
|
+
|
18
|
+
== License
|
19
|
+
|
20
|
+
ffi-uuid uses the MIT license. Please check the LICENSE file for more details.
|
21
|
+
|
15
22
|
== Copyright
|
16
23
|
|
17
|
-
Copyright (c) 2010 Michael Mullis. See LICENSE for details.
|
24
|
+
Copyright (c) 2010-2011 Michael Mullis. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/ffi-uuid.gemspec
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ffi-uuid}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Mullis"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-06}
|
13
13
|
s.description = %q{FFI Wrapper for libuuid with extra helpers for common UUID tasks like getting an array of uuids for quicker distribution}
|
14
14
|
s.email = %q{michael@mullistechnologies.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"test/test_ffi_uuid.rb"
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"ffi-uuid.gemspec",
|
26
|
+
"lib/ffi-uuid.rb",
|
27
|
+
"lib/ffi/ffi_uuid_impl.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_ffi_uuid.rb"
|
31
30
|
]
|
32
31
|
s.homepage = %q{http://github.com/mmullis/ffi-uuid}
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
32
|
s.require_paths = ["lib"]
|
35
33
|
s.rubygems_version = %q{1.3.7}
|
36
34
|
s.summary = %q{FFI Wrapper for libuuidm}
|
37
35
|
s.test_files = [
|
38
36
|
"test/helper.rb",
|
39
|
-
|
37
|
+
"test/test_ffi_uuid.rb"
|
40
38
|
]
|
41
39
|
|
42
40
|
if s.respond_to? :specification_version then
|
data/lib/ffi/ffi_uuid_impl.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'ffi'
|
3
3
|
|
4
|
-
# uuid_generate_xxx
|
4
|
+
# uuid_generate_xxx takex uuid_t which is a 16 byte unsigned char
|
5
5
|
# that is directly updated - treat like a bang! method
|
6
6
|
|
7
7
|
class FFI::UUID
|
@@ -9,8 +9,17 @@ class FFI::UUID
|
|
9
9
|
|
10
10
|
# load our custom C library and attach
|
11
11
|
# FFI functions to our Ruby runtime
|
12
|
-
# unfortunately, linux doesnt set libsuid.so
|
13
|
-
|
12
|
+
# unfortunately, linux doesnt set libsuid.so
|
13
|
+
# MAC OS X Notes:
|
14
|
+
# libSystem.B supports Mac OS X without other packages.
|
15
|
+
# It's useful if libuuid is not installed from a ports or fink package.
|
16
|
+
# libSystem.B is listed last so that a libuuid installed will get picked up first.
|
17
|
+
# To get libuuid picked up,
|
18
|
+
# export DYLD_FALLBACK_LIBRARY_PATH=<location of libuuid>
|
19
|
+
# e.g
|
20
|
+
# export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:/usr/lib
|
21
|
+
|
22
|
+
ffi_lib(["uuid", "libuuid", "libuuid.so", "libuuid.so.1", "libSystem.B"])
|
14
23
|
|
15
24
|
functions = [
|
16
25
|
# method # parameters # return
|
data/test/test_ffi_uuid.rb
CHANGED
@@ -17,15 +17,15 @@ class TestFfiUuid < Test::Unit::TestCase
|
|
17
17
|
def test_get_uuid
|
18
18
|
unparsed = nil
|
19
19
|
sample_uuid = nil
|
20
|
-
num_uuids =
|
20
|
+
num_uuids = 100_000
|
21
21
|
1.times {
|
22
22
|
sample_uuid = FFI::UUID.get_uuids(num_uuids)
|
23
23
|
assert sample_uuid.length == num_uuids
|
24
24
|
assert sample_uuid.is_a?(Array)
|
25
25
|
assert_equal(36, sample_uuid[0].length)
|
26
|
-
|
26
|
+
|
27
27
|
unparsed = FFI::UUID.unparse(sample_uuid[0])
|
28
|
-
|
28
|
+
|
29
29
|
assert_equal( 36, unparsed.length)
|
30
30
|
assert_equal(unparsed.split(/\-/).length, 5)
|
31
31
|
}
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-uuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 31
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Michael Mullis
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-02-06 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 1
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
- 6
|
@@ -45,7 +43,6 @@ extra_rdoc_files:
|
|
45
43
|
- README.rdoc
|
46
44
|
files:
|
47
45
|
- .document
|
48
|
-
- .gitignore
|
49
46
|
- LICENSE
|
50
47
|
- README.rdoc
|
51
48
|
- Rakefile
|
@@ -60,8 +57,8 @@ homepage: http://github.com/mmullis/ffi-uuid
|
|
60
57
|
licenses: []
|
61
58
|
|
62
59
|
post_install_message:
|
63
|
-
rdoc_options:
|
64
|
-
|
60
|
+
rdoc_options: []
|
61
|
+
|
65
62
|
require_paths:
|
66
63
|
- lib
|
67
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -69,7 +66,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
66
|
requirements:
|
70
67
|
- - ">="
|
71
68
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
69
|
segments:
|
74
70
|
- 0
|
75
71
|
version: "0"
|
@@ -78,7 +74,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
74
|
requirements:
|
79
75
|
- - ">="
|
80
76
|
- !ruby/object:Gem::Version
|
81
|
-
hash: 3
|
82
77
|
segments:
|
83
78
|
- 0
|
84
79
|
version: "0"
|