identifier 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/identifier.rb ADDED
@@ -0,0 +1,25 @@
1
+ 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
+ end
@@ -1,3 +1,3 @@
1
1
  module Identifier
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 5
9
+ version: 1.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Sylvestre
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-23 00:00:00 -05:00
17
+ date: 2010-12-24 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and OS X 'uuidgen'.
21
+ description: Identifier is a Ruby unique identifier generator that wraps the UNIX, Linux and OS X 'uuid' library.
22
22
  email:
23
23
  - kevin@ksylvest.com
24
24
  executables: []
@@ -29,7 +29,7 @@ extra_rdoc_files: []
29
29
 
30
30
  files:
31
31
  - lib/identifier/version.rb
32
- - ext/identifier.c
32
+ - lib/identifier.rb
33
33
  - README.rdoc
34
34
  - LICENSE
35
35
  - Gemfile
data/ext/identifier.c DELETED
@@ -1,21 +0,0 @@
1
- #include "ruby.h"
2
-
3
- #include <uuid/uuid.h>
4
-
5
- VALUE method_generate(VALUE self);
6
-
7
- void Init_identifier() {
8
- Identifier = rb_define_module("Identifier");
9
- rb_define_method(Identifier, "generate", method_generate, 0);
10
- }
11
-
12
- VALUE method_generate(VALUE self)
13
- {
14
- uuid_t uuid;
15
- char result[38];
16
-
17
- uuid_generate(uuid);
18
- uuid_unparse(uuid, result);
19
-
20
- return StringValue(result);
21
- }