active_record_uuid 0.2.0 → 0.3.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.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -1
- data/.travis.yml +10 -0
- data/README.md +9 -7
- data/Rakefile +27 -0
- data/active_record_uuid.gemspec +9 -6
- data/gemfiles/active_record_32.gemfile +5 -0
- data/gemfiles/active_record_40.gemfile +5 -0
- data/lib/active_record_uuid/serializer.rb +4 -4
- data/lib/active_record_uuid/version.rb +1 -1
- data/spec/lib/base64_uuid_spec.rb +11 -11
- data/spec/lib/binary_uuid_spec.rb +12 -12
- data/spec/lib/has_uuid_spec.rb +12 -12
- data/spec/lib/hexdigest_uuid_spec.rb +11 -11
- data/spec/lib/string_uuid_spec.rb +11 -11
- data/spec/spec_helper.rb +4 -2
- metadata +44 -41
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 185437c51f1a4b60817d9714b54261317e2431f4
|
|
4
|
+
data.tar.gz: d1470c257cc12afc2bedb247e6044ce0e2ab9d2f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 748142752bde672a4039817a73d93d7d6dfc4a02c355aa22f1ec936d83fe482f3520fa7d7a3fa7f19ada8b2524a3d45b41d8a22b4a9e000c4952f35c9bb0472d
|
|
7
|
+
data.tar.gz: 457e078a63250f1da152e71f975ebb7f409908f5e1748d3e7b38d40a65a023cc36e5a2c940978575a635150e6c6952cb40ee81cc19812cc32de479cd8ac7a4c0
|
data/.gitignore
CHANGED
data/.rvmrc
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
|
7
7
|
# Only full ruby name is supported here, for short names use:
|
|
8
8
|
# echo "rvm use 1.9.3" > .rvmrc
|
|
9
|
-
environment_id="ruby-
|
|
9
|
+
environment_id="ruby-2.0.0-p247@active_record_uuid"
|
|
10
10
|
|
|
11
11
|
# Uncomment the following lines if you want to verify rvm version per project
|
|
12
12
|
# rvmrc_rvm_version="1.12.1 (stable)" # 1.10.1 seams as a safe start
|
data/.travis.yml
ADDED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ActiveRecordUuid
|
|
1
|
+
# ActiveRecordUuid [](https://travis-ci.org/chamnap/active_record_uuid)
|
|
2
2
|
|
|
3
3
|
`active_record_uuid` is a nice gem that add uuid supports to your `activerecord` models (MySQL). It allows you to store uuid in various formats: binary (16 bytes), base64 (24 bytes), hexdigest (32 bytes), or string (36 bytes), and query back with uuid string.
|
|
4
4
|
|
|
@@ -67,12 +67,14 @@ In order for the gem to work well, you need to specify the column `type` and `li
|
|
|
67
67
|
|
|
68
68
|
You can configure using `ActiveRecordUuid.configure`, and it will apply to any models which use `has_uuid`. Each model can overwrite the general options by passing options into `has_uuid`. The following are default values:
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
ActiveRecordUuid.configure do
|
|
71
|
+
column :uuid # :uuid is default
|
|
72
|
+
primary_key true # false is default
|
|
73
|
+
association false # false is default
|
|
74
|
+
generator :timestamp # :timestamp is default
|
|
75
|
+
store_as :string # :string is default
|
|
76
|
+
hook :before_create # :before_validation is default
|
|
77
|
+
end
|
|
76
78
|
|
|
77
79
|
There's a config generator that generates the default configuration file into config/initializers directory.
|
|
78
80
|
Run the following generator command, then edit the generated file.
|
data/Rakefile
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env rake
|
|
2
2
|
require "bundler/gem_tasks"
|
|
3
|
+
|
|
4
|
+
require 'rspec/core'
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
8
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
task :default => "spec:all"
|
|
12
|
+
|
|
13
|
+
namespace :spec do
|
|
14
|
+
%w(active_record_40 active_record_32).each do |gemfile|
|
|
15
|
+
desc "Run Tests against #{gemfile}"
|
|
16
|
+
task gemfile do
|
|
17
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
|
18
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "Run Tests against active_record versions"
|
|
23
|
+
task :all do
|
|
24
|
+
%w(active_record_40 active_record_32).each do |gemfile|
|
|
25
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
|
26
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/active_record_uuid.gemspec
CHANGED
|
@@ -14,11 +14,14 @@ Gem::Specification.new do |gem|
|
|
|
14
14
|
gem.name = "active_record_uuid"
|
|
15
15
|
gem.require_paths = ["lib"]
|
|
16
16
|
gem.version = ActiveRecordUuid::VERSION
|
|
17
|
-
|
|
18
|
-
gem.add_development_dependency "
|
|
19
|
-
gem.add_development_dependency "
|
|
20
|
-
gem.add_development_dependency "
|
|
21
|
-
gem.
|
|
17
|
+
|
|
18
|
+
gem.add_development_dependency "rake", "~> 10.1.0"
|
|
19
|
+
gem.add_development_dependency "bundler", ">= 1.3.5"
|
|
20
|
+
gem.add_development_dependency "rspec", "~> 2.12.0"
|
|
21
|
+
gem.add_development_dependency "pry", "~> 0.9.12.3"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
gem.add_dependency "activerecord", ">= 3.2"
|
|
22
25
|
gem.add_dependency "uuidtools", "~> 2.1.2"
|
|
23
|
-
gem.add_dependency "mysql2"
|
|
26
|
+
gem.add_dependency "mysql2", "~> 0.3.14"
|
|
24
27
|
end
|
|
@@ -4,7 +4,7 @@ module ActiveRecordUuid
|
|
|
4
4
|
def initialize(type)
|
|
5
5
|
@type = type
|
|
6
6
|
end
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def load(value)
|
|
9
9
|
return nil if value.nil?
|
|
10
10
|
|
|
@@ -20,21 +20,21 @@ module ActiveRecordUuid
|
|
|
20
20
|
UUIDTools::UUID.parse(value)
|
|
21
21
|
end
|
|
22
22
|
raise ArgumentError unless uuid.valid?
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
uuid.to_s
|
|
25
25
|
rescue ArgumentError, TypeError
|
|
26
26
|
raise ActiveRecord::SerializationTypeMismatch,
|
|
27
27
|
"Attribute was supposed to be a valid uuid, but was #{value}"
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
def dump(value)
|
|
32
32
|
uuid = begin
|
|
33
33
|
UUIDTools::UUID.parse(value)
|
|
34
34
|
rescue ArgumentError, TypeError
|
|
35
35
|
nil
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
case type
|
|
39
39
|
when :binary
|
|
40
40
|
uuid.raw
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe "Base64 Uuid" do
|
|
4
|
-
context "configure: PostBase64 model" do
|
|
4
|
+
context "configure: PostBase64 model" do
|
|
5
5
|
it "should have uuid as primary key based config" do
|
|
6
6
|
PostBase64.primary_key.should eq('uuid')
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
it "should store uuid as base64" do
|
|
10
10
|
post = PostBase64.create(:text => "Base64 uuid1")
|
|
11
11
|
post.reload
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
PostBase64.serialized_attributes['uuid'].dump(post.uuid).bytesize.should eq(24)
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
it "should retreive back as uuid string from base64" do
|
|
17
17
|
post = PostBase64.create(:text => "Base64 uuid2")
|
|
18
18
|
post.reload
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
post.uuid.should be_present
|
|
21
21
|
post.uuid.should be_instance_of(String)
|
|
22
22
|
post.uuid.length.should eq(36)
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should retreive uuid back with the same value that was assigned" do
|
|
26
26
|
post = PostBase64.new(:text => "Base64 uuid2")
|
|
27
27
|
post.uuid = "b360c78e-b62e-11e1-9870-0026b90faf3c"
|
|
28
28
|
post.save
|
|
29
29
|
post.reload
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
post.uuid.should eq("b360c78e-b62e-11e1-9870-0026b90faf3c")
|
|
32
32
|
post.uuid.should be_instance_of(String)
|
|
33
33
|
post.uuid.length.should eq(36)
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
it "should find by uuid column" do
|
|
37
37
|
post = PostBase64.create(:text => "Base64 uuid3")
|
|
38
38
|
|
|
39
39
|
PostBase64.find_by_uuid(post.uuid).should eq(post)
|
|
40
40
|
PostBase64.where(:uuid => post.uuid).should eq([post])
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
it "should find by primary key" do
|
|
44
44
|
post = PostBase64.create(:text => "Base64 uuid4")
|
|
45
45
|
|
|
46
46
|
PostBase64.find(post).should eq(post)
|
|
47
47
|
PostBase64.find(post.uuid).should eq(post)
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
it "should find by array of primary keys" do
|
|
51
51
|
post1 = PostBase64.create(:text => "Base64 uuid5")
|
|
52
52
|
post2 = PostBase64.create(:text => "Base64 uuid6")
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe "Binary Uuid" do
|
|
4
|
-
context "configure: PostBinary model" do
|
|
4
|
+
context "configure: PostBinary model" do
|
|
5
5
|
it "should have uuid as primary key based config" do
|
|
6
6
|
PostBinary.primary_key.should eq('uuid')
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
it "should have uuid association" do
|
|
10
10
|
PostBinary.reflections[:comments].options[:foreign_key].should eq("post_binary_uuid")
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
it "should store uuid as binary" do
|
|
14
14
|
post = PostBinary.create(:text => "Binary uuid1")
|
|
15
15
|
post.reload
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
PostBinary.serialized_attributes['uuid'].dump(post.uuid).bytesize.should eq(16)
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
it "should retreive back as uuid string from binary" do
|
|
21
21
|
post = PostBinary.create(:text => "Binary uuid2")
|
|
22
22
|
post.reload
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
post.uuid.should be_present
|
|
25
25
|
post.uuid.should be_instance_of(String)
|
|
26
26
|
post.uuid.length.should eq(36)
|
|
27
27
|
end
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
it "should retreive uuid back with the same value that was assigned" do
|
|
30
30
|
post = PostBinary.new(:text => "Binary uuid2")
|
|
31
31
|
post.uuid = "b360c78e-b62e-11e1-9870-0026b90faf3c"
|
|
32
32
|
post.save
|
|
33
33
|
post.reload
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
post.uuid.should eq("b360c78e-b62e-11e1-9870-0026b90faf3c")
|
|
36
36
|
post.uuid.should be_instance_of(String)
|
|
37
37
|
post.uuid.length.should eq(36)
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
it "should find by uuid column" do
|
|
41
41
|
post = PostBinary.create(:text => "Binary uuid3")
|
|
42
42
|
|
|
43
43
|
PostBinary.find_by_uuid(post.uuid).should eq(post)
|
|
44
44
|
PostBinary.where(:uuid => post.uuid).should eq([post])
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
it "should find by primary key" do
|
|
48
48
|
post = PostBinary.create(:text => "Binary uuid4")
|
|
49
49
|
|
|
50
50
|
PostBinary.find(post).should eq(post)
|
|
51
51
|
PostBinary.find(post.uuid).should eq(post)
|
|
52
52
|
end
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
it "should find by array of primary keys" do
|
|
55
55
|
post1 = PostBinary.create(:text => "Binary uuid5")
|
|
56
56
|
post2 = PostBinary.create(:text => "Binary uuid6")
|
data/spec/lib/has_uuid_spec.rb
CHANGED
|
@@ -5,14 +5,14 @@ describe "has_uuid spec" do
|
|
|
5
5
|
it "should have uuid as primary key based config" do
|
|
6
6
|
People.primary_key.should eq('uuid')
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
it "should store uuid as binary" do
|
|
10
10
|
person = People.create(:name => "Binary name1")
|
|
11
11
|
person.reload
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
People.serialized_attributes['uuid'].dump(person.uuid).bytesize.should eq(16)
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
it "should find by uuid column" do
|
|
17
17
|
person = People.create(:name => "Binary name2")
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ describe "has_uuid spec" do
|
|
|
20
20
|
People.where(:uuid => person.uuid).should eq([person])
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
context "global" do
|
|
25
25
|
before(:all) do
|
|
26
26
|
ActiveRecordUuid.configure do
|
|
@@ -29,31 +29,31 @@ describe "has_uuid spec" do
|
|
|
29
29
|
association false
|
|
30
30
|
store_as :binary
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
class PeopleBinary < ActiveRecord::Base
|
|
34
34
|
self.table_name = "people"
|
|
35
35
|
has_uuid :association => true
|
|
36
36
|
has_many :comments
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
it "should use global configuration" do
|
|
41
41
|
PeopleBinary.uuid_config.store_as.should eq(:binary)
|
|
42
42
|
end
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
it "should use overwrite global configuration" do
|
|
45
45
|
PeopleBinary.uuid_config.association.should eq(true)
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
it "should apply based on configuration" do
|
|
49
49
|
PeopleBinary.reflections[:comments].options[:foreign_key].should eq("people_binary_uuid")
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
it "should store uuid as binary" do
|
|
53
53
|
person = PeopleBinary.create!(:name => "Binary name1")
|
|
54
54
|
person.reload
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
|
|
56
|
+
PeopleBinary.serialized_attributes['uuid'].dump(person.uuid).bytesize.should eq(16)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe "HexDigest Uuid" do
|
|
4
|
-
context "configure: PostHexDigest model" do
|
|
4
|
+
context "configure: PostHexDigest model" do
|
|
5
5
|
it "should have uuid as primary key based config" do
|
|
6
6
|
PostHexDigest.primary_key.should eq('uuid')
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
it "should store uuid as HexDigest" do
|
|
10
10
|
post = PostHexDigest.create(:text => "HexDigest uuid1")
|
|
11
11
|
post.reload
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
PostHexDigest.serialized_attributes['uuid'].dump(post.uuid).bytesize.should eq(32)
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
it "should retreive back as uuid string from HexDigest" do
|
|
17
17
|
post = PostHexDigest.create(:text => "HexDigest uuid2")
|
|
18
18
|
post.reload
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
post.uuid.should be_present
|
|
21
21
|
post.uuid.should be_instance_of(String)
|
|
22
22
|
post.uuid.length.should eq(36)
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should retreive uuid back with the same value that was assigned" do
|
|
26
26
|
post = PostHexDigest.new(:text => "HexDigest uuid2")
|
|
27
27
|
post.uuid = "b360c78e-b62e-11e1-9870-0026b90faf3c"
|
|
28
28
|
post.save
|
|
29
29
|
post.reload
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
post.uuid.should eq("b360c78e-b62e-11e1-9870-0026b90faf3c")
|
|
32
32
|
post.uuid.should be_instance_of(String)
|
|
33
33
|
post.uuid.length.should eq(36)
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
it "should find by uuid column" do
|
|
37
37
|
post = PostHexDigest.create(:text => "HexDigest uuid3")
|
|
38
38
|
|
|
39
39
|
PostHexDigest.find_by_uuid(post.uuid).should eq(post)
|
|
40
40
|
PostHexDigest.where(:uuid => post.uuid).should eq([post])
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
it "should find by primary key" do
|
|
44
44
|
post = PostHexDigest.create(:text => "HexDigest uuid4")
|
|
45
45
|
|
|
46
46
|
PostHexDigest.find(post).should eq(post)
|
|
47
47
|
PostHexDigest.find(post.uuid).should eq(post)
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
it "should find by array of primary keys" do
|
|
51
51
|
post1 = PostHexDigest.create(:text => "HexDigest uuid5")
|
|
52
52
|
post2 = PostHexDigest.create(:text => "HexDigest uuid6")
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe "String Uuid" do
|
|
4
|
-
context "configure: Post model" do
|
|
4
|
+
context "configure: Post model" do
|
|
5
5
|
it "should have uuid as primary key based config" do
|
|
6
6
|
Post.primary_key.should eq('uuid')
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
it "should store uuid as String" do
|
|
10
10
|
post = Post.create(:text => "String uuid1")
|
|
11
11
|
post.reload
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
Post.serialized_attributes['uuid'].dump(post.uuid).bytesize.should eq(36)
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
it "should retreive back as uuid string from String" do
|
|
17
17
|
post = Post.create(:text => "String uuid2")
|
|
18
18
|
post.reload
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
post.uuid.should be_present
|
|
21
21
|
post.uuid.should be_instance_of(String)
|
|
22
22
|
post.uuid.length.should eq(36)
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should retreive uuid back with the same value that was assigned" do
|
|
26
26
|
post = Post.new(:text => "String uuid2")
|
|
27
27
|
post.uuid = "b360c78e-b62e-11e1-9870-0026b90faf3c"
|
|
28
28
|
post.save
|
|
29
29
|
post.reload
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
post.uuid.should eq("b360c78e-b62e-11e1-9870-0026b90faf3c")
|
|
32
32
|
post.uuid.should be_instance_of(String)
|
|
33
33
|
post.uuid.length.should eq(36)
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
it "should find by uuid column" do
|
|
37
37
|
post = Post.create(:text => "String uuid3")
|
|
38
38
|
|
|
39
39
|
Post.find_by_uuid(post.uuid).should eq(post)
|
|
40
40
|
Post.where(:uuid => post.uuid).should eq([post])
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
it "should find by primary key" do
|
|
44
44
|
post = Post.create(:text => "String uuid4")
|
|
45
45
|
|
|
46
46
|
Post.find(post).should eq(post)
|
|
47
47
|
Post.find(post.uuid).should eq(post)
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
it "should find by array of primary keys" do
|
|
51
51
|
post1 = Post.create(:text => "String uuid5")
|
|
52
52
|
post2 = Post.create(:text => "String uuid6")
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
require 'active_record_uuid'
|
|
2
|
+
require 'pry'
|
|
2
3
|
|
|
3
4
|
db_config = {
|
|
4
|
-
:adapter => "mysql2",
|
|
5
|
+
:adapter => "mysql2",
|
|
5
6
|
:database => "active_record_uuid",
|
|
6
7
|
:user => "root",
|
|
7
8
|
:password => ""
|
|
@@ -23,4 +24,5 @@ load File.dirname(__FILE__) + '/support/models.rb'
|
|
|
23
24
|
RSpec.configure do |config|
|
|
24
25
|
config.filter_run :focus => true
|
|
25
26
|
config.run_all_when_everything_filtered = true
|
|
26
|
-
|
|
27
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,84 +1,88 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_uuid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.3.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Chamnap
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rake
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 10.1.0
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 10.1.0
|
|
14
27
|
- !ruby/object:Gem::Dependency
|
|
15
28
|
name: bundler
|
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
30
|
requirements:
|
|
19
|
-
- -
|
|
31
|
+
- - '>='
|
|
20
32
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.
|
|
33
|
+
version: 1.3.5
|
|
22
34
|
type: :development
|
|
23
35
|
prerelease: false
|
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
37
|
requirements:
|
|
27
|
-
- -
|
|
38
|
+
- - '>='
|
|
28
39
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 1.
|
|
40
|
+
version: 1.3.5
|
|
30
41
|
- !ruby/object:Gem::Dependency
|
|
31
42
|
name: rspec
|
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
44
|
requirements:
|
|
35
45
|
- - ~>
|
|
36
46
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: 2.
|
|
47
|
+
version: 2.12.0
|
|
38
48
|
type: :development
|
|
39
49
|
prerelease: false
|
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
51
|
requirements:
|
|
43
52
|
- - ~>
|
|
44
53
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 2.
|
|
54
|
+
version: 2.12.0
|
|
46
55
|
- !ruby/object:Gem::Dependency
|
|
47
|
-
name:
|
|
56
|
+
name: pry
|
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
58
|
requirements:
|
|
51
|
-
- -
|
|
59
|
+
- - ~>
|
|
52
60
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
61
|
+
version: 0.9.12.3
|
|
54
62
|
type: :development
|
|
55
63
|
prerelease: false
|
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
65
|
requirements:
|
|
59
|
-
- -
|
|
66
|
+
- - ~>
|
|
60
67
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
68
|
+
version: 0.9.12.3
|
|
62
69
|
- !ruby/object:Gem::Dependency
|
|
63
70
|
name: activerecord
|
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
72
|
requirements:
|
|
67
|
-
- -
|
|
73
|
+
- - '>='
|
|
68
74
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '3.
|
|
75
|
+
version: '3.2'
|
|
70
76
|
type: :runtime
|
|
71
77
|
prerelease: false
|
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
79
|
requirements:
|
|
75
|
-
- -
|
|
80
|
+
- - '>='
|
|
76
81
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '3.
|
|
82
|
+
version: '3.2'
|
|
78
83
|
- !ruby/object:Gem::Dependency
|
|
79
84
|
name: uuidtools
|
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
86
|
requirements:
|
|
83
87
|
- - ~>
|
|
84
88
|
- !ruby/object:Gem::Version
|
|
@@ -86,7 +90,6 @@ dependencies:
|
|
|
86
90
|
type: :runtime
|
|
87
91
|
prerelease: false
|
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
93
|
requirements:
|
|
91
94
|
- - ~>
|
|
92
95
|
- !ruby/object:Gem::Version
|
|
@@ -94,20 +97,18 @@ dependencies:
|
|
|
94
97
|
- !ruby/object:Gem::Dependency
|
|
95
98
|
name: mysql2
|
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
100
|
requirements:
|
|
99
|
-
- -
|
|
101
|
+
- - ~>
|
|
100
102
|
- !ruby/object:Gem::Version
|
|
101
|
-
version:
|
|
103
|
+
version: 0.3.14
|
|
102
104
|
type: :runtime
|
|
103
105
|
prerelease: false
|
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
107
|
requirements:
|
|
107
|
-
- -
|
|
108
|
+
- - ~>
|
|
108
109
|
- !ruby/object:Gem::Version
|
|
109
|
-
version:
|
|
110
|
-
description:
|
|
110
|
+
version: 0.3.14
|
|
111
|
+
description: 'active_record_uuid is a nice gem that add uuid supports to your activerecord
|
|
111
112
|
models (MySQL). It allows you to store uuid in various formats: binary (16 bytes),
|
|
112
113
|
base64 (24 bytes), hexdigest (32 bytes), or string (36 bytes), and query back with
|
|
113
114
|
uuid string.'
|
|
@@ -120,11 +121,14 @@ files:
|
|
|
120
121
|
- .gitignore
|
|
121
122
|
- .rspec
|
|
122
123
|
- .rvmrc
|
|
124
|
+
- .travis.yml
|
|
123
125
|
- Gemfile
|
|
124
126
|
- LICENSE
|
|
125
127
|
- README.md
|
|
126
128
|
- Rakefile
|
|
127
129
|
- active_record_uuid.gemspec
|
|
130
|
+
- gemfiles/active_record_32.gemfile
|
|
131
|
+
- gemfiles/active_record_40.gemfile
|
|
128
132
|
- lib/active_record_uuid.rb
|
|
129
133
|
- lib/active_record_uuid/config.rb
|
|
130
134
|
- lib/active_record_uuid/extensions/association_methods.rb
|
|
@@ -154,27 +158,26 @@ files:
|
|
|
154
158
|
- spec/support/schema.rb
|
|
155
159
|
homepage: https://github.com/chamnap/active_record_uuid
|
|
156
160
|
licenses: []
|
|
161
|
+
metadata: {}
|
|
157
162
|
post_install_message:
|
|
158
163
|
rdoc_options: []
|
|
159
164
|
require_paths:
|
|
160
165
|
- lib
|
|
161
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
|
-
none: false
|
|
163
167
|
requirements:
|
|
164
|
-
- -
|
|
168
|
+
- - '>='
|
|
165
169
|
- !ruby/object:Gem::Version
|
|
166
170
|
version: '0'
|
|
167
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
|
-
none: false
|
|
169
172
|
requirements:
|
|
170
|
-
- -
|
|
173
|
+
- - '>='
|
|
171
174
|
- !ruby/object:Gem::Version
|
|
172
175
|
version: '0'
|
|
173
176
|
requirements: []
|
|
174
177
|
rubyforge_project:
|
|
175
|
-
rubygems_version: 1.
|
|
178
|
+
rubygems_version: 2.1.10
|
|
176
179
|
signing_key:
|
|
177
|
-
specification_version:
|
|
180
|
+
specification_version: 4
|
|
178
181
|
summary: A full-featured gem for adding uuid support to your active record models
|
|
179
182
|
test_files:
|
|
180
183
|
- spec/lib/association_spec.rb
|