uuid4r 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/extconf.rb +9 -5
- data/ext/uuid4r.c +5 -5
- data/test/test_uuid.rb +7 -7
- metadata +43 -33
data/ext/extconf.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'mkmf'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
|
3
|
+
if File.exist?(`which uuid-config`.chomp)
|
4
|
+
$CFLAGS << " -Wall " << `uuid-config --cflags`.chomp
|
5
|
+
$LDFLAGS << " " << `uuid-config --ldflags`.chomp
|
6
|
+
end
|
7
|
+
|
8
|
+
if !have_library('uuid')
|
9
|
+
puts "OSSP uuid library required -- not found."
|
6
10
|
exit 1
|
7
11
|
end
|
8
12
|
create_makefile('uuid4r')
|
9
13
|
File.open("Makefile", "a") << <<-EOT
|
10
14
|
|
11
15
|
check: $(DLLIB)
|
12
|
-
@$(RUBY)
|
16
|
+
@$(RUBY) #{File.dirname(__FILE__)}/../test/test_uuid.rb
|
13
17
|
EOT
|
data/ext/uuid4r.c
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
#include "ruby.h"
|
27
|
-
#include "
|
27
|
+
#include "uuid.h"
|
28
28
|
|
29
29
|
VALUE rb_cUUID4R;
|
30
30
|
VALUE rb_cUUID4RCommon;
|
@@ -162,7 +162,7 @@ uuid4r_import(self, format, str)
|
|
162
162
|
uuid_create(&uuid);
|
163
163
|
fmt = rb2uuid_fmt(format);
|
164
164
|
StringValue(str);
|
165
|
-
uuid_import(uuid, fmt,
|
165
|
+
uuid_import(uuid, fmt, RSTRING_PTR(str), RSTRING_LEN(str));
|
166
166
|
|
167
167
|
return Data_Wrap_Struct(rb_cUUID4RCommon, 0, uuid4r_free, uuid);
|
168
168
|
}
|
@@ -268,7 +268,7 @@ uuid4r_uuid(argc, argv, self)
|
|
268
268
|
uuid_t *uuid_ns;
|
269
269
|
char *uuid_ns_str;
|
270
270
|
uuid_fmt_t fmt;
|
271
|
-
unsigned int mode;
|
271
|
+
unsigned int mode = 0; /* suppress compiler warning */
|
272
272
|
uuid_t *uuid;
|
273
273
|
VALUE result;
|
274
274
|
|
@@ -277,7 +277,7 @@ uuid4r_uuid(argc, argv, self)
|
|
277
277
|
|
278
278
|
switch (argc) {
|
279
279
|
case 1:
|
280
|
-
rb_scan_args(argc, argv, "11", &version);
|
280
|
+
rb_scan_args(argc, argv, "11", &version, &format);
|
281
281
|
fmt = UUID_FMT_STR;
|
282
282
|
break;
|
283
283
|
case 2:
|
@@ -285,7 +285,7 @@ uuid4r_uuid(argc, argv, self)
|
|
285
285
|
fmt = rb2uuid_fmt(format);
|
286
286
|
break;
|
287
287
|
case 3:
|
288
|
-
rb_scan_args(argc, argv, "31", &version, &namespace, &namespace_str);
|
288
|
+
rb_scan_args(argc, argv, "31", &version, &namespace, &namespace_str, &format);
|
289
289
|
fmt = UUID_FMT_STR;
|
290
290
|
break;
|
291
291
|
case 4:
|
data/test/test_uuid.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require '
|
2
|
+
require 'uuid4r.so'
|
3
3
|
|
4
4
|
class UUIDTest < Test::Unit::TestCase
|
5
5
|
def test_uuid_v1_default
|
@@ -25,9 +25,9 @@ class UUIDTest < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
def test_uuid_v1_txt
|
27
27
|
assert_kind_of(String, UUID4R::uuid_v1(:txt))
|
28
|
-
assert(
|
29
|
-
assert(
|
30
|
-
assert(
|
28
|
+
assert(/variant: DCE 1.1/ =~ UUID4R::uuid_v1(:txt))
|
29
|
+
assert(/version: 1/ =~ UUID4R::uuid_v1(:txt))
|
30
|
+
assert(/content:/ =~ UUID4R::uuid_v1(:txt))
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_uuid_v3_str
|
@@ -73,9 +73,9 @@ class UUID4Rv1Test < Test::Unit::TestCase
|
|
73
73
|
|
74
74
|
def test_compare
|
75
75
|
uuid2 = UUID4R::UUID4Rv1.new
|
76
|
-
assert(@uuid.compare(uuid2)
|
77
|
-
assert(@uuid.compare(@uuid) ==
|
78
|
-
assert(uuid2.compare(@uuid)
|
76
|
+
assert(@uuid.compare(uuid2) == -1)
|
77
|
+
assert(@uuid.compare(@uuid) == 0)
|
78
|
+
assert(uuid2.compare(@uuid) == 1)
|
79
79
|
assert_equal(-1, @uuid <=> uuid2)
|
80
80
|
assert_equal( 0, @uuid <=> @uuid)
|
81
81
|
assert_equal( 1, uuid2 <=> @uuid)
|
metadata
CHANGED
@@ -1,52 +1,62 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.11
|
3
|
-
specification_version: 1
|
4
2
|
name: uuid4r
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2006-05-24 00:00:00 +09:00
|
8
|
-
summary: This generates and parses UUID, based on OSSP uuid C library.
|
9
|
-
require_paths:
|
10
|
-
- .
|
11
|
-
email: daigo@debian.org
|
12
|
-
homepage: http://uuid4r.rubyforge.org
|
13
|
-
rubyforge_project: uuid4r
|
14
|
-
description: This library generates and parses Universally Unique Identifier (UUID), based on OSSP uuid C library. So, libossp-uuid library is pre-required. OSSP uuid (http://www.ossp.org/pkg/lib/uuid/) is a ISO-C:1999 application programming interface (API) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant UUID. It supports DCE 1.1 variant UUIDs of version 1 (time and node based), version 3 (name based, MD5), version 4 (random number based) and version 5 (name based, SHA-1).
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.1.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
6
|
authors:
|
29
7
|
- Daigo Moriwaki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-12 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: " This library generates and parses Universally Unique Identifier (UUID),\n based on OSSP uuid C library. So, libossp-uuid library is pre-required.\n OSSP uuid (http://www.ossp.org/pkg/lib/uuid/) is a ISO-C:1999 application\n programming interface (API) for the generation of DCE 1.1, ISO/IEC\n 11578:1996 and RFC 4122 compliant UUID. It supports DCE 1.1 variant UUIDs\n of version 1 (time and node based), version 3 (name based, MD5), version 4\n (random number based) and version 5 (name based, SHA-1).\n"
|
17
|
+
email: daigo@debian.org
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions:
|
21
|
+
- ext/extconf.rb
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
30
24
|
files:
|
31
25
|
- ext/extconf.rb
|
32
26
|
- ext/uuid4r.c
|
33
27
|
- test/test_uuid.rb
|
34
28
|
- README
|
35
|
-
|
36
|
-
|
29
|
+
has_rdoc: true
|
30
|
+
homepage: http://uuid4r.rubyforge.org
|
31
|
+
licenses: []
|
32
|
+
|
33
|
+
post_install_message:
|
37
34
|
rdoc_options:
|
38
35
|
- --title
|
39
36
|
- UUID4R
|
40
37
|
- --main
|
41
38
|
- README
|
42
39
|
- --line-numbers
|
43
|
-
|
44
|
-
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
-
|
40
|
+
require_paths:
|
41
|
+
- .
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
49
54
|
requirements: []
|
50
55
|
|
51
|
-
|
52
|
-
|
56
|
+
rubyforge_project: uuid4r
|
57
|
+
rubygems_version: 1.3.5
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: This generates and parses UUID, based on OSSP uuid C library.
|
61
|
+
test_files:
|
62
|
+
- test/test_uuid.rb
|