global_uid 1.2.0 → 1.2.2
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/Appraisals +7 -0
- data/Gemfile +2 -4
- data/Rakefile +1 -0
- data/gemfiles/rails2.gemfile +9 -0
- data/gemfiles/rails2.gemfile.lock +59 -0
- data/gemfiles/rails3.gemfile +9 -0
- data/gemfiles/rails3.gemfile.lock +72 -0
- data/global_uid.gemspec +8 -3
- data/lib/global_uid/active_record_extension.rb +13 -4
- data/lib/global_uid.rb +1 -1
- data/test/global_uid_test.rb +34 -2
- metadata +28 -10
- data/Gemfile.lock +0 -43
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "http://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "ruby-debug", :group=>"test", :platform=>"mri_18"
|
|
6
|
+
gem "ruby-debug19", :group=>"test", :require=>"ruby-debug", :platform=>"mri_19"
|
|
7
|
+
gem "activerecord", "2.3.14"
|
|
8
|
+
|
|
9
|
+
gemspec :path=>"../"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: /Users/primdahl/Git/global_uid
|
|
3
|
+
specs:
|
|
4
|
+
global_uid (1.2.0)
|
|
5
|
+
activerecord
|
|
6
|
+
activesupport
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: http://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activerecord (2.3.14)
|
|
12
|
+
activesupport (= 2.3.14)
|
|
13
|
+
activesupport (2.3.14)
|
|
14
|
+
appraisal (0.4.0)
|
|
15
|
+
bundler
|
|
16
|
+
rake
|
|
17
|
+
archive-tar-minitar (0.5.2)
|
|
18
|
+
columnize (0.3.5)
|
|
19
|
+
linecache (0.46)
|
|
20
|
+
rbx-require-relative (> 0.0.4)
|
|
21
|
+
linecache19 (0.5.12)
|
|
22
|
+
ruby_core_source (>= 0.1.4)
|
|
23
|
+
metaclass (0.0.1)
|
|
24
|
+
mocha (0.10.0)
|
|
25
|
+
metaclass (~> 0.0.1)
|
|
26
|
+
mysql (2.8.1)
|
|
27
|
+
rake (0.9.2.2)
|
|
28
|
+
rbx-require-relative (0.0.5)
|
|
29
|
+
ruby-debug (0.10.4)
|
|
30
|
+
columnize (>= 0.1)
|
|
31
|
+
ruby-debug-base (~> 0.10.4.0)
|
|
32
|
+
ruby-debug-base (0.10.4)
|
|
33
|
+
linecache (>= 0.3)
|
|
34
|
+
ruby-debug-base19 (0.11.25)
|
|
35
|
+
columnize (>= 0.3.1)
|
|
36
|
+
linecache19 (>= 0.5.11)
|
|
37
|
+
ruby_core_source (>= 0.1.4)
|
|
38
|
+
ruby-debug19 (0.11.6)
|
|
39
|
+
columnize (>= 0.3.1)
|
|
40
|
+
linecache19 (>= 0.5.11)
|
|
41
|
+
ruby-debug-base19 (>= 0.11.19)
|
|
42
|
+
ruby_core_source (0.1.5)
|
|
43
|
+
archive-tar-minitar (>= 0.5.2)
|
|
44
|
+
shoulda (2.11.3)
|
|
45
|
+
|
|
46
|
+
PLATFORMS
|
|
47
|
+
ruby
|
|
48
|
+
|
|
49
|
+
DEPENDENCIES
|
|
50
|
+
activerecord (= 2.3.14)
|
|
51
|
+
appraisal
|
|
52
|
+
bundler
|
|
53
|
+
global_uid!
|
|
54
|
+
mocha
|
|
55
|
+
mysql (= 2.8.1)
|
|
56
|
+
rake
|
|
57
|
+
ruby-debug
|
|
58
|
+
ruby-debug19
|
|
59
|
+
shoulda
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "http://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "ruby-debug", :group=>"test", :platform=>"mri_18"
|
|
6
|
+
gem "ruby-debug19", :group=>"test", :require=>"ruby-debug", :platform=>"mri_19"
|
|
7
|
+
gem "activerecord", "3.1.3"
|
|
8
|
+
|
|
9
|
+
gemspec :path=>"../"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: /Users/primdahl/Git/global_uid
|
|
3
|
+
specs:
|
|
4
|
+
global_uid (1.2.0)
|
|
5
|
+
activerecord
|
|
6
|
+
activesupport
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: http://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activemodel (3.1.3)
|
|
12
|
+
activesupport (= 3.1.3)
|
|
13
|
+
builder (~> 3.0.0)
|
|
14
|
+
i18n (~> 0.6)
|
|
15
|
+
activerecord (3.1.3)
|
|
16
|
+
activemodel (= 3.1.3)
|
|
17
|
+
activesupport (= 3.1.3)
|
|
18
|
+
arel (~> 2.2.1)
|
|
19
|
+
tzinfo (~> 0.3.29)
|
|
20
|
+
activesupport (3.1.3)
|
|
21
|
+
multi_json (~> 1.0)
|
|
22
|
+
appraisal (0.4.0)
|
|
23
|
+
bundler
|
|
24
|
+
rake
|
|
25
|
+
archive-tar-minitar (0.5.2)
|
|
26
|
+
arel (2.2.1)
|
|
27
|
+
builder (3.0.0)
|
|
28
|
+
columnize (0.3.5)
|
|
29
|
+
i18n (0.6.0)
|
|
30
|
+
linecache (0.46)
|
|
31
|
+
rbx-require-relative (> 0.0.4)
|
|
32
|
+
linecache19 (0.5.12)
|
|
33
|
+
ruby_core_source (>= 0.1.4)
|
|
34
|
+
metaclass (0.0.1)
|
|
35
|
+
mocha (0.10.0)
|
|
36
|
+
metaclass (~> 0.0.1)
|
|
37
|
+
multi_json (1.0.4)
|
|
38
|
+
mysql (2.8.1)
|
|
39
|
+
rake (0.9.2.2)
|
|
40
|
+
rbx-require-relative (0.0.5)
|
|
41
|
+
ruby-debug (0.10.4)
|
|
42
|
+
columnize (>= 0.1)
|
|
43
|
+
ruby-debug-base (~> 0.10.4.0)
|
|
44
|
+
ruby-debug-base (0.10.4)
|
|
45
|
+
linecache (>= 0.3)
|
|
46
|
+
ruby-debug-base19 (0.11.25)
|
|
47
|
+
columnize (>= 0.3.1)
|
|
48
|
+
linecache19 (>= 0.5.11)
|
|
49
|
+
ruby_core_source (>= 0.1.4)
|
|
50
|
+
ruby-debug19 (0.11.6)
|
|
51
|
+
columnize (>= 0.3.1)
|
|
52
|
+
linecache19 (>= 0.5.11)
|
|
53
|
+
ruby-debug-base19 (>= 0.11.19)
|
|
54
|
+
ruby_core_source (0.1.5)
|
|
55
|
+
archive-tar-minitar (>= 0.5.2)
|
|
56
|
+
shoulda (2.11.3)
|
|
57
|
+
tzinfo (0.3.31)
|
|
58
|
+
|
|
59
|
+
PLATFORMS
|
|
60
|
+
ruby
|
|
61
|
+
|
|
62
|
+
DEPENDENCIES
|
|
63
|
+
activerecord (= 3.1.3)
|
|
64
|
+
appraisal
|
|
65
|
+
bundler
|
|
66
|
+
global_uid!
|
|
67
|
+
mocha
|
|
68
|
+
mysql (= 2.8.1)
|
|
69
|
+
rake
|
|
70
|
+
ruby-debug
|
|
71
|
+
ruby-debug19
|
|
72
|
+
shoulda
|
data/global_uid.gemspec
CHANGED
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
|
14
14
|
## the sub! line in the Rakefile
|
|
15
15
|
s.name = 'global_uid'
|
|
16
|
-
s.version = '1.2.
|
|
17
|
-
s.date = '2011-
|
|
16
|
+
s.version = '1.2.2'
|
|
17
|
+
s.date = '2011-12-07'
|
|
18
18
|
s.rubyforge_project = 'global_uid'
|
|
19
19
|
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
|
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
|
|
|
53
53
|
## List your development dependencies here. Development dependencies are
|
|
54
54
|
## those that are only needed during development
|
|
55
55
|
s.add_development_dependency('mysql', '2.8.1')
|
|
56
|
+
s.add_development_dependency("appraisal")
|
|
56
57
|
s.add_development_dependency('rake')
|
|
57
58
|
s.add_development_dependency('bundler')
|
|
58
59
|
s.add_development_dependency('shoulda')
|
|
@@ -63,10 +64,14 @@ Gem::Specification.new do |s|
|
|
|
63
64
|
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
|
64
65
|
# = MANIFEST =
|
|
65
66
|
s.files = %w[
|
|
67
|
+
Appraisals
|
|
66
68
|
Gemfile
|
|
67
|
-
Gemfile.lock
|
|
68
69
|
README.md
|
|
69
70
|
Rakefile
|
|
71
|
+
gemfiles/rails2.gemfile
|
|
72
|
+
gemfiles/rails2.gemfile.lock
|
|
73
|
+
gemfiles/rails3.gemfile
|
|
74
|
+
gemfiles/rails3.gemfile.lock
|
|
70
75
|
global_uid.gemspec
|
|
71
76
|
lib/global_uid.rb
|
|
72
77
|
lib/global_uid/active_record_extension.rb
|
|
@@ -3,7 +3,6 @@ module GlobalUid
|
|
|
3
3
|
|
|
4
4
|
def self.included(base)
|
|
5
5
|
base.extend(ClassMethods)
|
|
6
|
-
base.class_inheritable_accessor :global_uid_disabled
|
|
7
6
|
base.before_create :global_uid_before_create
|
|
8
7
|
end
|
|
9
8
|
|
|
@@ -26,16 +25,26 @@ module GlobalUid
|
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
module ClassMethods
|
|
28
|
+
def global_uid_disabled
|
|
29
|
+
if @global_uid_disabled.nil?
|
|
30
|
+
if superclass.respond_to?(:global_uid_disabled)
|
|
31
|
+
@global_uid_disabled = superclass.send(:global_uid_disabled)
|
|
32
|
+
else
|
|
33
|
+
@global_uid_disabled = false
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
@global_uid_disabled
|
|
38
|
+
end
|
|
39
|
+
|
|
29
40
|
def generate_uid(options = {})
|
|
30
41
|
uid_table_name = self.global_uid_table
|
|
31
|
-
|
|
32
42
|
self.ensure_global_uid_table
|
|
33
|
-
|
|
34
43
|
GlobalUid::Base.get_uid_for_class(self, options)
|
|
35
44
|
end
|
|
36
45
|
|
|
37
46
|
def disable_global_uid
|
|
38
|
-
|
|
47
|
+
@global_uid_disabled = true
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
def global_uid_table
|
data/lib/global_uid.rb
CHANGED
data/test/global_uid_test.rb
CHANGED
|
@@ -62,9 +62,43 @@ end
|
|
|
62
62
|
class WithoutGlobalUID < ActiveRecord::Base
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
class Parent < ActiveRecord::Base
|
|
66
|
+
def self.reset
|
|
67
|
+
@global_uid_disabled = nil
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class ParentSubclass < Parent
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class ParentSubclassSubclass < ParentSubclass
|
|
75
|
+
end
|
|
76
|
+
|
|
65
77
|
class GlobalUIDTest < ActiveSupport::TestCase
|
|
66
78
|
ActiveRecord::Migration.verbose = false
|
|
67
79
|
|
|
80
|
+
context "#global_uid_disabled" do
|
|
81
|
+
setup do
|
|
82
|
+
[ Parent, ParentSubclass, ParentSubclassSubclass ].each { |k| k.reset }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
should "default to the parent value or false" do
|
|
86
|
+
assert !ParentSubclass.global_uid_disabled
|
|
87
|
+
|
|
88
|
+
ParentSubclass.disable_global_uid
|
|
89
|
+
assert ParentSubclass.global_uid_disabled
|
|
90
|
+
assert ParentSubclassSubclass.global_uid_disabled
|
|
91
|
+
|
|
92
|
+
ParentSubclass.reset
|
|
93
|
+
assert !ParentSubclass.global_uid_disabled
|
|
94
|
+
assert ParentSubclassSubclass.global_uid_disabled
|
|
95
|
+
|
|
96
|
+
ParentSubclassSubclass.reset
|
|
97
|
+
assert !ParentSubclass.global_uid_disabled
|
|
98
|
+
assert !ParentSubclassSubclass.global_uid_disabled
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
68
102
|
context "migrations" do
|
|
69
103
|
setup do
|
|
70
104
|
restore_defaults!
|
|
@@ -118,8 +152,6 @@ class GlobalUIDTest < ActiveSupport::TestCase
|
|
|
118
152
|
GlobalUid::Base.with_connections do |cx|
|
|
119
153
|
assert cx.table_exists?('with_global_uids_ids')
|
|
120
154
|
end
|
|
121
|
-
|
|
122
|
-
|
|
123
155
|
end
|
|
124
156
|
end
|
|
125
157
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: global_uid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 1.2.
|
|
9
|
+
- 2
|
|
10
|
+
version: 1.2.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Ben Osheroff
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-12-07 00:00:00 -08:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -63,7 +63,7 @@ dependencies:
|
|
|
63
63
|
type: :development
|
|
64
64
|
version_requirements: *id003
|
|
65
65
|
- !ruby/object:Gem::Dependency
|
|
66
|
-
name:
|
|
66
|
+
name: appraisal
|
|
67
67
|
prerelease: false
|
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
69
69
|
none: false
|
|
@@ -77,7 +77,7 @@ dependencies:
|
|
|
77
77
|
type: :development
|
|
78
78
|
version_requirements: *id004
|
|
79
79
|
- !ruby/object:Gem::Dependency
|
|
80
|
-
name:
|
|
80
|
+
name: rake
|
|
81
81
|
prerelease: false
|
|
82
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
|
83
83
|
none: false
|
|
@@ -91,7 +91,7 @@ dependencies:
|
|
|
91
91
|
type: :development
|
|
92
92
|
version_requirements: *id005
|
|
93
93
|
- !ruby/object:Gem::Dependency
|
|
94
|
-
name:
|
|
94
|
+
name: bundler
|
|
95
95
|
prerelease: false
|
|
96
96
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
97
97
|
none: false
|
|
@@ -105,7 +105,7 @@ dependencies:
|
|
|
105
105
|
type: :development
|
|
106
106
|
version_requirements: *id006
|
|
107
107
|
- !ruby/object:Gem::Dependency
|
|
108
|
-
name:
|
|
108
|
+
name: shoulda
|
|
109
109
|
prerelease: false
|
|
110
110
|
requirement: &id007 !ruby/object:Gem::Requirement
|
|
111
111
|
none: false
|
|
@@ -118,6 +118,20 @@ dependencies:
|
|
|
118
118
|
version: "0"
|
|
119
119
|
type: :development
|
|
120
120
|
version_requirements: *id007
|
|
121
|
+
- !ruby/object:Gem::Dependency
|
|
122
|
+
name: mocha
|
|
123
|
+
prerelease: false
|
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
|
125
|
+
none: false
|
|
126
|
+
requirements:
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
hash: 3
|
|
130
|
+
segments:
|
|
131
|
+
- 0
|
|
132
|
+
version: "0"
|
|
133
|
+
type: :development
|
|
134
|
+
version_requirements: *id008
|
|
121
135
|
description: GUIDs for sharded models
|
|
122
136
|
email: ben@zendesk.com
|
|
123
137
|
executables: []
|
|
@@ -127,10 +141,14 @@ extensions: []
|
|
|
127
141
|
extra_rdoc_files:
|
|
128
142
|
- README.md
|
|
129
143
|
files:
|
|
144
|
+
- Appraisals
|
|
130
145
|
- Gemfile
|
|
131
|
-
- Gemfile.lock
|
|
132
146
|
- README.md
|
|
133
147
|
- Rakefile
|
|
148
|
+
- gemfiles/rails2.gemfile
|
|
149
|
+
- gemfiles/rails2.gemfile.lock
|
|
150
|
+
- gemfiles/rails3.gemfile
|
|
151
|
+
- gemfiles/rails3.gemfile.lock
|
|
134
152
|
- global_uid.gemspec
|
|
135
153
|
- lib/global_uid.rb
|
|
136
154
|
- lib/global_uid/active_record_extension.rb
|
|
@@ -171,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
189
|
requirements: []
|
|
172
190
|
|
|
173
191
|
rubyforge_project: global_uid
|
|
174
|
-
rubygems_version: 1.5.
|
|
192
|
+
rubygems_version: 1.5.3
|
|
175
193
|
signing_key:
|
|
176
194
|
specification_version: 2
|
|
177
195
|
summary: GUID
|
data/Gemfile.lock
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
global_uid (1.0.3)
|
|
5
|
-
activerecord (= 2.3.14)
|
|
6
|
-
activesupport
|
|
7
|
-
global_uid
|
|
8
|
-
mysql (= 2.8.1)
|
|
9
|
-
|
|
10
|
-
GEM
|
|
11
|
-
remote: http://rubygems.org/
|
|
12
|
-
specs:
|
|
13
|
-
activerecord (2.3.14)
|
|
14
|
-
activesupport (= 2.3.14)
|
|
15
|
-
activesupport (2.3.14)
|
|
16
|
-
columnize (0.3.2)
|
|
17
|
-
git (1.2.5)
|
|
18
|
-
jeweler (1.6.4)
|
|
19
|
-
bundler (~> 1.0)
|
|
20
|
-
git (>= 1.2.5)
|
|
21
|
-
rake
|
|
22
|
-
linecache (0.43)
|
|
23
|
-
mocha (0.9.12)
|
|
24
|
-
mysql (2.8.1)
|
|
25
|
-
rake (0.8.7)
|
|
26
|
-
ruby-debug (0.10.4)
|
|
27
|
-
columnize (>= 0.1)
|
|
28
|
-
ruby-debug-base (~> 0.10.4.0)
|
|
29
|
-
ruby-debug-base (0.10.4)
|
|
30
|
-
linecache (>= 0.3)
|
|
31
|
-
shoulda (2.11.3)
|
|
32
|
-
|
|
33
|
-
PLATFORMS
|
|
34
|
-
ruby
|
|
35
|
-
|
|
36
|
-
DEPENDENCIES
|
|
37
|
-
bundler
|
|
38
|
-
global_uid!
|
|
39
|
-
jeweler
|
|
40
|
-
mocha
|
|
41
|
-
rake
|
|
42
|
-
ruby-debug
|
|
43
|
-
shoulda
|