legacy_data 0.1.11 → 0.1.12

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/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ .bundle
2
+ Gemfile.lock
1
3
  *.sw?
2
4
  .DS_Store
3
5
  coverage
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+ gemspec :path => '.'
3
+
4
+ group :development do
5
+ if ENV['MYSQL']
6
+ gem 'mysql', '~> 2.8.1'
7
+ end
8
+ if ENV['ORACLE']
9
+ gem "activerecord-oracle_enhanced-adapter", '~> 1.3.0'
10
+ gem 'ruby-oci8', '~> 2.0.4'
11
+ end
12
+ end
@@ -1,5 +1,10 @@
1
1
  === EDGE
2
- *
2
+ * Working on support for Rails 3
3
+
4
+ === 0.1.12 2010-11-18
5
+ * The last Rails 2.3 release
6
+ * Use Bundler to manage dependencies (during development)
7
+
3
8
 
4
9
  === 0.1.11 2010-03-05
5
10
  * Fix for SQLServer and other drivers that do not support constraints
data/Rakefile CHANGED
@@ -1,25 +1,27 @@
1
1
  require 'rubygems'
2
- require 'rake'
2
+ require 'bundler'
3
+ require 'rake/gempackagetask'
3
4
 
4
5
  begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "legacy_data"
8
- gem.summary = %Q{Create ActiveRecord models from an existing database}
9
- gem.description = %Q{Create ActiveRecord models from an existing database}
10
- gem.email = "alex@alexrothenberg.com"
11
- gem.homepage = "http://github.com/alexrothenberg/legacy_data"
12
- gem.authors = ["Alex Rothenberg"]
13
- gem.add_development_dependency "rspec"
14
- gem.add_dependency('activerecord')
15
- gem.add_dependency('matthuhiggins-foreigner', '>= 0.2.1')
16
-
17
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
- end
19
- Jeweler::GemcutterTasks.new
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
6
+ Bundler.setup(:default, :development)
7
+ Bundler::GemHelper.install_tasks
8
+ rescue Bundler::BundlerError => e
9
+ $stderr.puts e.message
10
+ $stderr.puts "Run `bundle install` to install missing gems"
11
+ exit e.status_code
12
+ end
13
+ require 'rake'
14
+
15
+ task :default => :spec_all
16
+ task :spec => :check_dependencies
17
+
18
+
19
+ # GEM Tasks --------------------------------------------------------
20
+ spec = eval(File.read('legacy_data.gemspec'))
21
+ Rake::GemPackageTask.new(spec) do |pkg|
22
+ pkg.gem_spec = spec
22
23
  end
24
+ # --------------------------------------------------------
23
25
 
24
26
  require 'spec/rake/spectask'
25
27
  Spec::Rake::SpecTask.new(:spec) do |spec|
@@ -27,17 +29,27 @@ Spec::Rake::SpecTask.new(:spec) do |spec|
27
29
  spec.spec_files = FileList['spec/**/*_spec.rb']
28
30
  end
29
31
 
32
+ def print_msg msg
33
+ border = '-'*(msg.size+10)
34
+ puts border, "--- #{msg} ---", border
35
+ end
36
+
30
37
  def run_functional_without_aborting(*adapters)
31
38
  errors = []
32
39
 
33
40
  adapters.each do |adapter|
34
- begin
35
- puts "Running #{adapter} specs"
36
- ENV['ADAPTER'] = adapter
37
- Rake::Task["#{adapter}:spec"].invoke
38
- puts ''
39
- rescue Exception
40
- errors << "#{adapter}:spec"
41
+ if ENV[adapter.upcase] || (adapter == 'sqlite3')
42
+ begin
43
+ print_msg "Running #{adapter.upcase} specs"
44
+ ENV['ADAPTER'] = adapter
45
+ Rake::Task["#{adapter}:spec"].invoke
46
+ puts ''
47
+ rescue Exception
48
+ errors << "#{adapter}:spec"
49
+ end
50
+ else
51
+ print_msg "Skipping #{adapter.upcase} specs because the environment variable '#{adapter.upcase}' is not set"
52
+ puts
41
53
  end
42
54
  end
43
55
 
@@ -69,9 +81,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
69
81
  spec.rcov_opts = ['--exclude spec,gems', '--sort coverage']
70
82
  end
71
83
 
72
- task :spec => :check_dependencies
73
-
74
- task :default => :spec_all
75
84
 
76
85
  require 'rake/rdoctask'
77
86
  Rake::RDocTask.new do |rdoc|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
@@ -11,16 +11,18 @@ def create_blog_tables
11
11
  end
12
12
  connection.create_table :comments do |t|
13
13
  t.integer :post_id
14
- t.foreign_key :posts, :dependent => :delete
14
+ # t.foreign_key :posts
15
15
  t.text :body
16
16
  end
17
+ connection.add_foreign_key(:comments, :posts, :dependent => :delete)
18
+
17
19
  connection.create_table :tags do |t|
18
20
  t.string :name
19
21
  end
20
22
  connection.create_table :post_tags, :id=>false do |t|
21
23
  t.integer :post_id
22
- t.foreign_key :posts
23
24
  t.integer :tag_id
24
- t.foreign_key :tags
25
25
  end
26
+ connection.add_foreign_key(:post_tags, :posts )
27
+ connection.add_foreign_key(:post_tags, :tags)
26
28
  end
@@ -1,9 +1,9 @@
1
1
  Factory.define :comment do |c|
2
2
  end
3
3
 
4
- Factory.define :tag do |t|
4
+ Factory.define :post do |p|
5
5
  end
6
6
 
7
- Factory.define :post do |p|
7
+ Factory.define :tag do |t|
8
8
  end
9
9
 
@@ -1,12 +1,12 @@
1
1
  Factory.define :comment do |c|
2
2
  end
3
3
 
4
- Factory.define :tag do |t|
5
- end
6
-
7
4
  Factory.define :post_tag do |p|
8
5
  end
9
6
 
10
7
  Factory.define :post do |p|
11
8
  end
12
9
 
10
+ Factory.define :tag do |t|
11
+ end
12
+
@@ -1,20 +1,7 @@
1
- Factory.define :url_alias do |u|
2
- u.src 'some string'
3
- u.dst 'some string'
4
- u.language 'some string'
5
- end
6
-
7
- Factory.define :session do |s|
8
- s.uid 7
9
- s.hostname 'some string'
10
- s.timestamp 7
11
- s.cache 7
12
- end
13
-
14
- Factory.define :node_comment_statistic do |n|
15
- n.last_comment_timestamp 7
16
- n.last_comment_uid 7
17
- n.comment_count 7
1
+ Factory.define :access do |a|
2
+ a.mask 'some string'
3
+ a.type 'some string'
4
+ a.status 7
18
5
  end
19
6
 
20
7
  Factory.define :action do |a|
@@ -24,98 +11,86 @@ Factory.define :action do |a|
24
11
  a.description 'some string'
25
12
  end
26
13
 
27
- Factory.define :node_type do |n|
28
- n.name 'some string'
29
- n.module 'some string'
30
- n.description 'some text value'
31
- n.help 'some text value'
32
- n.has_title 7
33
- n.title_label 'some string'
34
- n.has_body 7
35
- n.body_label 'some string'
36
- n.min_word_count 7
37
- n.custom 7
38
- n.modified 7
39
- n.locked 7
40
- n.orig_type 'some string'
14
+ Factory.define :actions_aid do |a|
41
15
  end
42
16
 
43
- Factory.define :node_access do |n|
44
- n.nid 7
45
- n.gid 7
46
- n.realm 'some string'
47
- n.grant_view 7
48
- n.grant_update 7
49
- n.grant_delete 7
17
+ Factory.define :authmap do |a|
18
+ a.uid 7
19
+ a.authname 'some string'
20
+ a.module 'some string'
50
21
  end
51
22
 
52
- Factory.define :flood do |f|
53
- f.event 'some string'
54
- f.hostname 'some string'
55
- f.timestamp 7
23
+ Factory.define :batch do |b|
24
+ b.token 'some string'
25
+ b.timestamp 7
56
26
  end
57
27
 
58
- Factory.define :uploaded_files do |u|
59
- u.uid 7
60
- u.filename 'some string'
61
- u.filepath 'some string'
62
- u.filemime 'some string'
63
- u.filesize 7
64
- u.status 7
65
- u.timestamp 7
28
+ Factory.define :block do |b|
29
+ b.module 'some string'
30
+ b.delta 'some string'
31
+ b.theme 'some string'
32
+ b.status 7
33
+ b.weight 7
34
+ b.region 'some string'
35
+ b.custom 7
36
+ b.throttle 7
37
+ b.visibility 7
38
+ b.pages 'some text value'
39
+ b.title 'some string'
40
+ b.cache 7
66
41
  end
67
42
 
68
- Factory.define :cache_page do |c|
43
+ Factory.define :blocks_role do |b|
44
+ b.module 'some string'
45
+ b.delta 'some string'
46
+ b.rid 7
47
+ end
48
+
49
+ Factory.define :box do |b|
50
+ b.info 'some string'
51
+ b.format 7
52
+ end
53
+
54
+ Factory.define :cache do |c|
69
55
  c.expire 7
70
56
  c.created 7
71
57
  c.serialized 7
72
58
  end
73
59
 
74
- Factory.define :cache_form do |c|
60
+ Factory.define :cache_block do |c|
75
61
  c.expire 7
76
62
  c.created 7
77
63
  c.serialized 7
78
64
  end
79
65
 
80
- Factory.define :watchdog do |w|
81
- w.uid 7
82
- w.type 'some string'
83
- w.message 'some text value'
84
- w.variables 'some text value'
85
- w.severity 7
86
- w.link 'some string'
87
- w.location 'some text value'
88
- w.hostname 'some string'
89
- w.timestamp 7
66
+ Factory.define :cache_filter do |c|
67
+ c.expire 7
68
+ c.created 7
69
+ c.serialized 7
90
70
  end
91
71
 
92
- Factory.define :node_counter do |n|
93
- n.totalcount 7
94
- n.daycount 7
95
- n.timestamp 7
72
+ Factory.define :cache_form do |c|
73
+ c.expire 7
74
+ c.created 7
75
+ c.serialized 7
96
76
  end
97
77
 
98
- Factory.define :node do |n|
99
- n.vid 7
100
- n.type 'some string'
101
- n.language 'some string'
102
- n.title 'some string'
103
- n.uid 7
104
- n.status 7
105
- n.created 7
106
- n.changed 7
107
- n.comment 7
108
- n.promote 7
109
- n.moderate 7
110
- n.sticky 7
111
- n.tnid 7
112
- n.translate 7
78
+ Factory.define :cache_menu do |c|
79
+ c.expire 7
80
+ c.created 7
81
+ c.serialized 7
113
82
  end
114
83
 
115
- Factory.define :history do |h|
116
- h.uid 7
117
- h.nid 7
118
- h.timestamp 7
84
+ Factory.define :cache_page do |c|
85
+ c.expire 7
86
+ c.created 7
87
+ c.serialized 7
88
+ end
89
+
90
+ Factory.define :cache_update do |c|
91
+ c.expire 7
92
+ c.created 7
93
+ c.serialized 7
119
94
  end
120
95
 
121
96
  Factory.define :comment do |c|
@@ -131,66 +106,20 @@ Factory.define :comment do |c|
131
106
  c.thread 'some string'
132
107
  end
133
108
 
134
- Factory.define :cache do |c|
135
- c.expire 7
136
- c.created 7
137
- c.serialized 7
138
- end
139
-
140
- Factory.define :vocabulary_node_type do |v|
141
- v.vid 7
142
- v.type 'some string'
143
- end
144
-
145
- Factory.define :cache_filter do |c|
146
- c.expire 7
147
- c.created 7
148
- c.serialized 7
149
- end
150
-
151
- Factory.define :box do |b|
152
- b.info 'some string'
153
- b.format 7
154
- end
155
-
156
- Factory.define :system do |s|
157
- s.name 'some string'
158
- s.type 'some string'
159
- s.owner 'some string'
160
- s.status 7
161
- s.throttle 7
162
- s.bootstrap 7
163
- s.schema_version 7
164
- s.weight 7
165
- end
166
-
167
- Factory.define :role do |r|
168
- r.name 'some string'
169
- end
170
-
171
- Factory.define :permission do |p|
172
- p.rid 7
173
- p.tid 7
174
- end
175
-
176
- Factory.define :blocks_role do |b|
177
- b.module 'some string'
178
- b.delta 'some string'
179
- b.rid 7
180
- end
181
-
182
- Factory.define :actions_aid do |a|
109
+ Factory.define :uploaded_files do |u|
110
+ u.uid 7
111
+ u.filename 'some string'
112
+ u.filepath 'some string'
113
+ u.filemime 'some string'
114
+ u.filesize 7
115
+ u.status 7
116
+ u.timestamp 7
183
117
  end
184
118
 
185
- Factory.define :node_revision do |n|
186
- n.nid 7
187
- n.uid 7
188
- n.title 'some string'
189
- n.body 'some text value'
190
- n.teaser 'some text value'
191
- n.log 'some text value'
192
- n.timestamp 7
193
- n.format 7
119
+ Factory.define :filter_format do |f|
120
+ f.name 'some string'
121
+ f.roles 'some string'
122
+ f.cache 7
194
123
  end
195
124
 
196
125
  Factory.define :filter do |f|
@@ -200,33 +129,22 @@ Factory.define :filter do |f|
200
129
  f.weight 7
201
130
  end
202
131
 
203
- Factory.define :cache_block do |c|
204
- c.expire 7
205
- c.created 7
206
- c.serialized 7
132
+ Factory.define :flood do |f|
133
+ f.event 'some string'
134
+ f.hostname 'some string'
135
+ f.timestamp 7
207
136
  end
208
137
 
209
- Factory.define :term_hierarchy do |t|
210
- t.tid 7
211
- t.parent 7
138
+ Factory.define :history do |h|
139
+ h.uid 7
140
+ h.nid 7
141
+ h.timestamp 7
212
142
  end
213
143
 
214
144
  Factory.define :menu_custom do |m|
215
145
  m.title 'some string'
216
146
  end
217
147
 
218
- Factory.define :cache_update do |c|
219
- c.expire 7
220
- c.created 7
221
- c.serialized 7
222
- end
223
-
224
- Factory.define :term_data do |t|
225
- t.vid 7
226
- t.name 'some string'
227
- t.weight 7
228
- end
229
-
230
148
  Factory.define :menu_link do |m|
231
149
  m.menu_name 'some string'
232
150
  m.plid 7
@@ -253,42 +171,6 @@ Factory.define :menu_link do |m|
253
171
  m.updated 7
254
172
  end
255
173
 
256
- Factory.define :user do |u|
257
- u.name 'some string'
258
- u.pass 'some string'
259
- u.mode 7
260
- u.theme 'some string'
261
- u.signature 'some string'
262
- u.signature_format 7
263
- u.created 7
264
- u.access 7
265
- u.login 7
266
- u.status 7
267
- u.language 'some string'
268
- u.picture 'some string'
269
- end
270
-
271
- Factory.define :term_synonym do |t|
272
- t.tid 7
273
- t.name 'some string'
274
- end
275
-
276
- Factory.define :term_relation do |t|
277
- t.tid1 7
278
- t.tid2 7
279
- end
280
-
281
- Factory.define :batch do |b|
282
- b.token 'some string'
283
- b.timestamp 7
284
- end
285
-
286
- Factory.define :access do |a|
287
- a.mask 'some string'
288
- a.type 'some string'
289
- a.status 7
290
- end
291
-
292
174
  Factory.define :menu_router do |m|
293
175
  m.load_functions 'some text value'
294
176
  m.to_arg_functions 'some text value'
@@ -308,31 +190,107 @@ Factory.define :menu_router do |m|
308
190
  m.weight 7
309
191
  end
310
192
 
311
- Factory.define :authmap do |a|
312
- a.uid 7
313
- a.authname 'some string'
314
- a.module 'some string'
193
+ Factory.define :node do |n|
194
+ n.vid 7
195
+ n.type 'some string'
196
+ n.language 'some string'
197
+ n.title 'some string'
198
+ n.uid 7
199
+ n.status 7
200
+ n.created 7
201
+ n.changed 7
202
+ n.comment 7
203
+ n.promote 7
204
+ n.moderate 7
205
+ n.sticky 7
206
+ n.tnid 7
207
+ n.translate 7
315
208
  end
316
209
 
317
- Factory.define :vocabulary do |v|
318
- v.name 'some string'
319
- v.help 'some string'
320
- v.relations 7
321
- v.hierarchy 7
322
- v.multiple 7
323
- v.required 7
324
- v.tags 7
325
- v.module 'some string'
326
- v.weight 7
210
+ Factory.define :node_access do |n|
211
+ n.nid 7
212
+ n.gid 7
213
+ n.realm 'some string'
214
+ n.grant_view 7
215
+ n.grant_update 7
216
+ n.grant_delete 7
327
217
  end
328
218
 
329
- Factory.define :variable do |v|
330
- v.value 'some text value'
219
+ Factory.define :node_comment_statistic do |n|
220
+ n.last_comment_timestamp 7
221
+ n.last_comment_uid 7
222
+ n.comment_count 7
331
223
  end
332
224
 
333
- Factory.define :users_role do |u|
334
- u.uid 7
335
- u.rid 7
225
+ Factory.define :node_counter do |n|
226
+ n.totalcount 7
227
+ n.daycount 7
228
+ n.timestamp 7
229
+ end
230
+
231
+ Factory.define :node_revision do |n|
232
+ n.nid 7
233
+ n.uid 7
234
+ n.title 'some string'
235
+ n.body 'some text value'
236
+ n.teaser 'some text value'
237
+ n.log 'some text value'
238
+ n.timestamp 7
239
+ n.format 7
240
+ end
241
+
242
+ Factory.define :node_type do |n|
243
+ n.name 'some string'
244
+ n.module 'some string'
245
+ n.description 'some text value'
246
+ n.help 'some text value'
247
+ n.has_title 7
248
+ n.title_label 'some string'
249
+ n.has_body 7
250
+ n.body_label 'some string'
251
+ n.min_word_count 7
252
+ n.custom 7
253
+ n.modified 7
254
+ n.locked 7
255
+ n.orig_type 'some string'
256
+ end
257
+
258
+ Factory.define :permission do |p|
259
+ p.rid 7
260
+ p.tid 7
261
+ end
262
+
263
+ Factory.define :role do |r|
264
+ r.name 'some string'
265
+ end
266
+
267
+ Factory.define :session do |s|
268
+ s.uid 7
269
+ s.hostname 'some string'
270
+ s.timestamp 7
271
+ s.cache 7
272
+ end
273
+
274
+ Factory.define :system do |s|
275
+ s.name 'some string'
276
+ s.type 'some string'
277
+ s.owner 'some string'
278
+ s.status 7
279
+ s.throttle 7
280
+ s.bootstrap 7
281
+ s.schema_version 7
282
+ s.weight 7
283
+ end
284
+
285
+ Factory.define :term_data do |t|
286
+ t.vid 7
287
+ t.name 'some string'
288
+ t.weight 7
289
+ end
290
+
291
+ Factory.define :term_hierarchy do |t|
292
+ t.tid 7
293
+ t.parent 7
336
294
  end
337
295
 
338
296
  Factory.define :term_node do |t|
@@ -341,30 +299,72 @@ Factory.define :term_node do |t|
341
299
  t.tid 7
342
300
  end
343
301
 
344
- Factory.define :filter_format do |f|
345
- f.name 'some string'
346
- f.roles 'some string'
347
- f.cache 7
302
+ Factory.define :term_relation do |t|
303
+ t.tid1 7
304
+ t.tid2 7
348
305
  end
349
306
 
350
- Factory.define :cache_menu do |c|
351
- c.expire 7
352
- c.created 7
353
- c.serialized 7
307
+ Factory.define :term_synonym do |t|
308
+ t.tid 7
309
+ t.name 'some string'
354
310
  end
355
311
 
356
- Factory.define :block do |b|
357
- b.module 'some string'
358
- b.delta 'some string'
359
- b.theme 'some string'
360
- b.status 7
361
- b.weight 7
362
- b.region 'some string'
363
- b.custom 7
364
- b.throttle 7
365
- b.visibility 7
366
- b.pages 'some text value'
367
- b.title 'some string'
368
- b.cache 7
312
+ Factory.define :url_alias do |u|
313
+ u.src 'some string'
314
+ u.dst 'some string'
315
+ u.language 'some string'
316
+ end
317
+
318
+ Factory.define :user do |u|
319
+ u.name 'some string'
320
+ u.pass 'some string'
321
+ u.mode 7
322
+ u.theme 'some string'
323
+ u.signature 'some string'
324
+ u.signature_format 7
325
+ u.created 7
326
+ u.access 7
327
+ u.login 7
328
+ u.status 7
329
+ u.language 'some string'
330
+ u.picture 'some string'
331
+ end
332
+
333
+ Factory.define :users_role do |u|
334
+ u.uid 7
335
+ u.rid 7
336
+ end
337
+
338
+ Factory.define :variable do |v|
339
+ v.value 'some text value'
340
+ end
341
+
342
+ Factory.define :vocabulary do |v|
343
+ v.name 'some string'
344
+ v.help 'some string'
345
+ v.relations 7
346
+ v.hierarchy 7
347
+ v.multiple 7
348
+ v.required 7
349
+ v.tags 7
350
+ v.module 'some string'
351
+ v.weight 7
352
+ end
353
+
354
+ Factory.define :vocabulary_node_type do |v|
355
+ v.vid 7
356
+ v.type 'some string'
357
+ end
358
+
359
+ Factory.define :watchdog do |w|
360
+ w.uid 7
361
+ w.type 'some string'
362
+ w.message 'some text value'
363
+ w.variables 'some text value'
364
+ w.severity 7
365
+ w.link 'some string'
366
+ w.location 'some text value'
367
+ w.hostname 'some string'
368
+ w.timestamp 7
369
369
  end
370
370