sysuuid 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -7
- data/ext/sysuuid.c +1 -13
- metadata +71 -13
- data/spec/sysuuid_spec.rb +0 -24
data/Rakefile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'vendor/gems/environment'
|
2
|
-
|
3
1
|
require 'rake'
|
4
|
-
require '
|
5
|
-
require '
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/core/rake_task'
|
6
4
|
|
7
5
|
task :default => [:clean, :make, :spec]
|
8
6
|
|
@@ -13,9 +11,9 @@ task :make do
|
|
13
11
|
end
|
14
12
|
end
|
15
13
|
|
16
|
-
|
17
|
-
t.
|
18
|
-
t.
|
14
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
15
|
+
t.rspec_opts = %w(-fs -c)
|
16
|
+
t.pattern = FileList['spec/*_spec.rb']
|
19
17
|
end
|
20
18
|
|
21
19
|
task :clean do
|
data/ext/sysuuid.c
CHANGED
@@ -27,20 +27,8 @@ sysuuid_uuid(VALUE self)
|
|
27
27
|
uuid_t uuid;
|
28
28
|
|
29
29
|
uuid_generate(uuid);
|
30
|
-
|
30
|
+
uuid_unparse(uuid, uuid_str);
|
31
31
|
|
32
32
|
return rb_str_new2(uuid_str);
|
33
33
|
}
|
34
34
|
|
35
|
-
// magic_fail - raise exceptions
|
36
|
-
void
|
37
|
-
err(const char *error)
|
38
|
-
{
|
39
|
-
const char *format = "magic_%s() error";
|
40
|
-
char *error_message;
|
41
|
-
|
42
|
-
error_message = malloc(sizeof(char *) * (strlen(format) + strlen(error)));
|
43
|
-
sprintf((char *)error_message, format, error);
|
44
|
-
rb_raise(rb_const_get(rb_cObject, rb_intern("RuntimeError")), error_message);
|
45
|
-
}
|
46
|
-
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysuuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- David Turnbull
|
@@ -14,10 +15,64 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
date: 2011-05-19 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
requirement: *id001
|
32
|
+
prerelease: false
|
33
|
+
name: rake
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
hash: 3
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
requirement: *id002
|
46
|
+
prerelease: false
|
47
|
+
name: rspec
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
type: :runtime
|
59
|
+
requirement: *id003
|
60
|
+
prerelease: false
|
61
|
+
name: jeweler
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
type: :runtime
|
73
|
+
requirement: *id004
|
74
|
+
prerelease: false
|
75
|
+
name: should_be_faster
|
21
76
|
description: " sysuuid # => BBC4937C-344F-47C5-AA36-E19CC070DBCC\n"
|
22
77
|
email: dsturnbull@me.com
|
23
78
|
executables: []
|
@@ -32,35 +87,38 @@ files:
|
|
32
87
|
- ext/extconf.rb
|
33
88
|
- ext/sysuuid.c
|
34
89
|
- README
|
35
|
-
has_rdoc: true
|
36
90
|
homepage: http://github.com/dsturnbull/sysuuid
|
37
91
|
licenses: []
|
38
92
|
|
39
93
|
post_install_message:
|
40
|
-
rdoc_options:
|
41
|
-
|
94
|
+
rdoc_options: []
|
95
|
+
|
42
96
|
require_paths:
|
43
97
|
- lib
|
44
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
45
100
|
requirements:
|
46
101
|
- - ">="
|
47
102
|
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
48
104
|
segments:
|
49
105
|
- 0
|
50
106
|
version: "0"
|
51
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
52
109
|
requirements:
|
53
110
|
- - ">="
|
54
111
|
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
55
113
|
segments:
|
56
114
|
- 0
|
57
115
|
version: "0"
|
58
116
|
requirements: []
|
59
117
|
|
60
118
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.
|
119
|
+
rubygems_version: 1.8.2
|
62
120
|
signing_key:
|
63
121
|
specification_version: 3
|
64
122
|
summary: uses uuid.h for fast uuid generation
|
65
|
-
test_files:
|
66
|
-
|
123
|
+
test_files: []
|
124
|
+
|
data/spec/sysuuid_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'should_be_faster'
|
3
|
-
require 'tempfile'
|
4
|
-
require 'ext/sysuuid'
|
5
|
-
|
6
|
-
describe SysUUID do
|
7
|
-
it 'should create a uuid' do
|
8
|
-
sysuuid.should be_instance_of String
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should create unique uuids' do
|
12
|
-
sysuuid.should_not == sysuuid
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should not repeat for reasonable counts' do
|
16
|
-
1000.times.map { sysuuid }.uniq.length.should == 1000
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should be faster than `uuidgen`' do
|
20
|
-
shell = lambda { `uuidgen` }
|
21
|
-
ext = lambda { sysuuid }
|
22
|
-
ext.should be_at_least(2000).times.faster_than(shell)
|
23
|
-
end
|
24
|
-
end
|