my_uuid 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 崔峥
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.
@@ -0,0 +1,19 @@
1
+ = my_uuid
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to my_uuid
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 崔峥. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,6 @@
1
+ require 'mkmf'
2
+
3
+ # if have_library("uuid") and have_header("uuid/uuid.h")
4
+ if have_header("uuid/uuid.h")
5
+ create_makefile("my_uuid/my_uuid")
6
+ end
@@ -0,0 +1,29 @@
1
+ #include "my_uuid.h"
2
+
3
+ static VALUE rb_cMyUUID;
4
+
5
+ Init_my_uuid()
6
+ {
7
+ rb_cMyUUID = rb_define_class("MyUUID", rb_cObject);
8
+ // rb_define_alloc_func(rb_cMyUUID, my_uuid_alloc);
9
+ rb_define_module_function(rb_cMyUUID, "generate", my_uuid_generate, 0);
10
+ }
11
+
12
+ static VALUE
13
+ my_uuid_generate(VALUE self)
14
+ {
15
+ uuid_t uuid;
16
+ int size = 36;
17
+ char *uuid_s = malloc(sizeof(char)*size);
18
+ VALUE str;
19
+
20
+ uuid_generate(uuid);
21
+ if(uuid)
22
+ {
23
+ uuid_unparse_lower(uuid, uuid_s);
24
+ str = rb_tainted_str_new(uuid_s, size);
25
+ }
26
+ free(uuid_s);
27
+
28
+ return str;
29
+ }
@@ -0,0 +1,13 @@
1
+ #ifndef __MY_UUID_H
2
+ #define __MY_UUID_H
3
+
4
+ #include <uuid/uuid.h>
5
+ #include <ruby.h>
6
+
7
+ /* Defined in uuid */
8
+ extern void uuid_generate(uuid_t out);
9
+
10
+ /* Defined in my_uuid.c */
11
+ static VALUE my_uuid_generate(VALUE self);
12
+
13
+ #endif
@@ -0,0 +1 @@
1
+ require "my_uuid/my_uuid"
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: my_uuid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - 崔峥
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.12'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.12'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.4
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.4
62
+ description:
63
+ email: zheng.cuizh@gmail.com
64
+ executables: []
65
+ extensions:
66
+ - ext/my_uuid/extconf.rb
67
+ extra_rdoc_files:
68
+ - LICENSE.txt
69
+ - README.rdoc
70
+ files:
71
+ - ext/my_uuid/extconf.rb
72
+ - ext/my_uuid/my_uuid.c
73
+ - ext/my_uuid/my_uuid.h
74
+ - lib/my_uuid.rb
75
+ - LICENSE.txt
76
+ - README.rdoc
77
+ homepage: http://github.com/charlescui/my_uuid
78
+ licenses:
79
+ - MIT
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
91
+ - 0
92
+ hash: 104284767660483452
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 1.8.24
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: C extension for uuid on MacosX
105
+ test_files: []