uuid 2.3.5 → 2.3.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/CHANGELOG +13 -0
- data/Rakefile +5 -5
- data/bin/uuid +51 -12
- data/lib/uuid.rb +5 -0
- data/test/test-uuid.rb +15 -0
- data/uuid.gemspec +1 -1
- metadata +12 -7
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
2.3.6 (2012-11-18)
|
2
|
+
|
3
|
+
Manually setting the state_file path sets mode too (Tom Lea).
|
4
|
+
|
5
|
+
When manually setting the state file, set the mode too. Failure to do so
|
6
|
+
causes an implicit conversion of nil to integer on first usage.
|
7
|
+
|
8
|
+
Also provided a mode method to set the mode explicitly.
|
9
|
+
|
10
|
+
|
11
|
+
Reverted executable loss (Michael Witrant ).
|
12
|
+
|
13
|
+
|
1
14
|
2.3.4 (2012-01-23)
|
2
15
|
|
3
16
|
Source files are now UTF-8 (Vicente Reig)
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rake/testtask'
|
2
|
-
require 'rake/rdoctask'
|
2
|
+
#require 'rake/rdoctask'
|
3
3
|
|
4
4
|
|
5
5
|
spec = Gem::Specification.load(File.expand_path("uuid.gemspec", File.dirname(__FILE__)))
|
@@ -16,10 +16,10 @@ Rake::TestTask.new do |test|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Create the documentation.
|
19
|
-
Rake::RDocTask.new do |rdoc|
|
20
|
-
rdoc.rdoc_files.include "README.rdoc", "lib/**/*.rb"
|
21
|
-
rdoc.options = spec.rdoc_options
|
22
|
-
end
|
19
|
+
#Rake::RDocTask.new do |rdoc|
|
20
|
+
# rdoc.rdoc_files.include "README.rdoc", "lib/**/*.rb"
|
21
|
+
# rdoc.options = spec.rdoc_options
|
22
|
+
#end
|
23
23
|
|
24
24
|
|
25
25
|
|
data/bin/uuid
CHANGED
@@ -1,16 +1,55 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
# The application 'uuid' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
2
|
+
require "uuid"
|
3
|
+
require "optparse"
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
address = nil
|
6
|
+
count = 1
|
7
|
+
format = :default
|
8
|
+
server = false
|
12
9
|
|
13
|
-
|
14
|
-
|
10
|
+
opts = OptionParser.new("", 24, ' ') do |opts|
|
11
|
+
opts.banner = "Usage: #{File.basename($0)} [options]"
|
15
12
|
|
16
|
-
|
13
|
+
opts.separator "\nOptions:"
|
14
|
+
opts.on("-s", "--socket {HOST:PORT|PATH}",
|
15
|
+
"communicate on HOST:PORT or PATH (default: #{UUID::SOCKET_NAME})") do |value|
|
16
|
+
address = value
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-S", "--server", "run as a server") do |value|
|
20
|
+
server = value ? true : false
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-F", "--format {FORMAT}", "UUID format (client only)") do |value|
|
24
|
+
format = value.to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-C", "--count {COUNT}", "returns give number of UUIDs") do |value|
|
28
|
+
count = value.to_i
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-h", "--help", "Show this message") do
|
32
|
+
puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on("-v", "--version", "Show version") do
|
37
|
+
puts "UUID v#{UUID::VERSION}"
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.parse! ARGV
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
if server
|
46
|
+
$stdout << "Starting UUID server on #{address}\n"
|
47
|
+
UUID::Server.new.listen(address || UUID::SOCKET_NAME)
|
48
|
+
else
|
49
|
+
UUID.server = address if address
|
50
|
+
$stdout << UUID.generate(format)
|
51
|
+
(count - 1).times do
|
52
|
+
$stdout.putc "\n"
|
53
|
+
$stdout << UUID.generate(format)
|
54
|
+
end
|
55
|
+
end
|
data/lib/uuid.rb
CHANGED
@@ -114,6 +114,10 @@ class UUID
|
|
114
114
|
@mode
|
115
115
|
end
|
116
116
|
|
117
|
+
def self.mode=(mode)
|
118
|
+
@mode = mode
|
119
|
+
end
|
120
|
+
|
117
121
|
##
|
118
122
|
# Generates a new UUID string using +format+. See FORMATS for a list of
|
119
123
|
# supported formats.
|
@@ -185,6 +189,7 @@ class UUID
|
|
185
189
|
# hosts).
|
186
190
|
def self.state_file=(path)
|
187
191
|
@state_file = path
|
192
|
+
@mode ||= 0644
|
188
193
|
end
|
189
194
|
|
190
195
|
##
|
data/test/test-uuid.rb
CHANGED
@@ -37,6 +37,21 @@ class TestUUID < Test::Unit::TestCase
|
|
37
37
|
assert_equal path, UUID.state_file
|
38
38
|
end
|
39
39
|
|
40
|
+
def test_mode_is_set_on_state_file_specify
|
41
|
+
UUID.class_eval{ @state_file = nil; @mode = nil }
|
42
|
+
path = File.join("/tmp", "ruby-uuid-test")
|
43
|
+
File.delete path if File.exist?(path)
|
44
|
+
|
45
|
+
UUID.state_file = path
|
46
|
+
|
47
|
+
old_umask = File.umask(0022)
|
48
|
+
UUID.new.generate
|
49
|
+
File.umask(old_umask)
|
50
|
+
|
51
|
+
UUID.class_eval{ @state_file = nil; @mode = nil }
|
52
|
+
assert_equal '0644', sprintf('%04o', File.stat(path).mode & 0777)
|
53
|
+
end
|
54
|
+
|
40
55
|
def test_with_no_state_file
|
41
56
|
UUID.state_file = false
|
42
57
|
assert !UUID.state_file
|
data/uuid.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: macaddr
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,7 +22,12 @@ dependencies:
|
|
22
22
|
version: '1.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.0'
|
26
31
|
description: ! 'UUID generator for producing universally unique identifiers based
|
27
32
|
on RFC 4122
|
28
33
|
|
@@ -68,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
73
|
version: '0'
|
69
74
|
segments:
|
70
75
|
- 0
|
71
|
-
hash:
|
76
|
+
hash: -3353469269955199070
|
72
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
78
|
none: false
|
74
79
|
requirements:
|
@@ -77,10 +82,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
82
|
version: '0'
|
78
83
|
segments:
|
79
84
|
- 0
|
80
|
-
hash:
|
85
|
+
hash: -3353469269955199070
|
81
86
|
requirements: []
|
82
87
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
88
|
+
rubygems_version: 1.8.23
|
84
89
|
signing_key:
|
85
90
|
specification_version: 3
|
86
91
|
summary: UUID generator
|