uuid 2.3.3 → 2.3.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.
Files changed (6) hide show
  1. data/CHANGELOG +4 -0
  2. data/bin/uuid +12 -51
  3. data/lib/uuid.rb +3 -0
  4. data/test/test-uuid.rb +13 -0
  5. data/uuid.gemspec +1 -1
  6. metadata +11 -7
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2.3.4 (2011-09-01)
2
+
3
+ Fixed State file mode isn't respected with standard umask (Brandon Turner).
4
+
1
5
  2.3.3 (2011-08-01)
2
6
 
3
7
  Check if ruby-uuid is writable: it might have been claimed by another user on
data/bin/uuid CHANGED
@@ -1,55 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
- require "uuid"
3
- require "optparse"
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'uuid' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
4
8
 
5
- address = nil
6
- count = 1
7
- format = :default
8
- server = false
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
9
12
 
10
- opts = OptionParser.new("", 24, ' ') do |opts|
11
- opts.banner = "Usage: #{File.basename($0)} [options]"
13
+ require 'rubygems'
14
+ require 'bundler/setup'
12
15
 
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
16
+ load Gem.bin_path('uuid', 'uuid')
@@ -259,6 +259,9 @@ class UUID
259
259
  fail "Cannot determine MAC address from any available interface, tried with #{mac_address}" if @mac == 0
260
260
  @sequence = rand 0x10000
261
261
 
262
+ # Ensure the mode is respected, even with a restrictive umask
263
+ File.open(state_file, 'w') { |f| f.chmod(self.class.mode) } if state_file && !File.exists?(state_file)
264
+
262
265
  if state_file
263
266
  open_lock 'wb' do |io|
264
267
  write_state io
@@ -17,6 +17,19 @@ class TestUUID < Test::Unit::TestCase
17
17
  File.exist?(path)
18
18
  end
19
19
 
20
+ def test_state_file_creation_mode
21
+ UUID.class_eval{ @state_file = nil; @mode = nil }
22
+ UUID.state_file 0666
23
+ path = UUID.state_file
24
+ File.delete path if File.exist?(path)
25
+
26
+ old_umask = File.umask(0022)
27
+ UUID.new.generate
28
+ File.umask(old_umask)
29
+
30
+ assert_equal '0666', sprintf('%04o', File.stat(path).mode & 0777)
31
+ end
32
+
20
33
  def test_state_file_specify
21
34
  path = File.join("path", "to", "ruby-uuid")
22
35
  UUID.state_file = path
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'uuid'
3
- s.version = '2.3.3'
3
+ s.version = '2.3.4'
4
4
  s.summary = "UUID generator"
5
5
  s.description = <<-EOF
6
6
  UUID generator for producing universally unique identifiers based on RFC 4122
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.3
4
+ version: 2.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-01 00:00:00.000000000 -07:00
14
- default_executable:
13
+ date: 2011-09-02 00:00:00.000000000Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: macaddr
18
- requirement: &2152873140 !ruby/object:Gem::Requirement
17
+ requirement: &2156334240 !ruby/object:Gem::Requirement
19
18
  none: false
20
19
  requirements:
21
20
  - - ~>
@@ -23,7 +22,7 @@ dependencies:
23
22
  version: '1.0'
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *2152873140
25
+ version_requirements: *2156334240
27
26
  description: ! 'UUID generator for producing universally unique identifiers based
28
27
  on RFC 4122
29
28
 
@@ -46,7 +45,6 @@ files:
46
45
  - Rakefile
47
46
  - CHANGELOG
48
47
  - uuid.gemspec
49
- has_rdoc: true
50
48
  homepage: http://github.com/assaf/uuid
51
49
  licenses: []
52
50
  post_install_message:
@@ -64,15 +62,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
62
  - - ! '>='
65
63
  - !ruby/object:Gem::Version
66
64
  version: '0'
65
+ segments:
66
+ - 0
67
+ hash: 2227115529809974426
67
68
  required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  none: false
69
70
  requirements:
70
71
  - - ! '>='
71
72
  - !ruby/object:Gem::Version
72
73
  version: '0'
74
+ segments:
75
+ - 0
76
+ hash: 2227115529809974426
73
77
  requirements: []
74
78
  rubyforge_project:
75
- rubygems_version: 1.6.2
79
+ rubygems_version: 1.8.10
76
80
  signing_key:
77
81
  specification_version: 3
78
82
  summary: UUID generator