gold-record 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/HISTORY.rdoc +7 -0
- data/LICENSE.txt +7 -0
- data/README.rdoc +93 -0
- data/Rakefile +138 -0
- data/lib/gold-record.rb +1 -0
- data/lib/gold_record.rb +26 -0
- data/lib/gold_record/base.rb +57 -0
- data/lib/gold_record/connection_adapters/mysql_adapter.rb +65 -0
- data/lib/gold_record/fixtures.rb +15 -0
- data/lib/gold_record/version.rb +9 -0
- data/test/cases/aaa_create_tables_test.rb +11 -0
- data/test/cases/acts_as_gold_record_test.rb +32 -0
- data/test/cases/associations/belongs_to_integer_association_test.rb +13 -0
- data/test/cases/associations/belongs_to_uuid_association_test.rb +13 -0
- data/test/cases/associations/habtm_integer_to_integer_association_test.rb +23 -0
- data/test/cases/associations/habtm_integer_to_uuid_association_test.rb +23 -0
- data/test/cases/associations/habtm_uuid_to_uuid_association_test.rb +23 -0
- data/test/cases/associations/has_many_integer_assocation_test.rb +16 -0
- data/test/cases/associations/has_many_uuid_association_test.rb +16 -0
- data/test/cases/coerce_id_test.rb +20 -0
- data/test/cases/find_test.rb +67 -0
- data/test/cases/generate_id_test.rb +25 -0
- data/test/cases/helper.rb +85 -0
- data/test/cases/to_param_test.rb +20 -0
- data/test/cases/to_uuid_test.rb +25 -0
- data/test/cases/zzz_migration_test.rb +97 -0
- data/test/config.rb +5 -0
- data/test/connection.rb +15 -0
- data/test/fixtures/albums.yml +19 -0
- data/test/fixtures/artists.yml +28 -0
- data/test/fixtures/fans.yml +23 -0
- data/test/fixtures/labels.yml +11 -0
- data/test/fixtures/record_stores.yml +12 -0
- data/test/fixtures/songs.yml +11 -0
- data/test/models/album.rb +5 -0
- data/test/models/artist.rb +8 -0
- data/test/models/fan.rb +4 -0
- data/test/models/label.rb +6 -0
- data/test/models/record_store.rb +5 -0
- data/test/models/song.rb +5 -0
- data/test/schema/schema.rb +56 -0
- metadata +127 -0
data/test/config.rb
ADDED
data/test/connection.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
print "Using native MySQL\n"
|
|
2
|
+
require 'logger'
|
|
3
|
+
|
|
4
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
|
5
|
+
|
|
6
|
+
ActiveRecord::Base.configurations = {
|
|
7
|
+
'test' => {
|
|
8
|
+
:adapter => 'mysql',
|
|
9
|
+
:username => 'root',
|
|
10
|
+
:encoding => 'utf8',
|
|
11
|
+
:database => 'gold_record_test',
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ActiveRecord::Base.establish_connection 'test'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
abbey_road:
|
|
2
|
+
artist: beatles
|
|
3
|
+
name: Abbey Road
|
|
4
|
+
|
|
5
|
+
g_funk:
|
|
6
|
+
artist: warren_g
|
|
7
|
+
name: G-Funk
|
|
8
|
+
|
|
9
|
+
sgt_pepper:
|
|
10
|
+
artist: beatles
|
|
11
|
+
name: Sargeant Pepper’s Lonely Hearts Club Band
|
|
12
|
+
|
|
13
|
+
thriller:
|
|
14
|
+
artist: michael_jackson
|
|
15
|
+
name: Thriller
|
|
16
|
+
|
|
17
|
+
white_album:
|
|
18
|
+
artist: beatles
|
|
19
|
+
name: The White Album
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
beatles:
|
|
2
|
+
name: The Beatles
|
|
3
|
+
label: emi
|
|
4
|
+
fans: cameron, jack, jim, paul, randy, robert, sam, tristan
|
|
5
|
+
|
|
6
|
+
ll_cool_j:
|
|
7
|
+
name: LL Cool J
|
|
8
|
+
label: def_jam
|
|
9
|
+
|
|
10
|
+
method_man:
|
|
11
|
+
name: Method Man
|
|
12
|
+
label: def_jam
|
|
13
|
+
fans: jim, randy, jack, paul
|
|
14
|
+
|
|
15
|
+
michael_jackson:
|
|
16
|
+
name: Michael Jackson
|
|
17
|
+
label: sony
|
|
18
|
+
fans: tristan, sam, cameron, jim
|
|
19
|
+
|
|
20
|
+
snoop_dog:
|
|
21
|
+
name: Snoop Dog
|
|
22
|
+
label: def_jam
|
|
23
|
+
fans: sam, randy, cameron, tristan
|
|
24
|
+
|
|
25
|
+
warren_g:
|
|
26
|
+
name: Warren G
|
|
27
|
+
label: def_jam
|
|
28
|
+
fans: cameron, jack, randy, paul
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
amoeba:
|
|
2
|
+
name: Amoeba Music
|
|
3
|
+
labels: def_jam, emi, sony, virgin
|
|
4
|
+
artists: beatles, ll_cool_j, method_man, michael_jackson, snoop_dog, warren_g
|
|
5
|
+
|
|
6
|
+
tower:
|
|
7
|
+
name: Tower Records
|
|
8
|
+
|
|
9
|
+
virgin:
|
|
10
|
+
name: Virgin Megastores
|
|
11
|
+
labels: def_jam, emi, sony, virgin
|
|
12
|
+
artists: beatles
|
data/test/models/fan.rb
ADDED
data/test/models/song.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
ActiveRecord::Schema.define do
|
|
2
|
+
# Label (with integer ID)
|
|
3
|
+
create_table :labels, :force => true do |t|
|
|
4
|
+
t.string :name
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# RecordStore (with integer ID)
|
|
8
|
+
create_table :record_stores, :force => true do |t|
|
|
9
|
+
t.string :name
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Artist
|
|
13
|
+
create_table :artists, :force => true, :id => false do |t|
|
|
14
|
+
t.binary :id, :limit => 16
|
|
15
|
+
t.integer :label_id
|
|
16
|
+
t.string :name
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Album
|
|
20
|
+
create_table :albums, :force => true, :id => false do |t|
|
|
21
|
+
t.binary :id, :limit => 16
|
|
22
|
+
t.binary :artist_id, :limit => 16
|
|
23
|
+
t.string :name
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Song
|
|
27
|
+
create_table :songs, :force => true, :id => false do |t|
|
|
28
|
+
t.binary :id, :limit => 16
|
|
29
|
+
t.binary :album_id, :limit => 16
|
|
30
|
+
t.string :name
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Fan
|
|
34
|
+
create_table :fans, :force => true, :id => false do |t|
|
|
35
|
+
t.binary :id, :limit => 16
|
|
36
|
+
t.string :name
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# HABTM (with two UUIDs)
|
|
40
|
+
create_table :artists_fans, :force => true, :id => false do |t|
|
|
41
|
+
t.binary :artist_id, :limit => 16
|
|
42
|
+
t.binary :fan_id, :limit => 16
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# HABTM (with two integers)
|
|
46
|
+
create_table :labels_record_stores, :force => true, :id => false do |t|
|
|
47
|
+
t.integer :label_id
|
|
48
|
+
t.integer :record_store_id
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# HABTM (with and integer and UUID)
|
|
52
|
+
create_table :artists_record_stores, :force => true, :id => false do |t|
|
|
53
|
+
t.binary :artist_id, :limit => 16
|
|
54
|
+
t.integer :record_store_id
|
|
55
|
+
end
|
|
56
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gold-record
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Randy Reddig
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-10-01 00:00:00 +00:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: activerecord
|
|
17
|
+
type: :runtime
|
|
18
|
+
version_requirement:
|
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
+
requirements:
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 2.3.4
|
|
24
|
+
version:
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: activesupport
|
|
27
|
+
type: :runtime
|
|
28
|
+
version_requirement:
|
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 2.3.4
|
|
34
|
+
version:
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: uuidtools
|
|
37
|
+
type: :runtime
|
|
38
|
+
version_requirement:
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 2.0.0
|
|
44
|
+
version:
|
|
45
|
+
description: Unobtrusive binary UUID support for ActiveRecord. Supports migrations, reflections, assocations and SchemaDumper.
|
|
46
|
+
email: randy@shaderlab.com
|
|
47
|
+
executables: []
|
|
48
|
+
|
|
49
|
+
extensions: []
|
|
50
|
+
|
|
51
|
+
extra_rdoc_files:
|
|
52
|
+
- HISTORY.rdoc
|
|
53
|
+
- LICENSE.txt
|
|
54
|
+
- README.rdoc
|
|
55
|
+
files:
|
|
56
|
+
- Rakefile
|
|
57
|
+
- LICENSE.txt
|
|
58
|
+
- README.rdoc
|
|
59
|
+
- HISTORY.rdoc
|
|
60
|
+
- lib/gold-record.rb
|
|
61
|
+
- lib/gold_record/base.rb
|
|
62
|
+
- lib/gold_record/connection_adapters/mysql_adapter.rb
|
|
63
|
+
- lib/gold_record/fixtures.rb
|
|
64
|
+
- lib/gold_record/version.rb
|
|
65
|
+
- lib/gold_record.rb
|
|
66
|
+
- test/cases/aaa_create_tables_test.rb
|
|
67
|
+
- test/cases/acts_as_gold_record_test.rb
|
|
68
|
+
- test/cases/associations/belongs_to_integer_association_test.rb
|
|
69
|
+
- test/cases/associations/belongs_to_uuid_association_test.rb
|
|
70
|
+
- test/cases/associations/habtm_integer_to_integer_association_test.rb
|
|
71
|
+
- test/cases/associations/habtm_integer_to_uuid_association_test.rb
|
|
72
|
+
- test/cases/associations/habtm_uuid_to_uuid_association_test.rb
|
|
73
|
+
- test/cases/associations/has_many_integer_assocation_test.rb
|
|
74
|
+
- test/cases/associations/has_many_uuid_association_test.rb
|
|
75
|
+
- test/cases/coerce_id_test.rb
|
|
76
|
+
- test/cases/find_test.rb
|
|
77
|
+
- test/cases/generate_id_test.rb
|
|
78
|
+
- test/cases/helper.rb
|
|
79
|
+
- test/cases/to_param_test.rb
|
|
80
|
+
- test/cases/to_uuid_test.rb
|
|
81
|
+
- test/cases/zzz_migration_test.rb
|
|
82
|
+
- test/config.rb
|
|
83
|
+
- test/connection.rb
|
|
84
|
+
- test/fixtures/albums.yml
|
|
85
|
+
- test/fixtures/artists.yml
|
|
86
|
+
- test/fixtures/fans.yml
|
|
87
|
+
- test/fixtures/labels.yml
|
|
88
|
+
- test/fixtures/record_stores.yml
|
|
89
|
+
- test/fixtures/songs.yml
|
|
90
|
+
- test/models/album.rb
|
|
91
|
+
- test/models/artist.rb
|
|
92
|
+
- test/models/fan.rb
|
|
93
|
+
- test/models/label.rb
|
|
94
|
+
- test/models/record_store.rb
|
|
95
|
+
- test/models/song.rb
|
|
96
|
+
- test/schema/schema.rb
|
|
97
|
+
has_rdoc: true
|
|
98
|
+
homepage: http://github.com/ydnar/gold-record
|
|
99
|
+
licenses: []
|
|
100
|
+
|
|
101
|
+
post_install_message:
|
|
102
|
+
rdoc_options:
|
|
103
|
+
- --main
|
|
104
|
+
- README.rdoc
|
|
105
|
+
require_paths:
|
|
106
|
+
- lib
|
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: "0"
|
|
112
|
+
version:
|
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: "0"
|
|
118
|
+
version:
|
|
119
|
+
requirements: []
|
|
120
|
+
|
|
121
|
+
rubyforge_project: gold-record
|
|
122
|
+
rubygems_version: 1.3.5
|
|
123
|
+
signing_key:
|
|
124
|
+
specification_version: 3
|
|
125
|
+
summary: Binary UUID support for ActiveRecord
|
|
126
|
+
test_files: []
|
|
127
|
+
|