uuid 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 2.3.7 (2013-02-18)
2
+
3
+ Use Dir.tmpdir instead of hardcoded /var/tmp path (Justin Langhorst).
4
+
5
+
1
6
  2.3.6 (2012-11-18)
2
7
 
3
8
  Manually setting the state_file path sets mode too (Tom Lea).
@@ -62,7 +62,7 @@ first used by the application, to prevent multiple processes from
62
62
  generating the same set of identifiers, and deal with changes to the
63
63
  system clock.
64
64
 
65
- The UUID state file is created in <tt>/var/tmp/ruby-uuid</tt> or the Windows
65
+ The UUID state file is created in <tt>#Dir.tmpdir/ruby-uuid</tt> or the Windows
66
66
  common application data directory using mode 0644. If that directory is not
67
67
  writable, the file is created as <tt>.ruby-uuid</tt> in the home directory.
68
68
  If you need to create the file with a different mode, use UUID#state_file
@@ -76,6 +76,14 @@ Engine) you can simple turn it off:
76
76
 
77
77
  State files are not portable across machines.
78
78
 
79
+ If you do not use the state file, UUID generation will attempt to use your
80
+ server's MAC address using the macaddr gem, which runs system commands to
81
+ identify the MAC address and then cache it. Since this can take a few seconds
82
+ on some operating systems, when using UUID.state_file = false, you should add
83
+ the following line after disabling the state file:
84
+
85
+ UUID.generator.next_sequence
86
+
79
87
  Note: when using a forking server (Unicorn, Resque, Pipemaster, etc) you don't
80
88
  want your forked processes using the same sequence number. Make sure to
81
89
  increment the sequence number each time a worker forks.
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')
@@ -13,6 +13,7 @@ require 'tmpdir'
13
13
  require 'socket'
14
14
  require 'macaddr'
15
15
  require 'digest/sha1'
16
+ require 'tmpdir'
16
17
 
17
18
 
18
19
  ##
@@ -146,7 +147,7 @@ class UUID
146
147
  end
147
148
 
148
149
  ##
149
- # Creates an empty state file in /var/tmp/ruby-uuid or the windows common
150
+ # Creates an empty state file in #Dir.tmpdir/ruby-uuid or the windows common
150
151
  # application data directory using mode 0644. Call with a different mode
151
152
  # before creating a UUID generator if you want to open access beyond your
152
153
  # user by default.
@@ -169,7 +170,7 @@ class UUID
169
170
 
170
171
  state_dir = File.join(path.strip)
171
172
  rescue LoadError
172
- state_dir = File.join('', 'var', 'tmp')
173
+ state_dir = Dir.tmpdir
173
174
  end
174
175
 
175
176
  @state_file = File.join(state_dir, 'ruby-uuid')
@@ -39,7 +39,7 @@ class TestUUID < Test::Unit::TestCase
39
39
 
40
40
  def test_mode_is_set_on_state_file_specify
41
41
  UUID.class_eval{ @state_file = nil; @mode = nil }
42
- path = File.join("/tmp", "ruby-uuid-test")
42
+ path = File.join(Dir.tmpdir, "ruby-uuid-test")
43
43
  File.delete path if File.exist?(path)
44
44
 
45
45
  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.6'
3
+ s.version = '2.3.7'
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.6
4
+ version: 2.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-18 00:00:00.000000000 Z
13
+ date: 2013-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: macaddr
@@ -71,18 +71,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  - - ! '>='
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
- segments:
75
- - 0
76
- hash: -3353469269955199070
77
74
  required_rubygems_version: !ruby/object:Gem::Requirement
78
75
  none: false
79
76
  requirements:
80
77
  - - ! '>='
81
78
  - !ruby/object:Gem::Version
82
79
  version: '0'
83
- segments:
84
- - 0
85
- hash: -3353469269955199070
86
80
  requirements: []
87
81
  rubyforge_project:
88
82
  rubygems_version: 1.8.23