identifier 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.rdoc +3 -3
- data/ext/identifier/extconf.rb +5 -0
- data/ext/identifier/identifier.c +21 -0
- data/lib/identifier.rb +2 -23
- data/lib/identifier/version.rb +1 -1
- metadata +9 -17
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Identifier
|
2
2
|
|
3
|
-
Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and
|
3
|
+
Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and Macintosh library 'uuid'.
|
4
4
|
|
5
5
|
== Installation
|
6
6
|
|
@@ -8,7 +8,7 @@ Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and
|
|
8
8
|
|
9
9
|
== Requirements
|
10
10
|
|
11
|
-
A UNIX, Linux or
|
11
|
+
A UNIX, Linux, or Macintosh system with 'uuid' library installed.
|
12
12
|
|
13
13
|
== Examples
|
14
14
|
|
@@ -16,4 +16,4 @@ A UNIX, Linux or Mac OS X system with 'uuidgen' installed and included in the PA
|
|
16
16
|
|
17
17
|
== Copyright
|
18
18
|
|
19
|
-
Copyright (c) 2010 Kevin Sylvestre. See LICENSE for details.
|
19
|
+
Copyright (c) 2010 - 2011 Kevin Sylvestre. See LICENSE for details.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <uuid/uuid.h>
|
3
|
+
|
4
|
+
VALUE Identifier;
|
5
|
+
|
6
|
+
VALUE method_generate(VALUE self)
|
7
|
+
{
|
8
|
+
char result[] = "00000000-0000-0000-0000-000000000000";
|
9
|
+
|
10
|
+
uuid_t uuid;
|
11
|
+
uuid_generate(uuid);
|
12
|
+
uuid_unparse(uuid, result);
|
13
|
+
|
14
|
+
return rb_str_new(result, strlen(result));
|
15
|
+
}
|
16
|
+
|
17
|
+
void Init_identifier()
|
18
|
+
{
|
19
|
+
Identifier = rb_define_module("Identifier");
|
20
|
+
rb_define_singleton_method(Identifier, "generate", method_generate, 0);
|
21
|
+
}
|
data/lib/identifier.rb
CHANGED
@@ -1,25 +1,4 @@
|
|
1
|
+
require 'identifier/identifier'
|
2
|
+
|
1
3
|
module Identifier
|
2
|
-
|
3
|
-
# Generate a universally unique identifier on a UNIX, Linx or Mac OS X system.
|
4
|
-
#
|
5
|
-
# Usage:
|
6
|
-
#
|
7
|
-
# Identifier.generate # 53FB3F0B-C19A-41E1-8718-5BABE85CD341
|
8
|
-
|
9
|
-
def self.generate
|
10
|
-
begin
|
11
|
-
result = `uuidgen`
|
12
|
-
rescue Errno::ENOENT
|
13
|
-
result = `/bin/uuidgen`
|
14
|
-
rescue Errno::ENOENT
|
15
|
-
result = `/sbin/uuidgen`
|
16
|
-
rescue Errno::ENOENT
|
17
|
-
result = `/usr/bin/uuidgen`
|
18
|
-
rescue Errno::ENOENT
|
19
|
-
result = `/usr/sbin/uuidgen`
|
20
|
-
end
|
21
|
-
|
22
|
-
result.strip
|
23
|
-
end
|
24
|
-
|
25
4
|
end
|
data/lib/identifier/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
version: 1.0.5
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.6
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Kevin Sylvestre
|
@@ -14,26 +10,26 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
13
|
+
date: 2011-06-25 00:00:00 Z
|
19
14
|
dependencies: []
|
20
15
|
|
21
|
-
description: Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and
|
16
|
+
description: Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and Macintosh 'uuid' library.
|
22
17
|
email:
|
23
18
|
- kevin@ksylvest.com
|
24
19
|
executables: []
|
25
20
|
|
26
|
-
extensions:
|
27
|
-
|
21
|
+
extensions:
|
22
|
+
- ext/identifier/extconf.rb
|
28
23
|
extra_rdoc_files: []
|
29
24
|
|
30
25
|
files:
|
26
|
+
- ext/identifier/extconf.rb
|
27
|
+
- ext/identifier/identifier.c
|
31
28
|
- lib/identifier/version.rb
|
32
29
|
- lib/identifier.rb
|
33
30
|
- README.rdoc
|
34
31
|
- LICENSE
|
35
32
|
- Gemfile
|
36
|
-
has_rdoc: true
|
37
33
|
homepage: http://github.com/ksylvest/identifier
|
38
34
|
licenses: []
|
39
35
|
|
@@ -47,21 +43,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
43
|
requirements:
|
48
44
|
- - ">="
|
49
45
|
- !ruby/object:Gem::Version
|
50
|
-
segments:
|
51
|
-
- 0
|
52
46
|
version: "0"
|
53
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
48
|
none: false
|
55
49
|
requirements:
|
56
50
|
- - ">="
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
52
|
version: "0"
|
61
53
|
requirements: []
|
62
54
|
|
63
55
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.
|
56
|
+
rubygems_version: 1.8.5
|
65
57
|
signing_key:
|
66
58
|
specification_version: 3
|
67
59
|
summary: A very basic unique identifier
|