uuidtools 1.0.3 → 1.0.4
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/CHANGELOG +9 -1
- data/LICENSE +20 -0
- data/Rakefile +44 -0
- data/lib/uuidtools.rb +91 -135
- data/lib/uuidtools/version.rb +3 -3
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/uuidtools/mac_address_spec.rb +15 -0
- data/spec/uuidtools/uuid_creation_spec.rb +37 -0
- data/spec/uuidtools/uuid_parsing_spec.rb +36 -0
- data/tasks/benchmark.rake +38 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +62 -0
- data/tasks/git.rake +40 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +29 -0
- data/tasks/rubyforge.rake +78 -0
- data/tasks/spec.rake +89 -0
- data/website/index.html +95 -0
- metadata +49 -19
- data/rakefile +0 -185
- data/test/create_test.rb +0 -41
- data/test/mac_address_test.rb +0 -13
- data/test/parse_test.rb +0 -0
data/website/index.html
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8"/>
|
5
|
+
<title>UUIDTools</title>
|
6
|
+
<style type="text/css">
|
7
|
+
* {
|
8
|
+
font-size: 100%;
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
body {
|
14
|
+
font-family: "Lucida Grande", Verdana, sans-serif;
|
15
|
+
margin: 1em;
|
16
|
+
}
|
17
|
+
|
18
|
+
a {
|
19
|
+
color: #880000;
|
20
|
+
}
|
21
|
+
|
22
|
+
a:visited {
|
23
|
+
color: #333333;
|
24
|
+
}
|
25
|
+
|
26
|
+
h1 {
|
27
|
+
font-size: 2em;
|
28
|
+
margin: 0 0 0.8em 0;
|
29
|
+
text-align: center;
|
30
|
+
}
|
31
|
+
|
32
|
+
h2 {
|
33
|
+
font-size: 1em;
|
34
|
+
margin: 0.8em 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
p {
|
38
|
+
margin: 0.8em 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
ul {
|
42
|
+
font-size: 0.9em;
|
43
|
+
margin: 0 0 0 1.5em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div {
|
47
|
+
width: 50%;
|
48
|
+
margin: 0 auto;
|
49
|
+
padding: 0.8em;
|
50
|
+
background-color: #AA5852;
|
51
|
+
border: 2px solid #C2645D;
|
52
|
+
}
|
53
|
+
|
54
|
+
@media print {
|
55
|
+
body {
|
56
|
+
font-size: 0.9em;
|
57
|
+
}
|
58
|
+
|
59
|
+
a {
|
60
|
+
text-decoration: none;
|
61
|
+
color: #000;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
</head>
|
66
|
+
<body>
|
67
|
+
<h1>UUIDTools</h1>
|
68
|
+
<div>
|
69
|
+
<p>
|
70
|
+
A simple universally unique ID generation library.
|
71
|
+
</p>
|
72
|
+
<ul>
|
73
|
+
<li>
|
74
|
+
<a href="http://rubyforge.org/projects/uuidtools/">
|
75
|
+
Project Page
|
76
|
+
</a>
|
77
|
+
</li>
|
78
|
+
<li>
|
79
|
+
<a href="http://github.com/sporkmonger/uuidtools/tree/">
|
80
|
+
GitHub Page
|
81
|
+
</a>
|
82
|
+
</li>
|
83
|
+
<li><a href="/api/">API</a></li>
|
84
|
+
<li><a href="/specdoc/">Specifications</a></li>
|
85
|
+
<li><a href="/coverage/">Code Coverage</a></li>
|
86
|
+
</ul>
|
87
|
+
<p>
|
88
|
+
You know what to do:
|
89
|
+
</p>
|
90
|
+
<p>
|
91
|
+
<code>sudo gem install uuidtools</code>
|
92
|
+
</p>
|
93
|
+
</div>
|
94
|
+
</body>
|
95
|
+
</html>
|
metadata
CHANGED
@@ -1,19 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uuidtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-29 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.7.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.8
|
34
|
+
version:
|
35
|
+
description: A simple universally unique ID generation library.
|
17
36
|
email: bob@sporkmonger.com
|
18
37
|
executables: []
|
19
38
|
|
@@ -22,17 +41,30 @@ extensions: []
|
|
22
41
|
extra_rdoc_files:
|
23
42
|
- README
|
24
43
|
files:
|
25
|
-
- rakefile
|
26
|
-
- README
|
27
|
-
- CHANGELOG
|
28
44
|
- lib/uuidtools
|
29
45
|
- lib/uuidtools/version.rb
|
30
46
|
- lib/uuidtools.rb
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
47
|
+
- spec/spec.opts
|
48
|
+
- spec/spec_helper.rb
|
49
|
+
- spec/uuidtools
|
50
|
+
- spec/uuidtools/mac_address_spec.rb
|
51
|
+
- spec/uuidtools/uuid_creation_spec.rb
|
52
|
+
- spec/uuidtools/uuid_parsing_spec.rb
|
53
|
+
- tasks/benchmark.rake
|
54
|
+
- tasks/clobber.rake
|
55
|
+
- tasks/gem.rake
|
56
|
+
- tasks/git.rake
|
57
|
+
- tasks/metrics.rake
|
58
|
+
- tasks/rdoc.rake
|
59
|
+
- tasks/rubyforge.rake
|
60
|
+
- tasks/spec.rake
|
61
|
+
- website/index.html
|
62
|
+
- CHANGELOG
|
63
|
+
- LICENSE
|
64
|
+
- Rakefile
|
65
|
+
- README
|
34
66
|
has_rdoc: true
|
35
|
-
homepage: http://
|
67
|
+
homepage: http://uuidtools.rubyforge.org/
|
36
68
|
post_install_message:
|
37
69
|
rdoc_options:
|
38
70
|
- --main
|
@@ -54,11 +86,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
86
|
requirements: []
|
55
87
|
|
56
88
|
rubyforge_project: uuidtools
|
57
|
-
rubygems_version: 1.
|
89
|
+
rubygems_version: 1.2.0
|
58
90
|
signing_key:
|
59
91
|
specification_version: 2
|
60
|
-
summary:
|
61
|
-
test_files:
|
62
|
-
|
63
|
-
- test/mac_address_test.rb
|
64
|
-
- test/parse_test.rb
|
92
|
+
summary: UUID generator
|
93
|
+
test_files: []
|
94
|
+
|
data/rakefile
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/packagetask'
|
6
|
-
require 'rake/gempackagetask'
|
7
|
-
require 'rake/contrib/rubyforgepublisher'
|
8
|
-
|
9
|
-
require File.join(File.dirname(__FILE__), 'lib/uuidtools', 'version')
|
10
|
-
|
11
|
-
PKG_NAME = 'uuidtools'
|
12
|
-
PKG_VERSION = UUID::UUID_TOOLS_VERSION::STRING
|
13
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
|
-
|
15
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
16
|
-
|
17
|
-
RUBY_FORGE_PROJECT = PKG_NAME
|
18
|
-
RUBY_FORGE_USER = "sporkmonger"
|
19
|
-
RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
|
20
|
-
|
21
|
-
PKG_FILES = FileList[
|
22
|
-
"lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "[A-Z]*", "rakefile"
|
23
|
-
].exclude(/\bCVS\b|~$/).exclude(/database\.yml/)
|
24
|
-
|
25
|
-
desc "Default Task"
|
26
|
-
task :default => [ :test_all ]
|
27
|
-
|
28
|
-
# Run the unit tests
|
29
|
-
|
30
|
-
Rake::TestTask.new("test_all") { |t|
|
31
|
-
t.libs << "test"
|
32
|
-
t.pattern = 'test/*_test.rb'
|
33
|
-
t.verbose = true
|
34
|
-
}
|
35
|
-
|
36
|
-
# Generate the RDoc documentation
|
37
|
-
|
38
|
-
Rake::RDocTask.new { |rdoc|
|
39
|
-
rdoc.rdoc_dir = 'doc'
|
40
|
-
rdoc.title = "UUID Tools -- universally unique id generation tools"
|
41
|
-
rdoc.options << '--line-numbers' << '--inline-source' <<
|
42
|
-
'--accessor' << 'cattr_accessor=object'
|
43
|
-
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
44
|
-
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
45
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
-
}
|
47
|
-
|
48
|
-
# Create compressed packages
|
49
|
-
|
50
|
-
dist_dirs = [ "lib", "test" ]
|
51
|
-
|
52
|
-
spec = Gem::Specification.new do |s|
|
53
|
-
s.name = PKG_NAME
|
54
|
-
s.version = PKG_VERSION
|
55
|
-
s.summary = "Generation of UUIDs."
|
56
|
-
s.description = "Implements a simple system for generating UUIDs."
|
57
|
-
|
58
|
-
s.files = [ "rakefile", "README", "CHANGELOG" ]
|
59
|
-
dist_dirs.each do |dir|
|
60
|
-
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if do |item|
|
61
|
-
item.include?( "\.svn" ) || item.include?( "database\.yml" )
|
62
|
-
end
|
63
|
-
end
|
64
|
-
s.test_files = Dir.glob('test/**/*_test.rb')
|
65
|
-
|
66
|
-
s.require_path = 'lib'
|
67
|
-
s.autorequire = 'uuidtools'
|
68
|
-
|
69
|
-
s.has_rdoc = true
|
70
|
-
s.extra_rdoc_files = %w( README )
|
71
|
-
s.rdoc_options.concat ['--main', 'README']
|
72
|
-
|
73
|
-
s.author = "Bob Aman"
|
74
|
-
s.email = "bob@sporkmonger.com"
|
75
|
-
s.homepage = "http://sporkmonger.com/projects/uuidtools"
|
76
|
-
s.rubyforge_project = "uuidtools"
|
77
|
-
end
|
78
|
-
|
79
|
-
Rake::GemPackageTask.new(spec) do |p|
|
80
|
-
p.gem_spec = spec
|
81
|
-
p.need_tar = true
|
82
|
-
p.need_zip = true
|
83
|
-
end
|
84
|
-
|
85
|
-
task :lines do
|
86
|
-
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
87
|
-
|
88
|
-
for file_name in FileList["lib/**/*.rb"]
|
89
|
-
f = File.open(file_name)
|
90
|
-
|
91
|
-
while line = f.gets
|
92
|
-
lines += 1
|
93
|
-
next if line =~ /^\s*$/
|
94
|
-
next if line =~ /^\s*#/
|
95
|
-
codelines += 1
|
96
|
-
end
|
97
|
-
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
98
|
-
|
99
|
-
total_lines += lines
|
100
|
-
total_codelines += codelines
|
101
|
-
|
102
|
-
lines, codelines = 0, 0
|
103
|
-
end
|
104
|
-
|
105
|
-
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
106
|
-
end
|
107
|
-
|
108
|
-
task :benchmark do
|
109
|
-
require 'lib/uuidtools'
|
110
|
-
require 'benchmark'
|
111
|
-
|
112
|
-
# Version 1
|
113
|
-
result = Benchmark.measure do
|
114
|
-
10000.times do
|
115
|
-
UUID.timestamp_create.to_s
|
116
|
-
end
|
117
|
-
end
|
118
|
-
puts "#{(10000.0 / result.real)} version 1 per second."
|
119
|
-
|
120
|
-
# Version 3
|
121
|
-
result = Benchmark.measure do
|
122
|
-
10000.times do
|
123
|
-
UUID.md5_create(UUID_URL_NAMESPACE,
|
124
|
-
"http://www.ietf.org/rfc/rfc4122.txt").to_s
|
125
|
-
end
|
126
|
-
end
|
127
|
-
puts "#{(10000.0 / result.real)} version 3 per second."
|
128
|
-
|
129
|
-
# Version 4
|
130
|
-
result = Benchmark.measure do
|
131
|
-
10000.times do
|
132
|
-
UUID.random_create.to_s
|
133
|
-
end
|
134
|
-
end
|
135
|
-
puts "#{(10000.0 / result.real)} version 4 per second."
|
136
|
-
|
137
|
-
# Version 5
|
138
|
-
result = Benchmark.measure do
|
139
|
-
10000.times do
|
140
|
-
UUID.sha1_create(UUID_URL_NAMESPACE,
|
141
|
-
"http://www.ietf.org/rfc/rfc4122.txt").to_s
|
142
|
-
end
|
143
|
-
end
|
144
|
-
puts "#{(10000.0 / result.real)} version 5 per second."
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
namespace :publish do
|
150
|
-
desc "Publish the API documentation"
|
151
|
-
task :api => [ "rdoc" ] do
|
152
|
-
Rake::SshDirPublisher.new(
|
153
|
-
"#{RUBY_FORGE_USER}@rubyforge.org",
|
154
|
-
"#{RUBY_FORGE_PATH}/",
|
155
|
-
"doc"
|
156
|
-
).upload
|
157
|
-
end
|
158
|
-
|
159
|
-
desc "Runs all of the publishing tasks"
|
160
|
-
task :all => ["publish:api"] do
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
task :lines do
|
165
|
-
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
166
|
-
|
167
|
-
for file_name in FileList["lib/**/*.rb"]
|
168
|
-
f = File.open(file_name)
|
169
|
-
|
170
|
-
while line = f.gets
|
171
|
-
lines += 1
|
172
|
-
next if line =~ /^\s*$/
|
173
|
-
next if line =~ /^\s*#/
|
174
|
-
codelines += 1
|
175
|
-
end
|
176
|
-
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
177
|
-
|
178
|
-
total_lines += lines
|
179
|
-
total_codelines += codelines
|
180
|
-
|
181
|
-
lines, codelines = 0, 0
|
182
|
-
end
|
183
|
-
|
184
|
-
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
185
|
-
end
|
data/test/create_test.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'uuidtools'
|
3
|
-
|
4
|
-
class CreateTest < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_sha1_create
|
9
|
-
assert_equal(
|
10
|
-
"f2d04685-b787-55da-8644-9bd28a6f5a53",
|
11
|
-
UUID.sha1_create(UUID_URL_NAMESPACE, 'http://sporkmonger.com').to_s)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_md5_create
|
15
|
-
assert_equal(
|
16
|
-
"15074785-9071-3fe3-89bd-876e4b9e919b",
|
17
|
-
UUID.md5_create(UUID_URL_NAMESPACE, 'http://sporkmonger.com').to_s)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_timestamp_create
|
21
|
-
assert_not_equal(
|
22
|
-
UUID.timestamp_create.to_s,
|
23
|
-
UUID.timestamp_create.to_s)
|
24
|
-
current_time = Time.now
|
25
|
-
assert_not_equal(
|
26
|
-
UUID.timestamp_create(current_time).to_s,
|
27
|
-
UUID.timestamp_create(current_time).to_s)
|
28
|
-
uuids = []
|
29
|
-
1000.times do
|
30
|
-
uuids << UUID.timestamp_create
|
31
|
-
end
|
32
|
-
assert_equal(uuids.size, (uuids.map {|x| x.to_s}).uniq.size,
|
33
|
-
"Duplicate timestamp-based UUID generated.")
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_random_create
|
37
|
-
assert_not_equal(
|
38
|
-
UUID.random_create.to_s,
|
39
|
-
UUID.random_create.to_s)
|
40
|
-
end
|
41
|
-
end
|
data/test/mac_address_test.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'uuidtools'
|
3
|
-
|
4
|
-
class MacAddressTest < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_mac_address_object
|
9
|
-
mac_address = UUID.mac_address
|
10
|
-
assert_not_nil(mac_address)
|
11
|
-
assert_equal(mac_address.object_id, UUID.mac_address.object_id)
|
12
|
-
end
|
13
|
-
end
|
data/test/parse_test.rb
DELETED
File without changes
|