suid 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.markdown +3 -1
- data/Rakefile.rb +39 -0
- data/lib/suid.rb +34 -0
- data/spec/suid_spec.rb +1 -1
- data/suid.gemspec +45 -0
- metadata +17 -5
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.tmproj
|
data/README.markdown
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
## SUID : A gem to generate sorta unique IDs
|
2
2
|
|
3
|
-
|
3
|
+
github: [http://github.com/dburkes/suid](http://rdoc.info/projects/dburkes/suid)
|
4
|
+
|
5
|
+
rdocs: [http://rdoc.info/projects/dburkes/suid](http://rdoc.info/projects/dburkes/suid)
|
4
6
|
|
5
7
|
## Intro
|
6
8
|
|
data/Rakefile.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
begin; require 'rubygems'; rescue LoadError; end
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'spec/rake/spectask'
|
6
|
+
|
7
|
+
desc "Run all specs"
|
8
|
+
Spec::Rake::SpecTask.new('specs') do |t|
|
9
|
+
t.libs << 'lib'
|
10
|
+
t.spec_files = FileList['spec/**/*.rb']
|
11
|
+
end
|
12
|
+
|
13
|
+
Dir['tasks/*.rake'].each{|f| import(f) }
|
14
|
+
|
15
|
+
task :default => [:specs]
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'jeweler'
|
19
|
+
require 'lib/suid'
|
20
|
+
Jeweler::Tasks.new do |gemspec|
|
21
|
+
gemspec.name = "suid"
|
22
|
+
gemspec.version = SUID::VERSION
|
23
|
+
gemspec.summary = "Sorta Unique ID"
|
24
|
+
gemspec.email = "dburkes@netable.com"
|
25
|
+
gemspec.homepage = "http://github.com/dburkes/suid"
|
26
|
+
gemspec.description = "Sorta Unique ID"
|
27
|
+
gemspec.authors = ["Danny Burkes"]
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :doc do
|
34
|
+
desc "Generate RDoc"
|
35
|
+
Rake::RDocTask.new('suid') { |rdoc|
|
36
|
+
rdoc.rdoc_dir = 'doc'
|
37
|
+
rdoc.options << '--inline-source'
|
38
|
+
}
|
39
|
+
end
|
data/lib/suid.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
class SUID
|
2
|
+
def initialize
|
3
|
+
@value = rand(0xffffffffffffffff)
|
4
|
+
end
|
5
|
+
|
6
|
+
def to_s
|
7
|
+
@str ||= to_string
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_i
|
11
|
+
@value
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.generate
|
15
|
+
new.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
VERSION = "1.0.1"
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def to_string
|
23
|
+
val = self.to_i
|
24
|
+
rval = ''
|
25
|
+
while rval.length < 11
|
26
|
+
dm = val.divmod 62
|
27
|
+
rval = @@chars62[dm[1]] + rval
|
28
|
+
val = dm[0]
|
29
|
+
end
|
30
|
+
rval
|
31
|
+
end
|
32
|
+
|
33
|
+
@@chars62=('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a
|
34
|
+
end
|
data/spec/suid_spec.rb
CHANGED
data/suid.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile.rb, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{suid}
|
8
|
+
s.version = "1.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Danny Burkes"]
|
12
|
+
s.date = %q{2010-03-08}
|
13
|
+
s.description = %q{Sorta Unique ID}
|
14
|
+
s.email = %q{dburkes@netable.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.markdown"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.markdown",
|
21
|
+
"Rakefile.rb",
|
22
|
+
"lib/suid.rb",
|
23
|
+
"spec/suid_spec.rb",
|
24
|
+
"suid.gemspec"
|
25
|
+
]
|
26
|
+
s.homepage = %q{http://github.com/dburkes/suid}
|
27
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.3.6}
|
30
|
+
s.summary = %q{Sorta Unique ID}
|
31
|
+
s.test_files = [
|
32
|
+
"spec/suid_spec.rb"
|
33
|
+
]
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
|
+
else
|
41
|
+
end
|
42
|
+
else
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Danny Burkes
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-03-08 00:00:00 -08:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -22,7 +27,12 @@ extensions: []
|
|
22
27
|
extra_rdoc_files:
|
23
28
|
- README.markdown
|
24
29
|
files:
|
30
|
+
- .gitignore
|
25
31
|
- README.markdown
|
32
|
+
- Rakefile.rb
|
33
|
+
- lib/suid.rb
|
34
|
+
- spec/suid_spec.rb
|
35
|
+
- suid.gemspec
|
26
36
|
has_rdoc: true
|
27
37
|
homepage: http://github.com/dburkes/suid
|
28
38
|
licenses: []
|
@@ -36,18 +46,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
46
|
requirements:
|
37
47
|
- - ">="
|
38
48
|
- !ruby/object:Gem::Version
|
49
|
+
segments:
|
50
|
+
- 0
|
39
51
|
version: "0"
|
40
|
-
version:
|
41
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
53
|
requirements:
|
43
54
|
- - ">="
|
44
55
|
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
45
58
|
version: "0"
|
46
|
-
version:
|
47
59
|
requirements: []
|
48
60
|
|
49
61
|
rubyforge_project:
|
50
|
-
rubygems_version: 1.3.
|
62
|
+
rubygems_version: 1.3.6
|
51
63
|
signing_key:
|
52
64
|
specification_version: 3
|
53
65
|
summary: Sorta Unique ID
|