mack-data_mapper 0.6.1.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Mack.html +6 -6
- data/doc/classes/Mack/Database.html +119 -18
- data/doc/classes/Mack/Database/Generators.html +140 -0
- data/doc/classes/Mack/Database/Migrations.html +206 -0
- data/doc/classes/Mack/Testing/DataMapperHelpers.html +6 -6
- data/doc/classes/Mack/ViewHelpers/DataMapperHelpers.html +30 -124
- data/doc/created.rid +1 -1
- data/doc/files/lib/mack-data_mapper/database_migrations_rb.html +115 -0
- data/doc/files/lib/mack-data_mapper/database_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper/dm_patches/dm-timestamps_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper/dm_patches/migrations_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper/{genosaurus_helpers_rb.html → dm_patches/model_rb.html} +5 -5
- data/doc/files/lib/mack-data_mapper/{scaffold_generator/scaffold_generator_rb.html → dm_patches/property_set_rb.html} +4 -17
- data/doc/{classes/DataMapper/Timestamp.html → files/lib/mack-data_mapper/dm_patches/validations_rb.html} +16 -20
- data/doc/files/lib/mack-data_mapper/{model_column_rb.html → generators_rb.html} +4 -4
- data/doc/files/lib/mack-data_mapper/helpers/orm_helpers_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper/migration_generator/migration_generator_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper/model_generator/model_generator_rb.html +1 -1
- data/doc/files/lib/mack-data_mapper_rb.html +2 -1
- data/doc/files/lib/mack-data_mapper_tasks_rb.html +8 -1
- data/doc/fr_class_index.html +2 -2
- data/doc/fr_file_index.html +5 -3
- data/doc/fr_method_index.html +10 -7
- data/lib/mack-data_mapper.rb +4 -5
- data/lib/mack-data_mapper/database.rb +79 -38
- data/lib/mack-data_mapper/database_migrations.rb +35 -0
- data/lib/mack-data_mapper/dm_patches/dm-timestamps.rb +4 -4
- data/lib/mack-data_mapper/dm_patches/migrations.rb +24 -2
- data/lib/mack-data_mapper/dm_patches/model.rb +48 -0
- data/lib/mack-data_mapper/dm_patches/property_set.rb +15 -0
- data/lib/mack-data_mapper/dm_patches/validations.rb +15 -0
- data/lib/mack-data_mapper/generators.rb +11 -0
- data/lib/mack-data_mapper/helpers/orm_helpers.rb +8 -32
- data/lib/mack-data_mapper/migration_generator/migration_generator.rb +1 -1
- data/lib/mack-data_mapper/model_generator/manifest.yml +2 -2
- data/lib/mack-data_mapper/model_generator/model_generator.rb +1 -1
- data/lib/mack-data_mapper_tasks.rb +1 -0
- metadata +42 -29
- data/doc/classes/ScaffoldGenerator.html +0 -123
- data/lib/mack-data_mapper/genosaurus_helpers.rb +0 -40
- data/lib/mack-data_mapper/model_column.rb +0 -42
- data/lib/mack-data_mapper/scaffold_generator/manifest.yml +0 -35
- data/lib/mack-data_mapper/scaffold_generator/scaffold_generator.rb +0 -41
- data/lib/mack-data_mapper/scaffold_generator/templates/app/helpers/controllers/helper.rb.template +0 -7
- data/lib/mack-data_mapper/scaffold_generator/templates/app/views/edit.html.erb.template +0 -19
- data/lib/mack-data_mapper/scaffold_generator/templates/app/views/index.html.erb.template +0 -41
- data/lib/mack-data_mapper/scaffold_generator/templates/app/views/new.html.erb.template +0 -19
- data/lib/mack-data_mapper/scaffold_generator/templates/app/views/show.html.erb.template +0 -12
- data/lib/mack-data_mapper/scaffold_generator/templates/test/functional/rspec.rb.template +0 -47
- data/lib/mack-data_mapper/scaffold_generator/templates/test/functional/test_case.rb.template +0 -9
- data/lib/mack-data_mapper/tasks/db_create_drop_tasks.rake +0 -57
- data/lib/mack-data_mapper/tasks/db_migration_tasks.rake +0 -46
- data/lib/mack-data_mapper/tasks/test_tasks.rake +0 -12
data/doc/classes/Mack.html
CHANGED
@@ -59,16 +59,16 @@
|
|
59
59
|
lib/mack-data_mapper/database.rb
|
60
60
|
</a>
|
61
61
|
<br />
|
62
|
-
<a href="../files/lib/mack-data_mapper/
|
63
|
-
lib/mack-data_mapper/
|
62
|
+
<a href="../files/lib/mack-data_mapper/database_migrations_rb.html">
|
63
|
+
lib/mack-data_mapper/database_migrations.rb
|
64
64
|
</a>
|
65
65
|
<br />
|
66
|
-
<a href="../files/lib/mack-data_mapper/
|
67
|
-
lib/mack-data_mapper/
|
66
|
+
<a href="../files/lib/mack-data_mapper/generators_rb.html">
|
67
|
+
lib/mack-data_mapper/generators.rb
|
68
68
|
</a>
|
69
69
|
<br />
|
70
|
-
<a href="../files/lib/mack-data_mapper/
|
71
|
-
lib/mack-data_mapper/
|
70
|
+
<a href="../files/lib/mack-data_mapper/helpers/orm_helpers_rb.html">
|
71
|
+
lib/mack-data_mapper/helpers/orm_helpers.rb
|
72
72
|
</a>
|
73
73
|
<br />
|
74
74
|
<a href="../files/lib/mack-data_mapper/test_extensions_rb.html">
|
@@ -58,6 +58,14 @@
|
|
58
58
|
<a href="../../files/lib/mack-data_mapper/database_rb.html">
|
59
59
|
lib/mack-data_mapper/database.rb
|
60
60
|
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/mack-data_mapper/database_migrations_rb.html">
|
63
|
+
lib/mack-data_mapper/database_migrations.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../files/lib/mack-data_mapper/generators_rb.html">
|
67
|
+
lib/mack-data_mapper/generators.rb
|
68
|
+
</a>
|
61
69
|
<br />
|
62
70
|
</td>
|
63
71
|
</tr>
|
@@ -80,9 +88,11 @@
|
|
80
88
|
<h3 class="section-bar">Methods</h3>
|
81
89
|
|
82
90
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
91
|
+
<a href="#M000004">create</a>
|
92
|
+
<a href="#M000005">drop</a>
|
93
|
+
<a href="#M000007">dump_structure</a>
|
94
|
+
<a href="#M000003">establish_connection</a>
|
95
|
+
<a href="#M000006">load_structure</a>
|
86
96
|
</div>
|
87
97
|
</div>
|
88
98
|
|
@@ -93,6 +103,13 @@
|
|
93
103
|
|
94
104
|
<div id="section">
|
95
105
|
|
106
|
+
<div id="class-list">
|
107
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
108
|
+
|
109
|
+
Module <a href="Database/Generators.html" class="link">Mack::Database::Generators</a><br />
|
110
|
+
Module <a href="Database/Migrations.html" class="link">Mack::Database::Migrations</a><br />
|
111
|
+
|
112
|
+
</div>
|
96
113
|
|
97
114
|
|
98
115
|
|
@@ -104,11 +121,11 @@
|
|
104
121
|
<div id="methods">
|
105
122
|
<h3 class="section-bar">Public Class methods</h3>
|
106
123
|
|
107
|
-
<div id="method-
|
108
|
-
<a name="
|
124
|
+
<div id="method-M000004" class="method-detail">
|
125
|
+
<a name="M000004"></a>
|
109
126
|
|
110
127
|
<div class="method-heading">
|
111
|
-
<a href="#
|
128
|
+
<a href="#M000004" class="method-signature">
|
112
129
|
<span class="method-name">create</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
113
130
|
</a>
|
114
131
|
</div>
|
@@ -119,8 +136,8 @@ Creates a database, if it doesn‘t already exist for the specified
|
|
119
136
|
environment
|
120
137
|
</p>
|
121
138
|
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('
|
123
|
-
<div class="method-source-code" id="
|
139
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
140
|
+
<div class="method-source-code" id="M000004-source">
|
124
141
|
<pre>
|
125
142
|
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database.rb, line 20</span>
|
126
143
|
20: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">env</span> = <span class="ruby-constant">Mack</span>.<span class="ruby-identifier">env</span>, <span class="ruby-identifier">repis</span> = <span class="ruby-identifier">:default</span>)
|
@@ -132,11 +149,11 @@ environment
|
|
132
149
|
</div>
|
133
150
|
</div>
|
134
151
|
|
135
|
-
<div id="method-
|
136
|
-
<a name="
|
152
|
+
<div id="method-M000005" class="method-detail">
|
153
|
+
<a name="M000005"></a>
|
137
154
|
|
138
155
|
<div class="method-heading">
|
139
|
-
<a href="#
|
156
|
+
<a href="#M000005" class="method-signature">
|
140
157
|
<span class="method-name">drop</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
141
158
|
</a>
|
142
159
|
</div>
|
@@ -146,8 +163,8 @@ environment
|
|
146
163
|
Drops a database, if it exists for the specified environment
|
147
164
|
</p>
|
148
165
|
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('
|
150
|
-
<div class="method-source-code" id="
|
166
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
167
|
+
<div class="method-source-code" id="M000005-source">
|
151
168
|
<pre>
|
152
169
|
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database.rb, line 26</span>
|
153
170
|
26: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">drop</span>(<span class="ruby-identifier">env</span> = <span class="ruby-constant">Mack</span>.<span class="ruby-identifier">env</span>, <span class="ruby-identifier">repis</span> = <span class="ruby-identifier">:default</span>)
|
@@ -159,11 +176,58 @@ Drops a database, if it exists for the specified environment
|
|
159
176
|
</div>
|
160
177
|
</div>
|
161
178
|
|
162
|
-
<div id="method-
|
163
|
-
<a name="
|
179
|
+
<div id="method-M000007" class="method-detail">
|
180
|
+
<a name="M000007"></a>
|
164
181
|
|
165
182
|
<div class="method-heading">
|
166
|
-
<a href="#
|
183
|
+
<a href="#M000007" class="method-signature">
|
184
|
+
<span class="method-name">dump_structure</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
185
|
+
</a>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="method-description">
|
189
|
+
<p>
|
190
|
+
Dumps the structure of the database to a file.
|
191
|
+
</p>
|
192
|
+
<p><a class="source-toggle" href="#"
|
193
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
194
|
+
<div class="method-source-code" id="M000007-source">
|
195
|
+
<pre>
|
196
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database.rb, line 48</span>
|
197
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dump_structure</span>(<span class="ruby-identifier">env</span> = <span class="ruby-constant">Mack</span>.<span class="ruby-identifier">env</span>, <span class="ruby-identifier">repis</span> = <span class="ruby-identifier">:default</span>)
|
198
|
+
49: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Database</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-identifier">env</span>)
|
199
|
+
50: <span class="ruby-identifier">adapter</span> = <span class="ruby-identifier">repository</span>(<span class="ruby-identifier">repis</span>).<span class="ruby-identifier">adapter</span>
|
200
|
+
51: <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">uri</span>
|
201
|
+
52: <span class="ruby-identifier">structure</span> = <span class="ruby-value str">""</span>
|
202
|
+
53: <span class="ruby-identifier">output_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Mack</span>.<span class="ruby-identifier">root</span>, <span class="ruby-value str">"db"</span>, <span class="ruby-node">"#{env}_schema_structure.sql"</span>)
|
203
|
+
54: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
|
204
|
+
55: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/Mysql/</span>
|
205
|
+
56: <span class="ruby-identifier">sql</span> = <span class="ruby-value str">"SHOW TABLES"</span>
|
206
|
+
57: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">sql</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">res</span><span class="ruby-operator">|</span>
|
207
|
+
58: <span class="ruby-identifier">show</span> = <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">query</span>(<span class="ruby-node">"SHOW CREATE TABLE #{res}"</span>).<span class="ruby-identifier">first</span>
|
208
|
+
59: <span class="ruby-identifier">structure</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">show</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"create table"</span>.<span class="ruby-identifier">to_sym</span>]
|
209
|
+
60: <span class="ruby-identifier">structure</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">";\n\n"</span>
|
210
|
+
61: <span class="ruby-keyword kw">end</span>
|
211
|
+
62: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">output_file</span>, <span class="ruby-value str">"w"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">structure</span>}
|
212
|
+
63: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/Postgres/</span>
|
213
|
+
64: <span class="ruby-node">`pg_dump -i -U "#{uri.user}" -s -x -O -n #{ENV["SCHEMA"] ||= "public"} -f #{output_file} #{uri.basename}`</span>
|
214
|
+
65: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/Sqlite3/</span>
|
215
|
+
66: <span class="ruby-identifier">db_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Mack</span>.<span class="ruby-identifier">root</span>, <span class="ruby-value str">"db"</span>)
|
216
|
+
67: <span class="ruby-node">`sqlite3 #{File.join(db_dir, uri.basename)} .schema > #{output_file}`</span>
|
217
|
+
68: <span class="ruby-keyword kw">else</span>
|
218
|
+
69: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Task not supported for '#{repository(repis).adapter.class.name}'"</span>
|
219
|
+
70: <span class="ruby-keyword kw">end</span>
|
220
|
+
71: <span class="ruby-keyword kw">end</span>
|
221
|
+
</pre>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="method-M000003" class="method-detail">
|
227
|
+
<a name="M000003"></a>
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<a href="#M000003" class="method-signature">
|
167
231
|
<span class="method-name">establish_connection</span><span class="method-args">(env = Mack.env)</span>
|
168
232
|
</a>
|
169
233
|
</div>
|
@@ -174,8 +238,8 @@ Sets up and establishes connections to the database based on the specified
|
|
174
238
|
environment and the settings in the database.yml file.
|
175
239
|
</p>
|
176
240
|
<p><a class="source-toggle" href="#"
|
177
|
-
onclick="toggleCode('
|
178
|
-
<div class="method-source-code" id="
|
241
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
242
|
+
<div class="method-source-code" id="M000003-source">
|
179
243
|
<pre>
|
180
244
|
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database.rb, line 6</span>
|
181
245
|
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-identifier">env</span> = <span class="ruby-constant">Mack</span>.<span class="ruby-identifier">env</span>)
|
@@ -195,6 +259,43 @@ environment and the settings in the database.yml file.
|
|
195
259
|
</div>
|
196
260
|
</div>
|
197
261
|
|
262
|
+
<div id="method-M000006" class="method-detail">
|
263
|
+
<a name="M000006"></a>
|
264
|
+
|
265
|
+
<div class="method-heading">
|
266
|
+
<a href="#M000006" class="method-signature">
|
267
|
+
<span class="method-name">load_structure</span><span class="method-args">(file, env = Mack.env, repis = :default)</span>
|
268
|
+
</a>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div class="method-description">
|
272
|
+
<p>
|
273
|
+
Loads the structure of the given file into the database
|
274
|
+
</p>
|
275
|
+
<p><a class="source-toggle" href="#"
|
276
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
277
|
+
<div class="method-source-code" id="M000006-source">
|
278
|
+
<pre>
|
279
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database.rb, line 32</span>
|
280
|
+
32: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_structure</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">env</span> = <span class="ruby-constant">Mack</span>.<span class="ruby-identifier">env</span>, <span class="ruby-identifier">repis</span> = <span class="ruby-identifier">:default</span>)
|
281
|
+
33: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Database</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-identifier">env</span>)
|
282
|
+
34: <span class="ruby-identifier">adapter</span> = <span class="ruby-identifier">repository</span>(<span class="ruby-identifier">repis</span>).<span class="ruby-identifier">adapter</span>
|
283
|
+
35: <span class="ruby-identifier">sql</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
|
284
|
+
36: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
|
285
|
+
37: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/Mysql/</span>
|
286
|
+
38: <span class="ruby-identifier">sql</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">";"</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
287
|
+
39: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">strip!</span>
|
288
|
+
40: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">blank?</span>
|
289
|
+
41: <span class="ruby-keyword kw">end</span>
|
290
|
+
42: <span class="ruby-keyword kw">else</span>
|
291
|
+
43: <span class="ruby-identifier">adapter</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sql</span>.<span class="ruby-identifier">blank?</span>
|
292
|
+
44: <span class="ruby-keyword kw">end</span>
|
293
|
+
45: <span class="ruby-keyword kw">end</span>
|
294
|
+
</pre>
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
198
299
|
|
199
300
|
</div>
|
200
301
|
|
@@ -0,0 +1,140 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::Database::Generators</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Database::Generators</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-data_mapper/generators_rb.html">
|
59
|
+
lib/mack-data_mapper/generators.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000008">controller_template_location</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Class methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000008" class="method-detail">
|
106
|
+
<a name="M000008"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="#M000008" class="method-signature">
|
110
|
+
<span class="method-name">controller_template_location</span><span class="method-args">()</span>
|
111
|
+
</a>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
<p><a class="source-toggle" href="#"
|
116
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
117
|
+
<div class="method-source-code" id="M000008-source">
|
118
|
+
<pre>
|
119
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/generators.rb, line 5</span>
|
120
|
+
5: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">controller_template_location</span>
|
121
|
+
6: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">"scaffold_generator"</span>, <span class="ruby-value str">"templates"</span>, <span class="ruby-value str">"app"</span>, <span class="ruby-value str">"controllers"</span>, <span class="ruby-value str">"controller.rb.template"</span>)
|
122
|
+
7: <span class="ruby-keyword kw">end</span>
|
123
|
+
</pre>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
<div id="validator-badges">
|
136
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
</body>
|
140
|
+
</html>
|
@@ -0,0 +1,206 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::Database::Migrations</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Database::Migrations</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-data_mapper/database_migrations_rb.html">
|
59
|
+
lib/mack-data_mapper/database_migrations.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000011">abort_if_pending_migrations</a>
|
84
|
+
<a href="#M000009">migrate</a>
|
85
|
+
<a href="#M000010">rollback</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if method_list -->
|
104
|
+
<div id="methods">
|
105
|
+
<h3 class="section-bar">Public Class methods</h3>
|
106
|
+
|
107
|
+
<div id="method-M000011" class="method-detail">
|
108
|
+
<a name="M000011"></a>
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<a href="#M000011" class="method-signature">
|
112
|
+
<span class="method-name">abort_if_pending_migrations</span><span class="method-args">()</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p><a class="source-toggle" href="#"
|
118
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
119
|
+
<div class="method-source-code" id="M000011-source">
|
120
|
+
<pre>
|
121
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database_migrations.rb, line 25</span>
|
122
|
+
25: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">abort_if_pending_migrations</span>
|
123
|
+
26: <span class="ruby-identifier">migration_files</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mig</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load</span> <span class="ruby-identifier">mig</span> }
|
124
|
+
27: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">migrations</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mig</span><span class="ruby-operator">|</span>
|
125
|
+
28: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">UnrunMigrations</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">mig</span>.<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mig</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value str">"needs_up?"</span>)
|
126
|
+
29: <span class="ruby-keyword kw">end</span>
|
127
|
+
30: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">migrations</span>.<span class="ruby-identifier">clear</span>
|
128
|
+
31: <span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div id="method-M000009" class="method-detail">
|
135
|
+
<a name="M000009"></a>
|
136
|
+
|
137
|
+
<div class="method-heading">
|
138
|
+
<a href="#M000009" class="method-signature">
|
139
|
+
<span class="method-name">migrate</span><span class="method-args">()</span>
|
140
|
+
</a>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div class="method-description">
|
144
|
+
<p>
|
145
|
+
Migrates the database to the latest version
|
146
|
+
</p>
|
147
|
+
<p><a class="source-toggle" href="#"
|
148
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
149
|
+
<div class="method-source-code" id="M000009-source">
|
150
|
+
<pre>
|
151
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database_migrations.rb, line 8</span>
|
152
|
+
8: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">migrate</span>
|
153
|
+
9: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Database</span>.<span class="ruby-identifier">establish_connection</span>
|
154
|
+
10: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">reset!</span>
|
155
|
+
11: <span class="ruby-identifier">migration_files</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mig</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load</span> <span class="ruby-identifier">mig</span> }
|
156
|
+
12: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">migrate_up!</span>
|
157
|
+
13: <span class="ruby-keyword kw">end</span>
|
158
|
+
</pre>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-M000010" class="method-detail">
|
164
|
+
<a name="M000010"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000010" class="method-signature">
|
168
|
+
<span class="method-name">rollback</span><span class="method-args">(step = 1)</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p>
|
174
|
+
Rolls back the database by the specified number of steps. Default is 1
|
175
|
+
</p>
|
176
|
+
<p><a class="source-toggle" href="#"
|
177
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
178
|
+
<div class="method-source-code" id="M000010-source">
|
179
|
+
<pre>
|
180
|
+
<span class="ruby-comment cmt"># File lib/mack-data_mapper/database_migrations.rb, line 16</span>
|
181
|
+
16: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rollback</span>(<span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>)
|
182
|
+
17: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">reset!</span>
|
183
|
+
18: <span class="ruby-identifier">migration_files</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mig</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load</span> <span class="ruby-identifier">mig</span> }
|
184
|
+
19: <span class="ruby-identifier">migrations</span> = <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">migrations</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">reverse</span>
|
185
|
+
20: <span class="ruby-identifier">step</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
186
|
+
21: <span class="ruby-identifier">migrations</span>[<span class="ruby-identifier">migrations</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)].<span class="ruby-identifier">perform_down</span>
|
187
|
+
22: <span class="ruby-keyword kw">end</span>
|
188
|
+
23: <span class="ruby-keyword kw">end</span>
|
189
|
+
</pre>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
</div>
|
199
|
+
|
200
|
+
|
201
|
+
<div id="validator-badges">
|
202
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
</body>
|
206
|
+
</html>
|