uuidtools 2.1.0 → 3.0.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG +23 -0
- data/LICENSE.txt +202 -0
- data/README.md +37 -0
- data/Rakefile +10 -23
- data/lib/uuidtools/version.rb +16 -21
- data/lib/uuidtools.rb +397 -177
- data/spec/spec_helper.rb +2 -0
- data/spec/uuidtools/mac_address_spec.rb +456 -3
- data/spec/uuidtools/utility_spec.rb +5 -5
- data/spec/uuidtools/uuid_creation_spec.rb +51 -41
- data/spec/uuidtools/uuid_parsing_spec.rb +81 -43
- data/tasks/benchmark.rake +46 -27
- data/tasks/gem.rake +31 -18
- data/tasks/rspec.rake +55 -0
- data/tasks/yard.rake +22 -0
- data/uuidtools.gemspec +28 -0
- metadata +84 -71
- data/LICENSE +0 -20
- data/README +0 -13
- data/tasks/clobber.rake +0 -2
- data/tasks/rdoc.rake +0 -29
- data/tasks/rubyforge.rake +0 -89
- data/tasks/spec.rake +0 -64
|
@@ -1,66 +1,84 @@
|
|
|
1
|
-
require File.
|
|
1
|
+
require File.expand_path("../../spec_helper.rb", __FILE__)
|
|
2
2
|
|
|
3
3
|
describe UUIDTools::UUID, "when parsing" do
|
|
4
4
|
it "should correctly parse the MAC address from a timestamp version UUID" do
|
|
5
|
-
UUIDTools::UUID.timestamp_create.mac_address.
|
|
5
|
+
expect(UUIDTools::UUID.timestamp_create.mac_address).to eql(
|
|
6
6
|
UUIDTools::UUID.mac_address
|
|
7
|
+
)
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
it "should correctly parse the variant from a timestamp version UUID" do
|
|
10
|
-
UUIDTools::UUID.timestamp_create.variant.
|
|
11
|
+
expect(UUIDTools::UUID.timestamp_create.variant).to eql(0b100)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
it "should correctly parse the version from a timestamp version UUID" do
|
|
14
|
-
UUIDTools::UUID.timestamp_create.version.
|
|
15
|
+
expect(UUIDTools::UUID.timestamp_create.version).to eql(1)
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
it "should correctly parse the timestamp from a timestamp version UUID" do
|
|
18
|
-
UUIDTools::UUID.timestamp_create.timestamp.
|
|
19
|
-
UUIDTools::UUID.timestamp_create.timestamp.
|
|
19
|
+
expect(UUIDTools::UUID.timestamp_create.timestamp).to be < (Time.now + 1)
|
|
20
|
+
expect(UUIDTools::UUID.timestamp_create.timestamp).to be > (Time.now - 1)
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
it "should not treat a timestamp version UUID as a nil UUID" do
|
|
23
|
-
UUIDTools::UUID.timestamp_create.
|
|
24
|
+
expect(UUIDTools::UUID.timestamp_create).not_to be_nil_uuid
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
it "should not treat a timestamp version UUID as a random node UUID" do
|
|
27
|
-
UUIDTools::UUID.
|
|
28
|
+
allow(UUIDTools::UUID).to receive(:mac_address) { "aa:bb:cc:dd:ee:ff" }
|
|
29
|
+
expect(UUIDTools::UUID.timestamp_create).not_to be_random_node_id
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
it "should treat a timestamp version UUID as a random node UUID " +
|
|
31
33
|
"if there is no MAC address" do
|
|
32
34
|
old_mac_address = UUIDTools::UUID.mac_address
|
|
33
35
|
UUIDTools::UUID.mac_address = nil
|
|
34
|
-
UUIDTools::UUID.timestamp_create.
|
|
36
|
+
expect(UUIDTools::UUID.timestamp_create).to be_random_node_id
|
|
35
37
|
UUIDTools::UUID.mac_address = old_mac_address
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
it "should correctly identify the nil UUID" do
|
|
39
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
41
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to be_nil_uuid
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
it "should correctly identify timestamp version UUIDs as valid" do
|
|
43
|
-
UUIDTools::UUID.timestamp_create.
|
|
45
|
+
expect(UUIDTools::UUID.timestamp_create).to be_valid
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
it "should correctly identify random number version UUIDs as valid" do
|
|
47
|
-
UUIDTools::UUID.random_create.
|
|
49
|
+
expect(UUIDTools::UUID.random_create).to be_valid
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
it "should correctly identify SHA1 hash version UUIDs as valid" do
|
|
51
|
-
UUIDTools::UUID.sha1_create(
|
|
53
|
+
expect(UUIDTools::UUID.sha1_create(
|
|
52
54
|
UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com'
|
|
53
|
-
).
|
|
55
|
+
)).to be_valid
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
it "should correctly identify MD5 hash version UUIDs as valid" do
|
|
57
|
-
UUIDTools::UUID.md5_create(
|
|
59
|
+
expect(UUIDTools::UUID.md5_create(
|
|
58
60
|
UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com'
|
|
59
|
-
).
|
|
61
|
+
)).to be_valid
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
it "should not identify the nil UUID as valid" do
|
|
63
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
65
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).not_to be_valid
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "should not identify UUIDs prefixed by other strings as valid" do
|
|
69
|
+
expect do
|
|
70
|
+
UUIDTools::UUID.parse("bogus\n#{UUIDTools::UUID.random_create}")
|
|
71
|
+
end.to raise_error(ArgumentError)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "should not identify UUIDs suffixed by other strings as valid" do
|
|
75
|
+
expect do
|
|
76
|
+
UUIDTools::UUID.parse("#{UUIDTools::UUID.random_create}\nbogus")
|
|
77
|
+
end.to raise_error(ArgumentError)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should parse v7 UUIDs as valid" do
|
|
81
|
+
expect(UUIDTools::UUID.parse("01957ca6-fc1a-7322-956e-e9e6c53cab55")).to be_valid
|
|
64
82
|
end
|
|
65
83
|
|
|
66
84
|
it "should allow for sorting of UUID arrays" do
|
|
@@ -69,59 +87,79 @@ describe UUIDTools::UUID, "when parsing" do
|
|
|
69
87
|
uuids << UUIDTools::UUID.timestamp_create
|
|
70
88
|
end
|
|
71
89
|
uuids.sort!
|
|
72
|
-
uuids.first.
|
|
73
|
-
uuids.last.
|
|
90
|
+
expect(uuids.first).to be < uuids.last
|
|
91
|
+
expect(uuids.last).to be > uuids.first
|
|
74
92
|
end
|
|
75
93
|
|
|
76
94
|
it "should allow for comparison of UUIDs" do
|
|
77
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
95
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to be <
|
|
78
96
|
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 1])
|
|
79
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 1]).
|
|
80
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])
|
|
81
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).should ==
|
|
97
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 1])).to be >
|
|
82
98
|
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])
|
|
99
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql(
|
|
100
|
+
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]))
|
|
83
101
|
end
|
|
84
102
|
|
|
85
103
|
it "should produce the correct hexdigest for a UUID" do
|
|
86
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest.
|
|
87
|
-
|
|
88
|
-
UUIDTools::UUID.new(1, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest.
|
|
89
|
-
|
|
90
|
-
UUIDTools::UUID.timestamp_create.hexdigest.size.
|
|
104
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest).to eql(
|
|
105
|
+
'00000000000000000000000000000000')
|
|
106
|
+
expect(UUIDTools::UUID.new(1, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest).to eql(
|
|
107
|
+
'00000001000000000000000000000000')
|
|
108
|
+
expect(UUIDTools::UUID.timestamp_create.hexdigest.size).to eql(32)
|
|
91
109
|
end
|
|
92
110
|
|
|
93
111
|
it "should produce a sane hash value for a UUID" do
|
|
94
112
|
uuid = UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])
|
|
95
|
-
uuid.to_i.
|
|
96
|
-
uuid.hash.
|
|
113
|
+
expect(uuid.to_i).to eql(0)
|
|
114
|
+
expect(uuid.hash).to be_kind_of(Integer)
|
|
97
115
|
end
|
|
98
116
|
|
|
99
117
|
it "should produce the correct URI for a UUID" do
|
|
100
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).to_uri.
|
|
101
|
-
|
|
118
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).to_uri).to eql(
|
|
119
|
+
'urn:uuid:00000000-0000-0000-0000-000000000000')
|
|
102
120
|
end
|
|
103
121
|
|
|
104
122
|
it "should correctly test UUID equality" do
|
|
105
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
123
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql(
|
|
106
124
|
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])
|
|
107
125
|
)
|
|
108
126
|
end
|
|
109
127
|
|
|
110
128
|
it "should correctly parse integers" do
|
|
111
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
112
|
-
UUIDTools::UUID.parse_int(0)
|
|
113
|
-
UUIDTools::UUID.parse_int(0).
|
|
129
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql(
|
|
130
|
+
UUIDTools::UUID.parse_int(0))
|
|
131
|
+
expect(UUIDTools::UUID.parse_int(0)).to be_nil_uuid
|
|
114
132
|
uuid = UUIDTools::UUID.timestamp_create
|
|
115
|
-
UUIDTools::UUID.parse_int(uuid.to_i).
|
|
133
|
+
expect(UUIDTools::UUID.parse_int(uuid.to_i)).to eql(uuid)
|
|
116
134
|
end
|
|
117
135
|
|
|
118
136
|
it "should correctly parse hexdigests" do
|
|
119
|
-
UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).
|
|
120
|
-
UUIDTools::UUID.parse_hexdigest(
|
|
121
|
-
UUIDTools::UUID.parse_hexdigest(
|
|
122
|
-
|
|
123
|
-
).
|
|
137
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql(
|
|
138
|
+
UUIDTools::UUID.parse_hexdigest('00000000000000000000000000000000'))
|
|
139
|
+
expect(UUIDTools::UUID.parse_hexdigest(
|
|
140
|
+
'00000000000000000000000000000000'
|
|
141
|
+
)).to be_nil_uuid
|
|
124
142
|
uuid = UUIDTools::UUID.timestamp_create
|
|
125
|
-
UUIDTools::UUID.parse_hexdigest(uuid.hexdigest).
|
|
143
|
+
expect(UUIDTools::UUID.parse_hexdigest(uuid.hexdigest)).to eql(uuid)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it "should correctly parse raw bytes" do
|
|
147
|
+
# NOTE: Short Input
|
|
148
|
+
expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql(
|
|
149
|
+
UUIDTools::UUID.parse_raw(+"")
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# NOTE: Nil Input
|
|
153
|
+
expect(
|
|
154
|
+
UUIDTools::UUID.parse_raw(+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0")
|
|
155
|
+
).to be_nil_uuid
|
|
156
|
+
|
|
157
|
+
# NOTE: Realistic Input
|
|
158
|
+
uuid = UUIDTools::UUID.timestamp_create
|
|
159
|
+
expect(UUIDTools::UUID.parse_raw(uuid.raw)).to eql(uuid)
|
|
160
|
+
|
|
161
|
+
# NOTE: Long input
|
|
162
|
+
raw192bit = "\1\2\3\4\5\6\7\8" + uuid.raw
|
|
163
|
+
expect(UUIDTools::UUID.parse_raw(raw192bit)).to eql(uuid)
|
|
126
164
|
end
|
|
127
165
|
end
|
data/tasks/benchmark.rake
CHANGED
|
@@ -1,38 +1,57 @@
|
|
|
1
1
|
task :benchmark do
|
|
2
|
-
require 'lib/uuidtools'
|
|
3
2
|
require 'benchmark'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
10000.times do
|
|
8
|
-
UUID.timestamp_create.to_s
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
puts "#{(10000.0 / result.real)} version 1 per second."
|
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../..', __FILE__)
|
|
5
|
+
require 'lib/uuidtools'
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
10000.times do
|
|
16
|
-
UUID.md5_create(UUID_URL_NAMESPACE,
|
|
17
|
-
"http://www.ietf.org/rfc/rfc4122.txt").to_s
|
|
18
|
-
end
|
|
7
|
+
def format_float(float)
|
|
8
|
+
("%.2f" % float).rjust(9, ' ')
|
|
19
9
|
end
|
|
20
|
-
puts "#{(10000.0 / result.real)} version 3 per second."
|
|
21
10
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
10000.times do
|
|
25
|
-
UUID.random_create.to_s
|
|
26
|
-
end
|
|
11
|
+
def format_result(result, action, iterations)
|
|
12
|
+
$stdout.puts "#{format_float(iterations / result.real)} | #{action}"
|
|
27
13
|
end
|
|
28
|
-
puts "#{(10000.0 / result.real)} version 4 per second."
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
UUID.sha1_create(UUID_URL_NAMESPACE,
|
|
34
|
-
"http://www.ietf.org/rfc/rfc4122.txt").to_s
|
|
15
|
+
def benchmark(name, n = 10000)
|
|
16
|
+
result = Benchmark.measure do
|
|
17
|
+
n.times { yield }
|
|
35
18
|
end
|
|
19
|
+
|
|
20
|
+
format_result(result, name, n)
|
|
36
21
|
end
|
|
37
|
-
|
|
22
|
+
|
|
23
|
+
$stdout.puts ' x/second | Benchmark'
|
|
24
|
+
$stdout.puts '---------- -----------'
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# Benchmark UUID creation
|
|
28
|
+
namespace = UUIDTools::UUID_URL_NAMESPACE
|
|
29
|
+
url = "http://www.ietf.org/rfc/rfc4122.txt"
|
|
30
|
+
|
|
31
|
+
benchmark('Version 1') { UUIDTools::UUID.timestamp_create.to_s }
|
|
32
|
+
benchmark('Version 3') { UUIDTools::UUID.md5_create(namespace, url).to_s }
|
|
33
|
+
benchmark('Version 4') { UUIDTools::UUID.random_create.to_s }
|
|
34
|
+
benchmark('Version 5') { UUIDTools::UUID.sha1_create(namespace, url).to_s }
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Benchmark UUID parsing
|
|
38
|
+
uuid_s = UUIDTools::UUID.random_create.to_s
|
|
39
|
+
benchmark('UUID::parse', 40000) { UUIDTools::UUID.parse(uuid_s) }
|
|
40
|
+
|
|
41
|
+
uuid_raw = UUIDTools::UUID.random_create.raw
|
|
42
|
+
benchmark('UUID::parse_raw', 40000) { UUIDTools::UUID.parse_raw(uuid_raw) }
|
|
43
|
+
|
|
44
|
+
uuid_i = UUIDTools::UUID.random_create.to_i
|
|
45
|
+
benchmark('UUID::parse_int', 40000) { UUIDTools::UUID.parse_int(uuid_i) }
|
|
46
|
+
|
|
47
|
+
uuid_hex = UUIDTools::UUID.random_create.hexdigest
|
|
48
|
+
benchmark('UUID::parse_hexdigest', 40000) { UUIDTools::UUID.parse_hexdigest(uuid_hex) }
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Benchmark UUID private api
|
|
52
|
+
byte_string = UUIDTools::UUID.timestamp_create.raw
|
|
53
|
+
benchmark('UUID::convert_byte_string_to_int') { UUIDTools::UUID.convert_byte_string_to_int(byte_string) }
|
|
54
|
+
|
|
55
|
+
bigint = UUIDTools::UUID.timestamp_create.to_i
|
|
56
|
+
benchmark('UUID::convert_int_to_byte_string') { UUIDTools::UUID.convert_int_to_byte_string(bigint, 16) }
|
|
38
57
|
end
|
data/tasks/gem.rake
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "rubygems/package_task"
|
|
2
|
+
require "rake"
|
|
3
|
+
require "rake/clean"
|
|
4
|
+
|
|
5
|
+
CLOBBER.include("pkg")
|
|
2
6
|
|
|
3
7
|
namespace :gem do
|
|
4
8
|
GEM_SPEC = Gem::Specification.new do |s|
|
|
5
|
-
unless s.respond_to?(:add_development_dependency)
|
|
6
|
-
puts "The gem spec requires a newer version of RubyGems."
|
|
7
|
-
exit(1)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
9
|
s.name = PKG_NAME
|
|
11
10
|
s.version = PKG_VERSION
|
|
12
11
|
s.summary = PKG_SUMMARY
|
|
13
12
|
s.description = PKG_DESCRIPTION
|
|
13
|
+
s.licenses = ["Apache-2.0"]
|
|
14
14
|
|
|
15
15
|
s.files = PKG_FILES.to_a
|
|
16
16
|
|
|
17
|
-
s.
|
|
18
|
-
s.
|
|
19
|
-
s.rdoc_options.concat ["--main", "README"]
|
|
17
|
+
s.extra_rdoc_files = %w( README.md )
|
|
18
|
+
s.rdoc_options.concat ["--main", "README.md"]
|
|
20
19
|
|
|
21
|
-
s.add_development_dependency
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if !s.respond_to?(:add_development_dependency)
|
|
21
|
+
puts "Cannot build Gem with this version of RubyGems."
|
|
22
|
+
exit(1)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
s.add_development_dependency("rake", ">= 0.7.3")
|
|
26
|
+
s.add_development_dependency("rspec", ">= 2.9.0")
|
|
27
|
+
s.add_development_dependency("yard", ">= 0.8.2")
|
|
28
|
+
s.add_development_dependency("launchy", ">= 2.0.0")
|
|
24
29
|
|
|
25
30
|
s.require_path = "lib"
|
|
26
31
|
|
|
27
|
-
s.author =
|
|
28
|
-
s.email =
|
|
29
|
-
s.homepage =
|
|
30
|
-
s.rubyforge_project = RUBY_FORGE_PROJECT
|
|
32
|
+
s.author = PKG_AUTHOR
|
|
33
|
+
s.email = PKG_AUTHOR_EMAIL
|
|
34
|
+
s.homepage = PKG_HOMEPAGE
|
|
31
35
|
end
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
Gem::PackageTask.new(GEM_SPEC) do |p|
|
|
34
38
|
p.gem_spec = GEM_SPEC
|
|
35
39
|
p.need_tar = true
|
|
36
40
|
p.need_zip = true
|
|
37
41
|
end
|
|
38
42
|
|
|
43
|
+
desc "Generates .gemspec file"
|
|
44
|
+
task :gemspec do
|
|
45
|
+
spec_string = GEM_SPEC.to_ruby
|
|
46
|
+
|
|
47
|
+
File.open("#{GEM_SPEC.name}.gemspec", "w") do |file|
|
|
48
|
+
file.write spec_string
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
39
52
|
desc "Show information about the gem"
|
|
40
53
|
task :debug do
|
|
41
54
|
puts GEM_SPEC.to_ruby
|
|
@@ -65,4 +78,4 @@ end
|
|
|
65
78
|
desc "Alias to gem:package"
|
|
66
79
|
task "gem" => "gem:package"
|
|
67
80
|
|
|
68
|
-
task "
|
|
81
|
+
task "gem:release" => "gem:gemspec"
|
data/tasks/rspec.rake
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require "rspec/core/rake_task"
|
|
2
|
+
require "rake/clean"
|
|
3
|
+
|
|
4
|
+
CLOBBER.include("coverage", "specdoc")
|
|
5
|
+
|
|
6
|
+
namespace :spec do
|
|
7
|
+
RSpec::Core::RakeTask.new(:rcov) do |t|
|
|
8
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
|
9
|
+
t.rspec_opts = ['--color', '--format', 'documentation']
|
|
10
|
+
|
|
11
|
+
t.rcov_opts = [
|
|
12
|
+
'--exclude', 'lib\\/compat',
|
|
13
|
+
'--exclude', 'spec',
|
|
14
|
+
'--exclude', '\\.rvm\\/gems',
|
|
15
|
+
'--exclude', '1\\.8\\/gems',
|
|
16
|
+
'--exclude', '1\\.9\\/gems',
|
|
17
|
+
'--exclude', '\\.rvm',
|
|
18
|
+
'--exclude', '\\/Library\\/Ruby'
|
|
19
|
+
]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
RSpec::Core::RakeTask.new(:normal) do |t|
|
|
23
|
+
t.pattern = FileList['spec/**/*_spec.rb'].exclude(/compat/)
|
|
24
|
+
t.rspec_opts = ['--color', '--format', 'documentation']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
|
28
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
|
29
|
+
t.rspec_opts = ['--color', '--format', 'documentation']
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc "Generate HTML Specdocs for all specs"
|
|
33
|
+
RSpec::Core::RakeTask.new(:specdoc) do |t|
|
|
34
|
+
specdoc_path = File.expand_path(
|
|
35
|
+
File.join(File.dirname(__FILE__), '..', 'documentation')
|
|
36
|
+
)
|
|
37
|
+
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
|
38
|
+
|
|
39
|
+
output_file = File.join(specdoc_path, 'index.html')
|
|
40
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
|
41
|
+
t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
|
|
42
|
+
t.fail_on_error = false
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
namespace :rcov do
|
|
46
|
+
desc "Browse the code coverage report."
|
|
47
|
+
task :browse => "spec:rcov" do
|
|
48
|
+
require "launchy"
|
|
49
|
+
Launchy::Browser.run("coverage/index.html")
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
desc "Alias to spec:normal"
|
|
55
|
+
task "spec" => "spec:normal"
|
data/tasks/yard.rake
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "rake"
|
|
2
|
+
require "rake/clean"
|
|
3
|
+
|
|
4
|
+
CLOBBER.include("doc")
|
|
5
|
+
|
|
6
|
+
require "yard"
|
|
7
|
+
require "yard/rake/yardoc_task"
|
|
8
|
+
|
|
9
|
+
namespace :doc do
|
|
10
|
+
desc "Generate Yardoc documentation"
|
|
11
|
+
YARD::Rake::YardocTask.new do |yardoc|
|
|
12
|
+
yardoc.name = "yard"
|
|
13
|
+
yardoc.options = ["--verbose", "--markup", "markdown"]
|
|
14
|
+
yardoc.files = FileList[
|
|
15
|
+
"lib/**/*.rb", "ext/**/*.c",
|
|
16
|
+
"README.md", "CHANGELOG.md", "LICENSE.txt"
|
|
17
|
+
].exclude(/idna/)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
desc "Alias to doc:yard"
|
|
22
|
+
task "doc" => "doc:yard"
|
data/uuidtools.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
# stub: uuidtools 3.0.0 ruby lib
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "uuidtools".freeze
|
|
6
|
+
s.version = "3.0.0".freeze
|
|
7
|
+
|
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
|
+
s.require_paths = ["lib".freeze]
|
|
10
|
+
s.authors = ["Bob Aman".freeze]
|
|
11
|
+
s.date = "2025-03-09"
|
|
12
|
+
s.description = "A simple universally unique ID generation library.\n".freeze
|
|
13
|
+
s.email = "bob@sporkmonger.com".freeze
|
|
14
|
+
s.extra_rdoc_files = ["README.md".freeze]
|
|
15
|
+
s.files = ["CHANGELOG".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "lib".freeze, "lib/compat".freeze, "lib/compat/securerandom.rb".freeze, "lib/uuidtools".freeze, "lib/uuidtools.rb".freeze, "lib/uuidtools/version.rb".freeze, "spec".freeze, "spec/spec.opts".freeze, "spec/spec_helper.rb".freeze, "spec/uuidtools".freeze, "spec/uuidtools/mac_address_spec.rb".freeze, "spec/uuidtools/utility_spec.rb".freeze, "spec/uuidtools/uuid_creation_spec.rb".freeze, "spec/uuidtools/uuid_parsing_spec.rb".freeze, "tasks".freeze, "tasks/benchmark.rake".freeze, "tasks/gem.rake".freeze, "tasks/git.rake".freeze, "tasks/metrics.rake".freeze, "tasks/rspec.rake".freeze, "tasks/yard.rake".freeze, "uuidtools.gemspec".freeze, "website".freeze, "website/index.html".freeze]
|
|
16
|
+
s.homepage = "https://github.com/sporkmonger/uuidtools".freeze
|
|
17
|
+
s.licenses = ["Apache-2.0".freeze]
|
|
18
|
+
s.rdoc_options = ["--main".freeze, "README.md".freeze]
|
|
19
|
+
s.rubygems_version = "3.6.3".freeze
|
|
20
|
+
s.summary = "UUID generator".freeze
|
|
21
|
+
|
|
22
|
+
s.specification_version = 4
|
|
23
|
+
|
|
24
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 0.7.3".freeze])
|
|
25
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 2.9.0".freeze])
|
|
26
|
+
s.add_development_dependency(%q<yard>.freeze, [">= 0.8.2".freeze])
|
|
27
|
+
s.add_development_dependency(%q<launchy>.freeze, [">= 2.0.0".freeze])
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,61 +1,86 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uuidtools
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
|
-
authors:
|
|
6
|
+
authors:
|
|
7
7
|
- Bob Aman
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
dependencies:
|
|
15
|
-
- !ruby/object:Gem::Dependency
|
|
10
|
+
date: 2025-03-09 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
16
13
|
name: rake
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.7.3
|
|
17
19
|
type: :development
|
|
18
|
-
|
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
-
requirements:
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
21
23
|
- - ">="
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: 0.
|
|
24
|
-
|
|
25
|
-
- !ruby/object:Gem::Dependency
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.7.3
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
26
27
|
name: rspec
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 2.9.0
|
|
27
33
|
type: :development
|
|
28
|
-
|
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
31
37
|
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 2.9.0
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: yard
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 0.8.2
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 0.8.2
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
36
55
|
name: launchy
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 2.0.0
|
|
37
61
|
type: :development
|
|
38
|
-
|
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
41
65
|
- - ">="
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.
|
|
44
|
-
|
|
45
|
-
description: |
|
|
46
|
-
A simple universally unique ID generation library.
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 2.0.0
|
|
68
|
+
description: 'A simple universally unique ID generation library.
|
|
47
69
|
|
|
70
|
+
'
|
|
48
71
|
email: bob@sporkmonger.com
|
|
49
72
|
executables: []
|
|
50
|
-
|
|
51
73
|
extensions: []
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
extra_rdoc_files:
|
|
75
|
+
- README.md
|
|
76
|
+
files:
|
|
77
|
+
- CHANGELOG
|
|
78
|
+
- LICENSE.txt
|
|
79
|
+
- README.md
|
|
80
|
+
- Rakefile
|
|
56
81
|
- lib/compat/securerandom.rb
|
|
57
|
-
- lib/uuidtools/version.rb
|
|
58
82
|
- lib/uuidtools.rb
|
|
83
|
+
- lib/uuidtools/version.rb
|
|
59
84
|
- spec/spec.opts
|
|
60
85
|
- spec/spec_helper.rb
|
|
61
86
|
- spec/uuidtools/mac_address_spec.rb
|
|
@@ -63,46 +88,34 @@ files:
|
|
|
63
88
|
- spec/uuidtools/uuid_creation_spec.rb
|
|
64
89
|
- spec/uuidtools/uuid_parsing_spec.rb
|
|
65
90
|
- tasks/benchmark.rake
|
|
66
|
-
- tasks/clobber.rake
|
|
67
91
|
- tasks/gem.rake
|
|
68
92
|
- tasks/git.rake
|
|
69
93
|
- tasks/metrics.rake
|
|
70
|
-
- tasks/
|
|
71
|
-
- tasks/
|
|
72
|
-
-
|
|
94
|
+
- tasks/rspec.rake
|
|
95
|
+
- tasks/yard.rake
|
|
96
|
+
- uuidtools.gemspec
|
|
73
97
|
- website/index.html
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
post_install_message:
|
|
83
|
-
rdoc_options:
|
|
84
|
-
- --main
|
|
85
|
-
- README
|
|
86
|
-
require_paths:
|
|
98
|
+
homepage: https://github.com/sporkmonger/uuidtools
|
|
99
|
+
licenses:
|
|
100
|
+
- Apache-2.0
|
|
101
|
+
metadata: {}
|
|
102
|
+
rdoc_options:
|
|
103
|
+
- "--main"
|
|
104
|
+
- README.md
|
|
105
|
+
require_paths:
|
|
87
106
|
- lib
|
|
88
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
|
-
requirements:
|
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
90
109
|
- - ">="
|
|
91
|
-
- !ruby/object:Gem::Version
|
|
92
|
-
version:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
requirements:
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
96
114
|
- - ">="
|
|
97
|
-
- !ruby/object:Gem::Version
|
|
98
|
-
version:
|
|
99
|
-
version:
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
100
117
|
requirements: []
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
rubygems_version: 1.3.4
|
|
104
|
-
signing_key:
|
|
105
|
-
specification_version: 3
|
|
118
|
+
rubygems_version: 3.6.3
|
|
119
|
+
specification_version: 4
|
|
106
120
|
summary: UUID generator
|
|
107
121
|
test_files: []
|
|
108
|
-
|