uuidtools 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,3 @@
1
- == UUIDTools 2.1.2
2
- * fixed issue with frozen objects
3
- * fixed issue with running specs in Ruby 1.9.2
4
1
  == UUIDTools 2.1.1
5
2
  * fixed issue with Ruby 1.9 compatibility
6
3
  == UUIDTools 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'launchy', '>= 2.0.0'
5
+ gem 'yard', '>= 0.8.2'
6
+ gem 'redcarpet'
7
+ gem 'rubyforge'
8
+ end
9
+
10
+ group :test, :development do
11
+ gem 'rake', '>= 0.7.3'
12
+ gem 'rspec', '>= 2.9.0'
13
+ end
14
+
15
+ gemspec
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uuidtools (2.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.2.8)
10
+ diff-lcs (1.1.3)
11
+ json_pure (1.7.3)
12
+ launchy (2.1.0)
13
+ addressable (~> 2.2.6)
14
+ rake (0.9.2.2)
15
+ redcarpet (2.1.1)
16
+ rspec (2.11.0)
17
+ rspec-core (~> 2.11.0)
18
+ rspec-expectations (~> 2.11.0)
19
+ rspec-mocks (~> 2.11.0)
20
+ rspec-core (2.11.0)
21
+ rspec-expectations (2.11.1)
22
+ diff-lcs (~> 1.1.3)
23
+ rspec-mocks (2.11.1)
24
+ rubyforge (2.0.4)
25
+ json_pure (>= 1.1.7)
26
+ yard (0.8.2.1)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ launchy (>= 2.0.0)
33
+ rake (>= 0.7.3)
34
+ redcarpet
35
+ rspec (>= 2.9.0)
36
+ rubyforge
37
+ uuidtools!
38
+ yard
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,38 @@
1
+ # UUIDTools
2
+
3
+ <dl>
4
+ <dt>Homepage</dt><dd><a href="http://uuidtools.rubyforge.org/">uuidtools.rubyforge.org</a></dd>
5
+ <dt>Author</dt><dd><a href="mailto:bob@sporkmonger.com">Bob Aman</a></dd>
6
+ <dt>Copyright</dt><dd>Copyright © 2005-2012 Bob Aman</dd>
7
+ <dt>License</dt><dd>Apache 2.0</dd>
8
+ </dl>
9
+
10
+ [![Build Status](https://secure.travis-ci.org/sporkmonger/uuidtools.png)](http://travis-ci.org/sporkmonger/uuidtools)
11
+ [![Dependency Status](https://gemnasium.com/sporkmonger/uuidtools.png)](https://gemnasium.com/sporkmonger/uuidtools)
12
+
13
+ # Description
14
+
15
+ UUIDTools was designed to be a simple library for generating any
16
+ of the various types of UUIDs. It conforms to RFC 4122 whenever
17
+ possible.
18
+
19
+ # Reference
20
+
21
+ - {UUIDTools::UUID}
22
+
23
+ # Example usage
24
+
25
+ require "uuidtools"
26
+
27
+ UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
28
+ # => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
29
+ UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
30
+ # => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
31
+ UUIDTools::UUID.timestamp_create
32
+ # => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
33
+ UUIDTools::UUID.random_create
34
+ # => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
35
+
36
+ # Install
37
+
38
+ $ sudo gem install uuidtools
data/Rakefile CHANGED
@@ -1,20 +1,11 @@
1
- lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "lib"))
2
- $:.unshift(lib_dir)
3
- $:.uniq!
4
-
5
1
  require 'rubygems'
6
2
  require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
- require 'rake/packagetask'
10
- require 'rake/gempackagetask'
11
- require 'spec/rake/spectask'
12
3
 
13
- require File.join(File.dirname(__FILE__), 'lib/uuidtools', 'version')
4
+ require File.join(File.dirname(__FILE__), 'lib', 'uuidtools', 'version')
14
5
 
15
6
  PKG_DISPLAY_NAME = 'UUIDTools'
16
7
  PKG_NAME = PKG_DISPLAY_NAME.downcase
17
- PKG_VERSION = UUID::VERSION::STRING
8
+ PKG_VERSION = UUIDTools::VERSION::STRING
18
9
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
19
10
 
20
11
  RELEASE_NAME = "REL #{PKG_VERSION}"
@@ -35,12 +26,7 @@ PKG_FILES = FileList[
35
26
  "[A-Z]*", "Rakefile"
36
27
  ].exclude(/database\.yml/).exclude(/[_\.]git$/)
37
28
 
38
- RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/)
39
- if RCOV_ENABLED
40
- task :default => "spec:verify"
41
- else
42
- task :default => "spec"
43
- end
29
+ task :default => "spec"
44
30
 
45
31
  WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
46
32
  SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
@@ -1,26 +1,21 @@
1
+ # encoding:utf-8
1
2
  #--
2
- # UUIDTools, Copyright (c) 2005-2008 Bob Aman
3
+ # Copyright (C) 2005-2012 Bob Aman
3
4
  #
4
- # Permission is hereby granted, free of charge, to any person obtaining
5
- # a copy of this software and associated documentation files (the
6
- # "Software"), to deal in the Software without restriction, including
7
- # without limitation the rights to use, copy, modify, merge, publish,
8
- # distribute, sublicense, and/or sell copies of the Software, and to
9
- # permit persons to whom the Software is furnished to do so, subject to
10
- # the following conditions:
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
11
8
  #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
9
+ # http://www.apache.org/licenses/LICENSE-2.0
14
10
  #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
22
16
  #++
23
17
 
18
+
24
19
  $:.unshift(File.dirname(__FILE__))
25
20
 
26
21
  require 'uri'
@@ -38,30 +33,50 @@ rescue LoadError
38
33
  end
39
34
 
40
35
  module UUIDTools
41
- #= uuidtools.rb
42
- #
36
+ ##
43
37
  # UUIDTools was designed to be a simple library for generating any
44
38
  # of the various types of UUIDs. It conforms to RFC 4122 whenever
45
39
  # possible.
46
40
  #
47
- #== Example
48
- # UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
49
- # => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
50
- # UUID.sha1_create(UUID_DNS_NAMESPACE, "www.widgets.com")
51
- # => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
52
- # UUID.timestamp_create
53
- # => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
54
- # UUID.random_create
55
- # => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
41
+ # @example
42
+ # UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
43
+ # # => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
44
+ # UUID.sha1_create(UUID_DNS_NAMESPACE, "www.widgets.com")
45
+ # # => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
46
+ # UUID.timestamp_create
47
+ # # => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
48
+ # UUID.random_create
49
+ # # => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
56
50
  class UUID
57
51
  include Comparable
58
52
 
53
+ ##
54
+ # @api private
59
55
  @@last_timestamp = nil
56
+
57
+ ##
58
+ # @api private
60
59
  @@last_node_id = nil
60
+
61
+ ##
62
+ # @api private
61
63
  @@last_clock_sequence = nil
64
+
65
+ ##
66
+ # @api private
62
67
  @@state_file = nil
68
+
69
+ ##
70
+ # @api private
63
71
  @@mutex = Mutex.new
64
72
 
73
+ ##
74
+ # Creates a new UUID structure from its component values.
75
+ # @see UUID.md5_create
76
+ # @see UUID.sha1_create
77
+ # @see UUID.timestamp_create
78
+ # @see UUID.random_create
79
+ # @api private
65
80
  def initialize(time_low, time_mid, time_hi_and_version,
66
81
  clock_seq_hi_and_reserved, clock_seq_low, nodes)
67
82
  unless time_low >= 0 && time_low < 4294967296
@@ -110,13 +125,31 @@ module UUIDTools
110
125
  @nodes = nodes
111
126
  end
112
127
 
128
+ ##
129
+ # Returns the value of attribute `time_low`
113
130
  attr_accessor :time_low
131
+
132
+ ##
133
+ # Returns the value of attribute `time_mid`
114
134
  attr_accessor :time_mid
135
+
136
+ ##
137
+ # Returns the value of attribute `time_hi_and_version`
115
138
  attr_accessor :time_hi_and_version
139
+
140
+ ##
141
+ # Returns the value of attribute `clock_seq_hi_and_reserved`
116
142
  attr_accessor :clock_seq_hi_and_reserved
143
+
144
+ ##
145
+ # Returns the value of attribute `clock_seq_low`
117
146
  attr_accessor :clock_seq_low
147
+
148
+ ##
149
+ # Returns the value of attribute `nodes`
118
150
  attr_accessor :nodes
119
151
 
152
+ ##
120
153
  # Parses a UUID from a string.
121
154
  def self.parse(uuid_string)
122
155
  unless uuid_string.kind_of? String
@@ -140,6 +173,7 @@ module UUIDTools
140
173
  clock_seq_hi_and_reserved, clock_seq_low, nodes)
141
174
  end
142
175
 
176
+ ##
143
177
  # Parses a UUID from a raw byte string.
144
178
  def self.parse_raw(raw_string)
145
179
  unless raw_string.kind_of? String
@@ -161,6 +195,7 @@ module UUIDTools
161
195
  clock_seq_hi_and_reserved, clock_seq_low, nodes)
162
196
  end
163
197
 
198
+ ##
164
199
  # Parses a UUID from an Integer.
165
200
  def self.parse_int(uuid_int)
166
201
  unless uuid_int.kind_of?(Integer)
@@ -170,6 +205,7 @@ module UUIDTools
170
205
  return self.parse_raw(self.convert_int_to_byte_string(uuid_int, 16))
171
206
  end
172
207
 
208
+ ##
173
209
  # Parse a UUID from a hexdigest String.
174
210
  def self.parse_hexdigest(uuid_hexdigest)
175
211
  unless uuid_hexdigest.kind_of?(String)
@@ -179,6 +215,7 @@ module UUIDTools
179
215
  return self.parse_int(uuid_hexdigest.to_i(16))
180
216
  end
181
217
 
218
+ ##
182
219
  # Creates a UUID from a random value.
183
220
  def self.random_create()
184
221
  new_uuid = self.parse_raw(SecureRandom.random_bytes(16))
@@ -189,6 +226,7 @@ module UUIDTools
189
226
  return new_uuid
190
227
  end
191
228
 
229
+ ##
192
230
  # Creates a UUID from a timestamp.
193
231
  def self.timestamp_create(timestamp=nil)
194
232
  # We need a lock here to prevent two threads from ever
@@ -248,16 +286,19 @@ module UUIDTools
248
286
  end
249
287
  end
250
288
 
289
+ ##
251
290
  # Creates a UUID using the MD5 hash. (Version 3)
252
291
  def self.md5_create(namespace, name)
253
292
  return self.create_from_hash(Digest::MD5, namespace, name)
254
293
  end
255
294
 
295
+ ##
256
296
  # Creates a UUID using the SHA1 hash. (Version 5)
257
297
  def self.sha1_create(namespace, name)
258
298
  return self.create_from_hash(Digest::SHA1, namespace, name)
259
299
  end
260
300
 
301
+ ##
261
302
  # This method applies only to version 1 UUIDs.
262
303
  # Checks if the node ID was generated from a random number
263
304
  # or from an IEEE 802 address (MAC address).
@@ -269,6 +310,7 @@ module UUIDTools
269
310
  return ((self.nodes.first & 0x01) == 1)
270
311
  end
271
312
 
313
+ ##
272
314
  # Returns true if this UUID is the
273
315
  # nil UUID (00000000-0000-0000-0000-000000000000).
274
316
  def nil_uuid?
@@ -283,6 +325,7 @@ module UUIDTools
283
325
  return true
284
326
  end
285
327
 
328
+ ##
286
329
  # Returns the UUID version type.
287
330
  # Possible values:
288
331
  # 1 - Time-based with unique or random host identifier
@@ -294,6 +337,7 @@ module UUIDTools
294
337
  return (time_hi_and_version >> 12)
295
338
  end
296
339
 
340
+ ##
297
341
  # Returns the UUID variant.
298
342
  # Possible values:
299
343
  # 0b000 - Reserved, NCS backward compatibility.
@@ -313,6 +357,7 @@ module UUIDTools
313
357
  return (result >> 6)
314
358
  end
315
359
 
360
+ ##
316
361
  # Returns true if this UUID is valid.
317
362
  def valid?
318
363
  if [0b000, 0b100, 0b110, 0b111].include?(self.variant) &&
@@ -323,6 +368,7 @@ module UUIDTools
323
368
  end
324
369
  end
325
370
 
371
+ ##
326
372
  # Returns the IEEE 802 address used to generate this UUID or
327
373
  # nil if a MAC address was not used.
328
374
  def mac_address
@@ -333,6 +379,7 @@ module UUIDTools
333
379
  end).join(":")
334
380
  end
335
381
 
382
+ ##
336
383
  # Returns the timestamp used to generate this UUID
337
384
  def timestamp
338
385
  return nil if self.version != 1
@@ -345,6 +392,7 @@ module UUIDTools
345
392
  (gmt_timestamp_100_nanoseconds - 0x01B21DD213814000) / 10000000.0)
346
393
  end
347
394
 
395
+ ##
348
396
  # Compares two UUIDs lexically
349
397
  def <=>(other_uuid)
350
398
  check = self.time_low <=> other_uuid.time_low
@@ -369,81 +417,69 @@ module UUIDTools
369
417
  return 0
370
418
  end
371
419
 
420
+ ##
372
421
  # Returns a representation of the object's state
373
422
  def inspect
374
423
  return "#<UUID:0x#{self.object_id.to_s(16)} UUID:#{self.to_s}>"
375
424
  end
376
425
 
426
+ ##
377
427
  # Returns the hex digest of the UUID object.
378
428
  def hexdigest
379
- return @hexdigest unless @hexdigest.nil?
380
- if self.frozen?
381
- return generate_hexdigest
382
- else
383
- return (@hexdigest = generate_hexdigest)
384
- end
429
+ self.frozen? ? generate_hexdigest : (@hexdigest ||= generate_hexdigest)
385
430
  end
386
431
 
432
+ ##
387
433
  # Returns the raw bytes that represent this UUID.
388
434
  def raw
389
- return @raw unless @raw.nil?
390
- if self.frozen?
391
- return generate_raw
392
- else
393
- return (@raw = generate_raw)
394
- end
435
+ self.frozen? ? generate_raw : (@raw ||= generate_raw)
395
436
  end
396
437
 
438
+ ##
397
439
  # Returns a string representation for this UUID.
398
440
  def to_s
399
- return @string unless @string.nil?
400
- if self.frozen?
401
- return generate_s
402
- else
403
- return (@string = generate_s)
404
- end
441
+ self.frozen? ? generate_s : (@string ||= generate_s)
405
442
  end
406
443
  alias_method :to_str, :to_s
407
444
 
445
+ ##
408
446
  # Returns an integer representation for this UUID.
409
447
  def to_i
410
- return @integer unless @integer.nil?
411
- if self.frozen?
412
- return generate_i
413
- else
414
- return (@integer = generate_i)
415
- end
448
+ self.frozen? ? generate_i : (@integer ||= generate_i)
416
449
  end
417
450
 
451
+ ##
418
452
  # Returns a URI string for this UUID.
419
453
  def to_uri
420
454
  return "urn:uuid:#{self.to_s}"
421
455
  end
422
456
 
457
+ ##
423
458
  # Returns an integer hash value.
424
459
  def hash
425
- return @hash unless @hash.nil?
426
- if self.frozen?
427
- return generate_hash
428
- else
429
- return (@hash = generate_hash)
430
- end
460
+ self.frozen? ? generate_hash : (@hash ||= generate_hash)
431
461
  end
432
462
 
433
- #These methods generate the appropriate representations the above methods cache
434
- protected
435
-
463
+ protected
464
+ ##
436
465
  # Generates the hex digest of the UUID object.
466
+ #
467
+ # @api private
437
468
  def generate_hexdigest
438
469
  return self.to_i.to_s(16).rjust(32, "0")
439
470
  end
440
-
471
+
441
472
  # Generates an integer hash value.
473
+ #
474
+ # @api private
442
475
  def generate_hash
443
476
  return self.to_i % 0x3fffffff
444
477
  end
445
-
478
+
479
+ ##
446
480
  # Generates an integer representation for this UUID.
481
+ #
482
+ # @api private
447
483
  def generate_i
448
484
  return (begin
449
485
  bytes = (time_low << 96) + (time_mid << 80) +
@@ -455,8 +491,11 @@ module UUIDTools
455
491
  bytes
456
492
  end)
457
493
  end
458
-
494
+
495
+ ##
459
496
  # Generates a string representation for this UUID.
497
+ #
498
+ # @api private
460
499
  def generate_s
461
500
  result = sprintf("%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", @time_low, @time_mid,
462
501
  @time_hi_and_version, @clock_seq_hi_and_reserved, @clock_seq_low);
@@ -465,25 +504,29 @@ module UUIDTools
465
504
  end
466
505
  return result.downcase
467
506
  end
468
-
507
+
508
+ ##
469
509
  # Generates the raw bytes that represent this UUID.
510
+ #
511
+ # @api private
470
512
  def generate_raw
471
513
  return self.class.convert_int_to_byte_string(self.to_i, 16)
472
514
  end
473
-
474
- public
475
515
 
516
+ public
517
+ ##
476
518
  # Returns true if this UUID is exactly equal to the other UUID.
477
519
  def eql?(other)
478
520
  return self == other
479
521
  end
480
522
 
523
+ ##
481
524
  # Returns the MAC address of the current computer's network card.
482
525
  # Returns nil if a MAC address could not be found.
483
- def self.mac_address #:nodoc:
526
+ def self.mac_address
484
527
  if !defined?(@@mac_address)
485
528
  require 'rbconfig'
486
- os_platform = Config::CONFIG['target_os']
529
+ os_platform = RbConfig::CONFIG['target_os']
487
530
  os_class = nil
488
531
  if (os_platform =~ /win/i && !(os_platform =~ /darwin/i)) ||
489
532
  os_platform =~ /w32/i
@@ -607,6 +650,7 @@ module UUIDTools
607
650
  return @@mac_address
608
651
  end
609
652
 
653
+ ##
610
654
  # Allows users to set the MAC address manually in cases where the MAC
611
655
  # address cannot be obtained programatically.
612
656
  def self.mac_address=(new_mac_address)
@@ -616,8 +660,12 @@ module UUIDTools
616
660
  # The following methods are not part of the public API,
617
661
  # and generally should not be called directly.
618
662
 
663
+
664
+ ##
619
665
  # Creates a new UUID from a SHA1 or MD5 hash
620
- def self.create_from_hash(hash_class, namespace, name) #:nodoc:
666
+ #
667
+ # @api private
668
+ def self.create_from_hash(hash_class, namespace, name)
621
669
  if hash_class == Digest::MD5
622
670
  version = 3
623
671
  elsif hash_class == Digest::SHA1
@@ -640,7 +688,9 @@ module UUIDTools
640
688
  return new_uuid
641
689
  end
642
690
 
643
- def self.convert_int_to_byte_string(integer, size) #:nodoc:
691
+ ##
692
+ # @api private
693
+ def self.convert_int_to_byte_string(integer, size)
644
694
  byte_string = ""
645
695
  if byte_string.respond_to?(:force_encoding)
646
696
  byte_string.force_encoding(Encoding::ASCII_8BIT)
@@ -651,7 +701,9 @@ module UUIDTools
651
701
  return byte_string
652
702
  end
653
703
 
654
- def self.convert_byte_string_to_int(byte_string) #:nodoc:
704
+ ##
705
+ # @api private
706
+ def self.convert_byte_string_to_int(byte_string)
655
707
  if byte_string.respond_to?(:force_encoding)
656
708
  byte_string.force_encoding(Encoding::ASCII_8BIT)
657
709
  end
@@ -666,8 +718,19 @@ module UUIDTools
666
718
  end
667
719
  end
668
720
 
721
+ ##
722
+ # Constant that represents the DNS namespace.
669
723
  UUID_DNS_NAMESPACE = UUID.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
724
+
725
+ ##
726
+ # Constant that represents the URL namespace.
670
727
  UUID_URL_NAMESPACE = UUID.parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
728
+
729
+ ##
730
+ # Constant that represents the OID namespace.
671
731
  UUID_OID_NAMESPACE = UUID.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
732
+
733
+ ##
734
+ # Constant that represents the X500 namespace.
672
735
  UUID_X500_NAMESPACE = UUID.parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
673
736
  end
@@ -1,33 +1,28 @@
1
+ # encoding:utf-8
1
2
  #--
2
- # UUIDTools, Copyright (c) 2005-2008 Bob Aman
3
+ # Copyright (C) 2005-2012 Bob Aman
3
4
  #
4
- # Permission is hereby granted, free of charge, to any person obtaining
5
- # a copy of this software and associated documentation files (the
6
- # "Software"), to deal in the Software without restriction, including
7
- # without limitation the rights to use, copy, modify, merge, publish,
8
- # distribute, sublicense, and/or sell copies of the Software, and to
9
- # permit persons to whom the Software is furnished to do so, subject to
10
- # the following conditions:
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
11
8
  #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
9
+ # http://www.apache.org/licenses/LICENSE-2.0
14
10
  #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
22
16
  #++
23
17
 
18
+
24
19
  # Used to prevent the class/module from being loaded more than once
25
- unless defined? UUID::VERSION
26
- class UUID
20
+ unless defined? UUIDTools::VERSION
21
+ module UUIDTools
27
22
  module VERSION #:nodoc:
28
23
  MAJOR = 2
29
24
  MINOR = 1
30
- TINY = 2
25
+ TINY = 3
31
26
 
32
27
  STRING = [MAJOR, MINOR, TINY].join('.')
33
28
  end
@@ -1,3 +1,5 @@
1
+ $VERBOSE=true
2
+
1
3
  spec_dir = File.expand_path(File.dirname(__FILE__))
2
4
  lib_dir = File.expand_path(File.join(spec_dir, "../lib"))
3
5
 
@@ -1,12 +1,11 @@
1
- require "rake/gempackagetask"
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
@@ -14,28 +13,47 @@ namespace :gem do
14
13
 
15
14
  s.files = PKG_FILES.to_a
16
15
 
17
- s.has_rdoc = true
18
- s.extra_rdoc_files = %w( README )
19
- s.rdoc_options.concat ["--main", "README"]
16
+ s.extra_rdoc_files = %w( README.md )
17
+ s.rdoc_options.concat ["--main", "README.md"]
20
18
 
21
- s.add_development_dependency("rake", ">= 0.8.3")
22
- s.add_development_dependency("rspec", ">= 1.1.11")
23
- s.add_development_dependency("launchy", ">= 0.3.2")
19
+ if !s.respond_to?(:add_development_dependency)
20
+ puts "Cannot build Gem with this version of RubyGems."
21
+ exit(1)
22
+ end
23
+
24
+ s.add_development_dependency("rake", ">= 0.7.3")
25
+ s.add_development_dependency("rspec", ">= 2.9.0")
26
+ s.add_development_dependency("yard", ">= 0.8.2")
27
+ s.add_development_dependency("launchy", ">= 2.0.0")
24
28
 
25
29
  s.require_path = "lib"
26
30
 
27
31
  s.author = "Bob Aman"
28
32
  s.email = "bob@sporkmonger.com"
29
- s.homepage = "http://#{PKG_NAME}.rubyforge.org/"
30
- s.rubyforge_project = RUBY_FORGE_PROJECT
33
+ s.homepage = RUBY_FORGE_URL
31
34
  end
32
35
 
33
- Rake::GemPackageTask.new(GEM_SPEC) do |p|
36
+ Gem::PackageTask.new(GEM_SPEC) do |p|
34
37
  p.gem_spec = GEM_SPEC
35
38
  p.need_tar = true
36
39
  p.need_zip = true
37
40
  end
38
41
 
42
+ desc "Generates .gemspec file"
43
+ task :gemspec do
44
+ spec_string = GEM_SPEC.to_ruby
45
+
46
+ begin
47
+ Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
48
+ rescue
49
+ abort "unsafe gemspec: #{$!}"
50
+ else
51
+ File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
52
+ file.write spec_string
53
+ end
54
+ end
55
+ end
56
+
39
57
  desc "Show information about the gem"
40
58
  task :debug do
41
59
  puts GEM_SPEC.to_ruby
@@ -65,4 +83,4 @@ end
65
83
  desc "Alias to gem:package"
66
84
  task "gem" => "gem:package"
67
85
 
68
- task "clobber" => ["gem:clobber_package"]
86
+ task "gem:release" => "gem:gemspec"
@@ -0,0 +1,58 @@
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 = true
12
+ t.rcov_opts = [
13
+ '--exclude', 'lib\\/compat',
14
+ '--exclude', 'spec',
15
+ '--exclude', '\\.rvm\\/gems',
16
+ '--exclude', '1\\.8\\/gems',
17
+ '--exclude', '1\\.9\\/gems',
18
+ '--exclude', '\\.rvm',
19
+ '--exclude', '\\/Library\\/Ruby'
20
+ ]
21
+ end
22
+
23
+ RSpec::Core::RakeTask.new(:normal) do |t|
24
+ t.pattern = FileList['spec/**/*_spec.rb'].exclude(/compat/)
25
+ t.rspec_opts = ['--color', '--format', 'documentation']
26
+ t.rcov = false
27
+ end
28
+
29
+ RSpec::Core::RakeTask.new(:all) do |t|
30
+ t.pattern = FileList['spec/**/*_spec.rb']
31
+ t.rspec_opts = ['--color', '--format', 'documentation']
32
+ t.rcov = false
33
+ end
34
+
35
+ desc "Generate HTML Specdocs for all specs"
36
+ RSpec::Core::RakeTask.new(:specdoc) do |t|
37
+ specdoc_path = File.expand_path(
38
+ File.join(File.dirname(__FILE__), '..', 'documentation')
39
+ )
40
+ Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
41
+
42
+ output_file = File.join(specdoc_path, 'index.html')
43
+ t.pattern = FileList['spec/**/*_spec.rb']
44
+ t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
45
+ t.fail_on_error = false
46
+ end
47
+
48
+ namespace :rcov do
49
+ desc "Browse the code coverage report."
50
+ task :browse => "spec:rcov" do
51
+ require "launchy"
52
+ Launchy::Browser.run("coverage/index.html")
53
+ end
54
+ end
55
+ end
56
+
57
+ desc "Alias to spec:normal"
58
+ task "spec" => "spec:normal"
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  namespace :doc do
28
28
  desc "Publish RDoc to RubyForge"
29
- task :release => ["doc:rdoc"] do
29
+ task :release => ["doc:yard"] do
30
30
  require "rake/contrib/sshpublisher"
31
31
  require "yaml"
32
32
 
@@ -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"
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuidtools
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease:
6
- segments:
7
- - 2
8
- - 1
9
- - 2
10
- version: 2.1.2
5
+ version: 2.1.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Bob Aman
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-02 00:00:00 -08:00
19
- default_executable:
13
+ date: 2012-07-16 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: rake
@@ -26,12 +20,7 @@ dependencies:
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 57
30
- segments:
31
- - 0
32
- - 8
33
- - 3
34
- version: 0.8.3
23
+ version: 0.7.3
35
24
  type: :development
36
25
  version_requirements: *id001
37
26
  - !ruby/object:Gem::Dependency
@@ -42,30 +31,31 @@ dependencies:
42
31
  requirements:
43
32
  - - ">="
44
33
  - !ruby/object:Gem::Version
45
- hash: 5
46
- segments:
47
- - 1
48
- - 1
49
- - 11
50
- version: 1.1.11
34
+ version: 2.9.0
51
35
  type: :development
52
36
  version_requirements: *id002
53
37
  - !ruby/object:Gem::Dependency
54
- name: launchy
38
+ name: yard
55
39
  prerelease: false
56
40
  requirement: &id003 !ruby/object:Gem::Requirement
57
41
  none: false
58
42
  requirements:
59
43
  - - ">="
60
44
  - !ruby/object:Gem::Version
61
- hash: 23
62
- segments:
63
- - 0
64
- - 3
65
- - 2
66
- version: 0.3.2
45
+ version: 0.8.2
67
46
  type: :development
68
47
  version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: launchy
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0
57
+ type: :development
58
+ version_requirements: *id004
69
59
  description: |
70
60
  A simple universally unique ID generation library.
71
61
 
@@ -75,7 +65,7 @@ executables: []
75
65
  extensions: []
76
66
 
77
67
  extra_rdoc_files:
78
- - README
68
+ - README.md
79
69
  files:
80
70
  - lib/compat/securerandom.rb
81
71
  - lib/uuidtools/version.rb
@@ -87,26 +77,26 @@ files:
87
77
  - spec/uuidtools/uuid_creation_spec.rb
88
78
  - spec/uuidtools/uuid_parsing_spec.rb
89
79
  - tasks/benchmark.rake
90
- - tasks/clobber.rake
91
80
  - tasks/gem.rake
92
81
  - tasks/git.rake
93
82
  - tasks/metrics.rake
94
- - tasks/rdoc.rake
83
+ - tasks/rspec.rake
95
84
  - tasks/rubyforge.rake
96
- - tasks/spec.rake
85
+ - tasks/yard.rake
97
86
  - website/index.html
98
87
  - CHANGELOG
99
- - LICENSE
88
+ - Gemfile
89
+ - Gemfile.lock
90
+ - LICENSE.txt
100
91
  - Rakefile
101
- - README
102
- has_rdoc: true
92
+ - README.md
103
93
  homepage: http://uuidtools.rubyforge.org/
104
94
  licenses: []
105
95
 
106
96
  post_install_message:
107
97
  rdoc_options:
108
98
  - --main
109
- - README
99
+ - README.md
110
100
  require_paths:
111
101
  - lib
112
102
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -114,23 +104,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
104
  requirements:
115
105
  - - ">="
116
106
  - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
107
  version: "0"
121
108
  required_rubygems_version: !ruby/object:Gem::Requirement
122
109
  none: false
123
110
  requirements:
124
111
  - - ">="
125
112
  - !ruby/object:Gem::Version
126
- hash: 3
127
- segments:
128
- - 0
129
113
  version: "0"
130
114
  requirements: []
131
115
 
132
- rubyforge_project: uuidtools
133
- rubygems_version: 1.4.1
116
+ rubyforge_project:
117
+ rubygems_version: 1.8.24
134
118
  signing_key:
135
119
  specification_version: 3
136
120
  summary: UUID generator
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- UUIDTools, Copyright (c) 2005-2008 Bob Aman
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README DELETED
@@ -1,13 +0,0 @@
1
- UUIDTools was designed to be a simple library for generating any
2
- of the various types of UUIDs. It conforms to RFC 4122 whenever
3
- possible.
4
-
5
- == Example
6
- UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
7
- => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
8
- UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
9
- => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
10
- UUIDTools::UUID.timestamp_create
11
- => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
12
- UUIDTools::UUID.random_create
13
- => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
@@ -1,2 +0,0 @@
1
- desc "Remove all build products"
2
- task "clobber"
@@ -1,29 +0,0 @@
1
- require "rake/rdoctask"
2
-
3
- namespace :doc do
4
- desc "Generate RDoc documentation"
5
- Rake::RDocTask.new do |rdoc|
6
- rdoc.rdoc_dir = "doc"
7
- rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
8
- rdoc.options << "--line-numbers" << "--inline-source" <<
9
- "--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
10
- rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
11
- rdoc.rdoc_files.include("README", "CHANGELOG", "LICENSE")
12
- rdoc.rdoc_files.include("lib/**/*.rb")
13
- end
14
-
15
- desc "Generate ri locally for testing"
16
- task :ri do
17
- sh "rdoc --ri -o ri ."
18
- end
19
-
20
- desc "Remove ri products"
21
- task :clobber_ri do
22
- rm_r "ri" rescue nil
23
- end
24
- end
25
-
26
- desc "Alias to doc:rdoc"
27
- task "doc" => "doc:rdoc"
28
-
29
- task "clobber" => ["doc:clobber_rdoc", "doc:clobber_ri"]
@@ -1,64 +0,0 @@
1
- require 'spec/rake/verify_rcov'
2
-
3
- namespace :spec do
4
- Spec::Rake::SpecTask.new(:rcov) do |t|
5
- t.spec_files = FileList['spec/**/*_spec.rb']
6
- t.spec_opts = ['--color', '--format', 'specdoc']
7
- if RCOV_ENABLED
8
- t.rcov = true
9
- else
10
- t.rcov = false
11
- end
12
- t.rcov_opts = [
13
- '--exclude', 'spec',
14
- '--exclude', '1\\.8\\/gems',
15
- '--exclude', '1\\.9\\/gems',
16
- '--exclude', 'addressable\\/idna\\.rb', # unicode tables too big
17
- ]
18
- end
19
-
20
- Spec::Rake::SpecTask.new(:normal) do |t|
21
- t.spec_files = FileList['spec/**/*_spec.rb']
22
- t.spec_opts = ['--color', '--format', 'specdoc']
23
- t.rcov = false
24
- end
25
-
26
- if RCOV_ENABLED
27
- RCov::VerifyTask.new(:verify) do |t|
28
- t.threshold = 100.0
29
- t.index_html = 'coverage/index.html'
30
- end
31
-
32
- task :verify => :rcov
33
- end
34
-
35
- desc "Generate HTML Specdocs for all specs"
36
- Spec::Rake::SpecTask.new(:specdoc) do |t|
37
- specdoc_path = File.expand_path(
38
- File.join(File.dirname(__FILE__), '../specdoc/'))
39
- Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
40
-
41
- output_file = File.join(specdoc_path, 'index.html')
42
- t.spec_files = FileList['spec/**/*_spec.rb']
43
- t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
44
- t.fail_on_error = false
45
- end
46
-
47
- namespace :rcov do
48
- desc "Browse the code coverage report."
49
- task :browse => "spec:rcov" do
50
- require "launchy"
51
- Launchy::Browser.run("coverage/index.html")
52
- end
53
- end
54
- end
55
-
56
- if RCOV_ENABLED
57
- desc "Alias to spec:verify"
58
- task "spec" => "spec:verify"
59
- else
60
- desc "Alias to spec:normal"
61
- task "spec" => "spec:normal"
62
- end
63
-
64
- task "clobber" => ["spec:clobber_rcov"]