jamescook-uuid 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +96 -0
- metadata +68 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2005-2008 Assaf Arkin, Eric Hodel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
= UUID Generator
|
2
|
+
|
3
|
+
Generates universally unique identifiers (UUIDs) for use in distributed
|
4
|
+
applications. Based on {RFC 4122}[http://www.ietf.org/rfc/rfc4122.txt].
|
5
|
+
|
6
|
+
|
7
|
+
== Generating UUIDs
|
8
|
+
|
9
|
+
Call #generate to generate a new UUID. The method returns a string in one of
|
10
|
+
three formats. The default format is 36 characters long, and contains the 32
|
11
|
+
hexadecimal octets and hyphens separating the various value parts. The
|
12
|
+
<tt>:compact</tt> format omits the hyphens, while the <tt>:urn</tt> format
|
13
|
+
adds the <tt>:urn:uuid</tt> prefix.
|
14
|
+
|
15
|
+
For example:
|
16
|
+
|
17
|
+
uuid = UUID.new
|
18
|
+
10.times do
|
19
|
+
p uuid.generate
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
== UUIDs in Brief
|
24
|
+
|
25
|
+
UUID (universally unique identifier) are guaranteed to be unique across time
|
26
|
+
and space.
|
27
|
+
|
28
|
+
A UUID is 128 bit long, and consists of a 60-bit time value, a 16-bit
|
29
|
+
sequence number and a 48-bit node identifier.
|
30
|
+
|
31
|
+
The time value is taken from the system clock, and is monotonically
|
32
|
+
incrementing. However, since it is possible to set the system clock
|
33
|
+
backward, a sequence number is added. The sequence number is incremented
|
34
|
+
each time the UUID generator is started. The combination guarantees that
|
35
|
+
identifiers created on the same machine are unique with a high degree of
|
36
|
+
probability.
|
37
|
+
|
38
|
+
Note that due to the structure of the UUID and the use of sequence number,
|
39
|
+
there is no guarantee that UUID values themselves are monotonically
|
40
|
+
incrementing. The UUID value cannot itself be used to sort based on order
|
41
|
+
of creation.
|
42
|
+
|
43
|
+
To guarantee that UUIDs are unique across all machines in the network,
|
44
|
+
the IEEE 802 MAC address of the machine's network interface card is used as
|
45
|
+
the node identifier.
|
46
|
+
|
47
|
+
For more information see {RFC 4122}[http://www.ietf.org/rfc/rfc4122.txt].
|
48
|
+
|
49
|
+
|
50
|
+
== UUID State File
|
51
|
+
|
52
|
+
The UUID generator uses a state file to hold the MAC address and sequence
|
53
|
+
number.
|
54
|
+
|
55
|
+
The MAC address is used to generate identifiers that are unique to your
|
56
|
+
machine, preventing conflicts in distributed applications. The MAC
|
57
|
+
address is six bytes (48 bit) long. It is automatically extracted from
|
58
|
+
one of the network cards on your machine.
|
59
|
+
|
60
|
+
The sequence number is incremented each time the UUID generator is
|
61
|
+
first used by the application, to prevent multiple processes from
|
62
|
+
generating the same set of identifiers, and deal with changes to the
|
63
|
+
system clock.
|
64
|
+
|
65
|
+
The UUID state file is created in <tt>/var/tmp/ruby-uuid</tt> or the Windows
|
66
|
+
common application data directory using mode 0644. If that directory is not
|
67
|
+
writable, the file is created as <tt>.ruby-uuid</tt> in the home directory.
|
68
|
+
If you need to create the file with a different mode, use UUID#state_file
|
69
|
+
before running the UUID generator.
|
70
|
+
|
71
|
+
State files are not portable across machines.
|
72
|
+
|
73
|
+
|
74
|
+
== Latest and Greatest
|
75
|
+
|
76
|
+
Stable release are made through RubyForge, to upgrade simply:
|
77
|
+
|
78
|
+
gem upgrade uuid
|
79
|
+
|
80
|
+
You can subscribe for notifications of new releases through the reliable-msg
|
81
|
+
project page at http://rubyforge.org/projects/reliable-msg
|
82
|
+
|
83
|
+
Source code and documentation hosted on Github: http://github.com/assaf/uuid
|
84
|
+
|
85
|
+
To get UUID from source:
|
86
|
+
|
87
|
+
git clone git://github.com/assaf/uuid.git
|
88
|
+
|
89
|
+
|
90
|
+
== License
|
91
|
+
|
92
|
+
This package is licensed under the MIT license and/or the Creative
|
93
|
+
Commons Attribution-ShareAlike.
|
94
|
+
|
95
|
+
:include: MIT-LICENSE
|
96
|
+
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jamescook-uuid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Assaf Arkin
|
8
|
+
- Eric Hodel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-16 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: macaddr
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "1.0"
|
25
|
+
version:
|
26
|
+
description: UUID generator for producing universally unique identifiers based on RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt).
|
27
|
+
email: assaf@labnotes.org
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README.rdoc
|
34
|
+
- MIT-LICENSE
|
35
|
+
files: []
|
36
|
+
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/assaf/uuid
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --main
|
42
|
+
- README.rdoc
|
43
|
+
- --title
|
44
|
+
- UUID generator
|
45
|
+
- --line-numbers
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project: reliable-msg
|
63
|
+
rubygems_version: 1.2.0
|
64
|
+
signing_key:
|
65
|
+
specification_version: 2
|
66
|
+
summary: UUID generator
|
67
|
+
test_files: []
|
68
|
+
|