og 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +10 -5
- data/ProjectInfo +9 -2
- data/README +3 -3
- data/Rakefile +5 -1
- data/doc/AUTHORS +3 -0
- data/doc/RELEASES +57 -0
- data/lib/glue/orderable.rb +8 -8
- data/lib/og.rb +6 -6
- data/lib/og/collection.rb +12 -3
- data/lib/og/entity.rb +2 -2
- data/lib/og/manager.rb +2 -1
- data/lib/og/store.rb +5 -8
- data/lib/og/store/kirby.rb +93 -12
- data/lib/og/store/mysql.rb +7 -21
- data/lib/og/store/psql.rb +9 -3
- data/lib/og/store/sql.rb +4 -2
- data/lib/og/store/sqlite.rb +3 -1
- data/lib/og/vendor/mysql.rb +1 -1
- data/setup.rb +1585 -0
- data/test/og/mixin/tc_hierarchical.rb +2 -0
- data/test/og/mixin/tc_optimistic_locking.rb +2 -0
- data/test/og/mixin/tc_orderable.rb +2 -0
- data/test/og/mixin/tc_taggable.rb +2 -0
- data/test/og/mixin/tc_timestamped.rb +2 -0
- data/test/og/store/tc_filesys.rb +2 -0
- data/test/og/store/tc_kirby.rb +2 -0
- data/test/og/tc_accumulator.rb +92 -0
- data/test/og/tc_delete_all.rb +2 -0
- data/test/og/tc_finder.rb +2 -0
- data/test/og/tc_inheritance.rb +2 -0
- data/test/og/tc_inheritance2.rb +35 -0
- data/test/og/tc_join.rb +2 -0
- data/test/og/tc_multi_validations.rb +19 -0
- data/test/og/tc_multiple.rb +2 -0
- data/test/og/tc_override.rb +2 -0
- data/test/og/tc_polymorphic.rb +3 -1
- data/test/og/tc_relation.rb +2 -0
- data/test/og/tc_reverse.rb +2 -0
- data/test/og/tc_scoped.rb +2 -0
- data/test/og/tc_select.rb +3 -0
- data/test/og/tc_store.rb +2 -0
- data/test/og/tc_types.rb +2 -0
- data/test/og/tc_validation.rb +2 -0
- data/test/og/tc_validation2.rb +207 -0
- data/test/og/tc_validation_loop.rb +36 -0
- metadata +124 -120
- data/benchmark/bench.rb +0 -75
- data/benchmark/sqlite-no-prepare.1.txt +0 -13
- data/benchmark/sqlite-no-prepare.2.txt +0 -13
- data/benchmark/sqlite-prepare.1.txt +0 -13
- data/benchmark/sqlite-prepare.2.txt +0 -13
- data/install.rb +0 -37
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
require 'og'
|
6
|
+
|
7
|
+
class ManagedClass
|
8
|
+
prop_accessor :thing
|
9
|
+
|
10
|
+
validate_unique :thing
|
11
|
+
end
|
12
|
+
|
13
|
+
Og.start
|
14
|
+
|
15
|
+
class TC_Loop < Test::Unit::TestCase
|
16
|
+
def setup
|
17
|
+
@thing_1 = ManagedClass.new
|
18
|
+
@thing_1.thing = 'thing'
|
19
|
+
@thing_1.save
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_loop
|
23
|
+
thing_2 = ManagedClass.new
|
24
|
+
thing_2.thing = @thing_1.thing
|
25
|
+
# assert_raises(NoMethodError) {
|
26
|
+
# thing_2.valid?
|
27
|
+
# assert thing_2.errors
|
28
|
+
# }
|
29
|
+
end
|
30
|
+
|
31
|
+
def teardown
|
32
|
+
ManagedClass.all.each { |i| i.delete }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# * Bryan Soto <bryan.a.soto@gmail.com>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.11
|
3
3
|
specification_version: 1
|
4
4
|
name: og
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: 0.27.0
|
7
|
+
date: 2006-01-16 00:00:00 +02:00
|
8
8
|
summary: State of the art object-relational mapping system.
|
9
9
|
require_paths:
|
10
|
-
|
10
|
+
- lib
|
11
11
|
email: gm@navel.gr
|
12
12
|
homepage: http://www.nitrohq.com
|
13
13
|
rubyforge_project: nitro
|
@@ -15,132 +15,136 @@ description:
|
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
|
-
has_rdoc:
|
18
|
+
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
27
28
|
authors:
|
28
|
-
|
29
|
+
- George Moschovitis
|
29
30
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
- test/og/store/tc_filesys.rb
|
129
|
-
- test/og/store/tc_kirby.rb
|
31
|
+
- doc
|
32
|
+
- examples
|
33
|
+
- lib
|
34
|
+
- test
|
35
|
+
- ProjectInfo
|
36
|
+
- Rakefile
|
37
|
+
- README
|
38
|
+
- setup.rb
|
39
|
+
- INSTALL
|
40
|
+
- doc/tutorial.txt
|
41
|
+
- doc/config.txt
|
42
|
+
- doc/RELEASES
|
43
|
+
- doc/LICENSE
|
44
|
+
- doc/CHANGELOG.1
|
45
|
+
- doc/AUTHORS
|
46
|
+
- examples/run.rb
|
47
|
+
- examples/README
|
48
|
+
- examples/mysql_to_psql.rb
|
49
|
+
- lib/og
|
50
|
+
- lib/glue
|
51
|
+
- lib/og.rb
|
52
|
+
- lib/og/relation
|
53
|
+
- lib/og/store
|
54
|
+
- lib/og/test
|
55
|
+
- lib/og/vendor
|
56
|
+
- lib/og/validation.rb
|
57
|
+
- lib/og/types.rb
|
58
|
+
- lib/og/test.rb
|
59
|
+
- lib/og/store.rb
|
60
|
+
- lib/og/relation.rb
|
61
|
+
- lib/og/manager.rb
|
62
|
+
- lib/og/evolution.rb
|
63
|
+
- lib/og/errors.rb
|
64
|
+
- lib/og/entity.rb
|
65
|
+
- lib/og/collection.rb
|
66
|
+
- lib/og/markers.rb
|
67
|
+
- lib/og/relation/many_to_many.rb
|
68
|
+
- lib/og/relation/refers_to.rb
|
69
|
+
- lib/og/relation/joins_many.rb
|
70
|
+
- lib/og/relation/has_one.rb
|
71
|
+
- lib/og/relation/has_many.rb
|
72
|
+
- lib/og/relation/belongs_to.rb
|
73
|
+
- lib/og/relation/all.rb
|
74
|
+
- lib/og/store/alpha
|
75
|
+
- lib/og/store/sqlite.rb
|
76
|
+
- lib/og/store/sql.rb
|
77
|
+
- lib/og/store/psql.rb
|
78
|
+
- lib/og/store/mysql.rb
|
79
|
+
- lib/og/store/kirby.rb
|
80
|
+
- lib/og/store/alpha/sqlserver.rb
|
81
|
+
- lib/og/store/alpha/memory.rb
|
82
|
+
- lib/og/store/alpha/kirby.rb
|
83
|
+
- lib/og/store/alpha/filesys.rb
|
84
|
+
- lib/og/test/testcase.rb
|
85
|
+
- lib/og/test/assertions.rb
|
86
|
+
- lib/og/vendor/mysql411.rb
|
87
|
+
- lib/og/vendor/mysql.rb
|
88
|
+
- lib/og/vendor/README
|
89
|
+
- lib/glue/taggable.rb
|
90
|
+
- lib/glue/tree.rb
|
91
|
+
- lib/glue/hierarchical.rb
|
92
|
+
- lib/glue/timestamped.rb
|
93
|
+
- lib/glue/revisable.rb
|
94
|
+
- lib/glue/orderable.rb
|
95
|
+
- lib/glue/optimistic_locking.rb
|
96
|
+
- lib/glue/searchable.rb
|
97
|
+
- test/og
|
98
|
+
- test/glue
|
99
|
+
- test/og/mixin
|
100
|
+
- test/og/store
|
101
|
+
- test/og/tc_delete_all.rb
|
102
|
+
- test/og/tc_types.rb
|
103
|
+
- test/og/tc_store.rb
|
104
|
+
- test/og/tc_select.rb
|
105
|
+
- test/og/tc_reverse.rb
|
106
|
+
- test/og/tc_relation.rb
|
107
|
+
- test/og/tc_override.rb
|
108
|
+
- test/og/tc_polymorphic.rb
|
109
|
+
- test/og/tc_multiple.rb
|
110
|
+
- test/og/tc_join.rb
|
111
|
+
- test/og/tc_validation2.rb
|
112
|
+
- test/og/tc_inheritance.rb
|
113
|
+
- test/og/CONFIG.rb
|
114
|
+
- test/og/tc_scoped.rb
|
115
|
+
- test/og/tc_finder.rb
|
116
|
+
- test/og/tc_validation.rb
|
117
|
+
- test/og/tc_accumulator.rb
|
118
|
+
- test/og/tc_inheritance2.rb
|
119
|
+
- test/og/tc_multi_validations.rb
|
120
|
+
- test/og/tc_validation_loop.rb
|
121
|
+
- test/og/mixin/tc_timestamped.rb
|
122
|
+
- test/og/mixin/tc_taggable.rb
|
123
|
+
- test/og/mixin/tc_orderable.rb
|
124
|
+
- test/og/mixin/tc_hierarchical.rb
|
125
|
+
- test/og/mixin/tc_optimistic_locking.rb
|
126
|
+
- test/og/store/tc_filesys.rb
|
127
|
+
- test/og/store/tc_kirby.rb
|
128
|
+
- test/glue/tc_revisable.rb
|
130
129
|
test_files: []
|
130
|
+
|
131
131
|
rdoc_options: []
|
132
|
+
|
132
133
|
extra_rdoc_files: []
|
134
|
+
|
133
135
|
executables: []
|
136
|
+
|
134
137
|
extensions: []
|
138
|
+
|
135
139
|
requirements: []
|
140
|
+
|
136
141
|
dependencies:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
version:
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: glue
|
144
|
+
version_requirement:
|
145
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.27.0
|
150
|
+
version:
|
data/benchmark/bench.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
2
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: bench.rb 182 2005-07-22 10:07:50Z gmosx $
|
4
|
-
|
5
|
-
require 'og'; include Og
|
6
|
-
|
7
|
-
|
8
|
-
config = {
|
9
|
-
:adapter => 'sqlite',
|
10
|
-
:database => 'test',
|
11
|
-
:connection_count => 5
|
12
|
-
}
|
13
|
-
|
14
|
-
class Article
|
15
|
-
prop_accessor :title, String
|
16
|
-
prop_accessor :body, String
|
17
|
-
prop_accessor :hits, Fixnum
|
18
|
-
prop_accessor :rate, Fixnum
|
19
|
-
|
20
|
-
def initialize(title = nil, body = nil)
|
21
|
-
@title = title
|
22
|
-
@body = body
|
23
|
-
@hits = rand(5)
|
24
|
-
@rate = rand(100)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
Database.drop_db!(config)
|
29
|
-
db = Database.new(config)
|
30
|
-
|
31
|
-
# Benchmark the insert speed. Useful for finding
|
32
|
-
# the improvement when using prepared statements.
|
33
|
-
|
34
|
-
articles = []
|
35
|
-
|
36
|
-
500.times do |i|
|
37
|
-
articles << Article.new("Title#{i}", "Body#{i}")
|
38
|
-
end
|
39
|
-
|
40
|
-
sum = 0
|
41
|
-
min = 999999
|
42
|
-
max = -min
|
43
|
-
|
44
|
-
GC.disable
|
45
|
-
|
46
|
-
10.times do |i|
|
47
|
-
|
48
|
-
db.exec "DELETE FROM #{Article::DBTABLE}"
|
49
|
-
|
50
|
-
for article in articles
|
51
|
-
article.oid = nil
|
52
|
-
end
|
53
|
-
|
54
|
-
Article.create("Dummy", "Dummy")
|
55
|
-
|
56
|
-
t1 = Time.now
|
57
|
-
articles.each do |a|
|
58
|
-
a.save!
|
59
|
-
end
|
60
|
-
t2 = Time.now
|
61
|
-
|
62
|
-
d = t2 - t1
|
63
|
-
sum += d
|
64
|
-
min = d if d < min
|
65
|
-
max = d if d > max
|
66
|
-
|
67
|
-
puts "Insert test #{i}: #{d} seconds"
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
puts %{
|
72
|
-
Min: #{min}
|
73
|
-
Max: #{max}
|
74
|
-
Average: #{sum/10}
|
75
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Insert test 0: 3.53403 seconds
|
2
|
-
Insert test 1: 4.222878 seconds
|
3
|
-
Insert test 2: 3.84379 seconds
|
4
|
-
Insert test 3: 3.877513 seconds
|
5
|
-
Insert test 4: 3.793392 seconds
|
6
|
-
Insert test 5: 3.725927 seconds
|
7
|
-
Insert test 6: 3.814542 seconds
|
8
|
-
Insert test 7: 3.760054 seconds
|
9
|
-
Insert test 8: 3.936868 seconds
|
10
|
-
Insert test 9: 4.061833 seconds
|
11
|
-
Min: 3.53403
|
12
|
-
Max: 4.222878
|
13
|
-
Average: 3.8570827
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Insert test 0: 4.050384 seconds
|
2
|
-
Insert test 1: 4.098912 seconds
|
3
|
-
Insert test 2: 3.739213 seconds
|
4
|
-
Insert test 3: 4.030227 seconds
|
5
|
-
Insert test 4: 4.061516 seconds
|
6
|
-
Insert test 5: 3.963748 seconds
|
7
|
-
Insert test 6: 4.088462 seconds
|
8
|
-
Insert test 7: 4.047734 seconds
|
9
|
-
Insert test 8: 3.966496 seconds
|
10
|
-
Insert test 9: 3.948346 seconds
|
11
|
-
Min: 3.739213
|
12
|
-
Max: 4.098912
|
13
|
-
Average: 3.9995038
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Insert test 0: 3.578891 seconds
|
2
|
-
Insert test 1: 4.257714 seconds
|
3
|
-
Insert test 2: 3.535036 seconds
|
4
|
-
Insert test 3: 3.742329 seconds
|
5
|
-
Insert test 4: 3.874829 seconds
|
6
|
-
Insert test 5: 3.608657 seconds
|
7
|
-
Insert test 6: 3.843804 seconds
|
8
|
-
Insert test 7: 3.688756 seconds
|
9
|
-
Insert test 8: 3.858303 seconds
|
10
|
-
Insert test 9: 3.739155 seconds
|
11
|
-
Min: 3.535036
|
12
|
-
Max: 4.257714
|
13
|
-
Average: 3.7727474
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Insert test 0: 3.859916 seconds
|
2
|
-
Insert test 1: 4.321912 seconds
|
3
|
-
Insert test 2: 3.836067 seconds
|
4
|
-
Insert test 3: 4.077798 seconds
|
5
|
-
Insert test 4: 4.171512 seconds
|
6
|
-
Insert test 5: 4.148027 seconds
|
7
|
-
Insert test 6: 3.841498 seconds
|
8
|
-
Insert test 7: 3.94367 seconds
|
9
|
-
Insert test 8: 3.758128 seconds
|
10
|
-
Insert test 9: 4.25072 seconds
|
11
|
-
Min: 3.758128
|
12
|
-
Max: 4.321912
|
13
|
-
Average: 4.0209248
|
data/install.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rbconfig'
|
4
|
-
require 'ftools'
|
5
|
-
|
6
|
-
dst_dir = Config::CONFIG['sitelibdir']
|
7
|
-
|
8
|
-
Dir.chdir('lib') do
|
9
|
-
Dir['**/*.rb'].each do |file|
|
10
|
-
File.mkpath File.join(dst_dir, File.dirname(file)), true
|
11
|
-
File.install file, File.join(dst_dir, file), 0644, true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
puts %{
|
16
|
-
|
17
|
-
|
18
|
-
---
|
19
|
-
Congratulations, you have successfully installed Og!
|
20
|
-
The libraries where installed in '#{dst_dir}'.
|
21
|
-
|
22
|
-
You probably need to install the Glue library
|
23
|
-
as well. (http://nitro.rubyforge.org)
|
24
|
-
|
25
|
-
To verify that everything works correctly, try to run an
|
26
|
-
example by issuing:
|
27
|
-
|
28
|
-
$ cd examples
|
29
|
-
$ ruby run.rb
|
30
|
-
|
31
|
-
at the command line.
|
32
|
-
|
33
|
-
Enjoy the magic of Og!
|
34
|
-
}
|
35
|
-
|
36
|
-
# * George Moschovitis <gm@navel.gr>
|
37
|
-
|