cuuid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 EmberAds Ltd <team@emberads.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require "rake/extensiontask"
2
+ require "rubygems/package_task"
3
+
4
+ spec = Gem::Specification.new do |s|
5
+ s.name = "cuuid"
6
+ s.version = "0.1.0"
7
+ s.author = "Caius Durling"
8
+ s.email = "caius@emberads.com"
9
+ s.homepage = "http://github.com/EmberAds/cuuid"
10
+ s.platform = Gem::Platform::RUBY
11
+ s.summary = "Ruby wrapper for the uuid library in your OS."
12
+ s.files = FileList["ext/**/*", "lib/**/*.rb", "[A-Z]*"].to_a
13
+ s.extensions = FileList["ext/**/extconf.rb"]
14
+
15
+ s.add_development_dependency "rake-compiler"
16
+ s.has_rdoc = false
17
+ end
18
+
19
+ Gem::PackageTask.new(spec) {}
20
+ Rake::ExtensionTask.new('cuuid', spec)
data/Readme.md ADDED
@@ -0,0 +1,34 @@
1
+ # CUUID
2
+
3
+ This gem is a thin C => Ruby wrapper around the `<uuid/uuid.h>` library that should come with your OS. It's been tested on OS X (10.7+) and Ubuntu (10.04 LTS). It provides one method for you.
4
+
5
+ ## Usage
6
+
7
+ CUUID.generate # => "08146761-57BF-46C9-A55B-1B49103AA08B"
8
+
9
+ Or if you've required `"cuuid/uuid"` then you can just do
10
+
11
+ UUID.generate # => "08146761-57BF-46C9-A55B-1B49103AA08B"
12
+
13
+ ## Installation
14
+
15
+ Rubygem install:
16
+
17
+ gem install cuuid
18
+
19
+ Gemfile:
20
+
21
+ gem "cuuid"
22
+
23
+ There's an optional file for compatibility with the [uuid gem](http://rubygems.org/gems/uuid):
24
+
25
+ require "cuuid/uuid"
26
+
27
+ or in your Gemfile:
28
+
29
+ gem "cuuid", require: "cuuid/uuid"
30
+
31
+
32
+ ## License
33
+
34
+ See LICENSE
data/ext/cuuid/cuuid.c ADDED
@@ -0,0 +1,31 @@
1
+ #include <ruby.h>
2
+ #include <uuid/uuid.h>
3
+
4
+ // Define our module constant
5
+ VALUE CUUID = Qnil;
6
+
7
+ // Prototype this
8
+ void Init_cuuid();
9
+
10
+ // Prototype CUUID.generate
11
+ VALUE method_generate();
12
+
13
+ // Define CUUID and the fact it has a class method called uuid1
14
+ void Init_cuuid() {
15
+ CUUID = rb_define_module("CUUID");
16
+ int arg_count = 0;
17
+ rb_define_module_function(CUUID, "generate", method_generate, arg_count);
18
+ }
19
+
20
+ // Implement CUUID.generate
21
+ VALUE method_generate(VALUE self) {
22
+ uuid_t uuid_id;
23
+ char uuid_str[128];
24
+
25
+ uuid_generate(uuid_id);
26
+
27
+ uuid_unparse(uuid_id, uuid_str);
28
+
29
+ // Cast it into a ruby string and return it
30
+ return rb_str_new2(uuid_str);
31
+ }
@@ -0,0 +1,5 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("cuuid")
4
+
5
+ create_makefile("cuuid")
data/lib/cuuid/uuid.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "cuuid"
2
+
3
+ # For compatibility with the UUID gem
4
+ UUID = CUUID
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuuid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Caius Durling
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake-compiler
16
+ requirement: &70201584539920 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70201584539920
25
+ description:
26
+ email: caius@emberads.com
27
+ executables: []
28
+ extensions:
29
+ - ext/cuuid/extconf.rb
30
+ extra_rdoc_files: []
31
+ files:
32
+ - ext/cuuid/cuuid.c
33
+ - ext/cuuid/extconf.rb
34
+ - lib/cuuid/uuid.rb
35
+ - LICENSE
36
+ - Rakefile
37
+ - Readme.md
38
+ homepage: http://github.com/EmberAds/cuuid
39
+ licenses: []
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 1.8.15
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Ruby wrapper for the uuid library in your OS.
62
+ test_files: []