cuuid 0.3.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cuuid (0.5.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.3)
10
+ rake (0.9.2.2)
11
+ rake-compiler (0.8.1)
12
+ rake
13
+ rspec (2.11.0)
14
+ rspec-core (~> 2.11.0)
15
+ rspec-expectations (~> 2.11.0)
16
+ rspec-mocks (~> 2.11.0)
17
+ rspec-core (2.11.1)
18
+ rspec-expectations (2.11.2)
19
+ diff-lcs (~> 1.1.3)
20
+ rspec-mocks (2.11.2)
21
+
22
+ PLATFORMS
23
+ java
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ cuuid!
28
+ rake-compiler
29
+ rspec
data/Rakefile CHANGED
@@ -1,21 +1,12 @@
1
- require "rake/extensiontask"
2
- require "rubygems/package_task"
1
+ spec = Gem::Specification.load("cuuid.gemspec")
3
2
 
4
- spec = Gem::Specification.new do |s|
5
- s.name = "cuuid"
6
- s.version = "0.3.1"
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"]
3
+ require "rubygems/package_task"
4
+ Gem::PackageTask.new(spec) {}
14
5
 
15
- s.add_development_dependency "rake-compiler"
16
- s.add_development_dependency "rspec"
17
- s.has_rdoc = false
6
+ if RUBY_PLATFORM["java"]
7
+ require "rake/javaextensiontask"
8
+ Rake::JavaExtensionTask.new("cuuid_generator", spec)
9
+ else
10
+ require "rake/extensiontask"
11
+ Rake::ExtensionTask.new("cuuid_generator", spec)
18
12
  end
19
-
20
- Gem::PackageTask.new(spec) {}
21
- Rake::ExtensionTask.new('cuuid', spec)
@@ -0,0 +1,11 @@
1
+ package com.emberads.cuuid;
2
+
3
+ import java.util.UUID;
4
+
5
+ public class Generator {
6
+
7
+ private static String generate() {
8
+ return UUID.randomUUID().toString();
9
+ }
10
+
11
+ }
@@ -0,0 +1,31 @@
1
+ #include <ruby.h>
2
+ #include <uuid/uuid.h>
3
+
4
+ // CUUID::Generator.generate
5
+
6
+ // Define our module & class constants
7
+ VALUE CUUID = Qnil;
8
+ VALUE CUUIDGenerator = Qnil;
9
+
10
+ void Init_cuuid_generator();
11
+ static VALUE method_cuuid_generator_generate(VALUE self);
12
+
13
+ // Define CUUID, CUUID::Generator and the class method
14
+ void Init_cuuid_generator() {
15
+ CUUID = rb_define_module("CUUID");
16
+ CUUIDGenerator = rb_define_module_under(CUUID, "Generator");
17
+ rb_define_module_function(CUUIDGenerator, "generate", method_cuuid_generator_generate, 0);
18
+ }
19
+
20
+ // Implement CUUID.generate
21
+ static VALUE method_cuuid_generator_generate(VALUE self) {
22
+ uuid_t uuid_id;
23
+ char uuid_str[128];
24
+
25
+ // Generate UUID and grab string version of it
26
+ uuid_generate(uuid_id);
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_generator")
4
+ have_library("uuid") if RUBY_PLATFORM[/linux/i]
5
+ create_makefile("cuuid_generator")
@@ -0,0 +1,16 @@
1
+ require File.expand_path("cuuid_generator", File.dirname(__FILE__))
2
+
3
+ module CUUID
4
+
5
+ if RUBY_PLATFORM["java"]
6
+ require "jruby"
7
+ include_package 'com.emberads.cuuid'
8
+ Generator = Java::ComEmberadsCuuid::Generator
9
+ end
10
+
11
+ # backwards compatible (& lazy)
12
+ def self.generate
13
+ Generator.generate
14
+ end
15
+
16
+ end
@@ -0,0 +1,3 @@
1
+ module CUUID
2
+ VERSION = "0.5.0"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuuid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-13 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
16
- requirement: &70176507062220 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70176507062220
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70176506925020 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,17 +37,27 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70176506925020
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description:
37
47
  email: caius@emberads.com
38
48
  executables: []
39
49
  extensions:
40
- - ext/cuuid/extconf.rb
50
+ - ext/cuuid_generator/extconf.rb
41
51
  extra_rdoc_files: []
42
52
  files:
43
- - ext/cuuid/cuuid.c
44
- - ext/cuuid/extconf.rb
53
+ - ext/cuuid_generator/cuuid_generator.c
54
+ - ext/cuuid_generator/extconf.rb
55
+ - ext/cuuid_generator/Generator.java
45
56
  - lib/cuuid/uuid.rb
57
+ - lib/cuuid/version.rb
58
+ - lib/cuuid.rb
59
+ - Gemfile
60
+ - Gemfile.lock
46
61
  - LICENSE
47
62
  - Rakefile
48
63
  - Readme.md
@@ -58,15 +73,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
73
  - - ! '>='
59
74
  - !ruby/object:Gem::Version
60
75
  version: '0'
76
+ segments:
77
+ - 0
78
+ hash: 1008422031192506172
61
79
  required_rubygems_version: !ruby/object:Gem::Requirement
62
80
  none: false
63
81
  requirements:
64
82
  - - ! '>='
65
83
  - !ruby/object:Gem::Version
66
84
  version: '0'
85
+ segments:
86
+ - 0
87
+ hash: 1008422031192506172
67
88
  requirements: []
68
89
  rubyforge_project:
69
- rubygems_version: 1.8.15
90
+ rubygems_version: 1.8.24
70
91
  signing_key:
71
92
  specification_version: 3
72
93
  summary: Ruby wrapper for the uuid library in your OS.
@@ -1,31 +0,0 @@
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
- static VALUE method_generate();
12
-
13
- // Define CUUID and the fact it has a class method called generate
14
- void Init_cuuid() {
15
- int arg_count = 0;
16
- CUUID = rb_define_module("CUUID");
17
- rb_define_module_function(CUUID, "generate", method_generate, arg_count);
18
- }
19
-
20
- // Implement CUUID.generate
21
- static VALUE method_generate(VALUE self) {
22
- uuid_t uuid_id;
23
- char uuid_str[128];
24
-
25
- // Generate UUID and grab string version of it
26
- uuid_generate(uuid_id);
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
- }
@@ -1,5 +0,0 @@
1
- require 'mkmf'
2
-
3
- dir_config("cuuid")
4
- have_library("uuid") if RUBY_PLATFORM[/linux/i]
5
- create_makefile("cuuid")