mack-active_record 0.6.0 → 0.6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Mack/Database/Migrator.html +193 -0
- data/doc/classes/Mack/Database.html +224 -0
- data/doc/classes/Mack/Genosaurus/ActiveRecord/Helpers.html +225 -0
- data/doc/classes/Mack/Genosaurus/ActiveRecord/ModelColumn.html +299 -0
- data/doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html +200 -0
- data/doc/classes/Mack/ViewHelpers.html +111 -0
- data/doc/classes/Mack.html +134 -0
- data/doc/classes/MigrationGenerator.html +159 -0
- data/doc/classes/ModelGenerator.html +174 -0
- data/doc/classes/ScaffoldGenerator.html +123 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +111 -0
- data/doc/files/lib/database_rb.html +111 -0
- data/doc/files/lib/genosaurus_helpers_rb.html +101 -0
- data/doc/files/lib/helpers/orm_helpers_rb.html +101 -0
- data/doc/files/lib/mack-active_record_rb.html +110 -0
- data/doc/files/lib/mack-active_record_tasks_rb.html +101 -0
- data/doc/files/lib/migration_generator/migration_generator_rb.html +149 -0
- data/doc/files/lib/model_column_rb.html +101 -0
- data/doc/files/lib/model_generator/model_generator_rb.html +164 -0
- data/doc/files/lib/scaffold_generator/scaffold_generator_rb.html +114 -0
- data/doc/fr_class_index.html +36 -0
- data/doc/fr_file_index.html +36 -0
- data/doc/fr_method_index.html +41 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- metadata +30 -3
@@ -0,0 +1,193 @@
|
|
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::Migrator</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::Migrator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/database_rb.html">
|
59
|
+
lib/database.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="#M000014">migrate</a>
|
84
|
+
<a href="#M000015">rollback</a>
|
85
|
+
<a href="#M000013">version</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-M000014" class="method-detail">
|
108
|
+
<a name="M000014"></a>
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<a href="#M000014" class="method-signature">
|
112
|
+
<span class="method-name">migrate</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('M000014-source');return false;">[Source]</a></p>
|
119
|
+
<div class="method-source-code" id="M000014-source">
|
120
|
+
<pre>
|
121
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 16</span>
|
122
|
+
16: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">migrate</span>
|
123
|
+
17: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">up</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-value str">"migrations"</span>))
|
124
|
+
18: <span class="ruby-keyword kw">end</span>
|
125
|
+
</pre>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div id="method-M000015" class="method-detail">
|
131
|
+
<a name="M000015"></a>
|
132
|
+
|
133
|
+
<div class="method-heading">
|
134
|
+
<a href="#M000015" class="method-signature">
|
135
|
+
<span class="method-name">rollback</span><span class="method-args">(step = 1)</span>
|
136
|
+
</a>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div class="method-description">
|
140
|
+
<p><a class="source-toggle" href="#"
|
141
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
142
|
+
<div class="method-source-code" id="M000015-source">
|
143
|
+
<pre>
|
144
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 20</span>
|
145
|
+
20: <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>)
|
146
|
+
21: <span class="ruby-identifier">step</span> = (<span class="ruby-constant">ENV</span>[<span class="ruby-value str">"STEP"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">step</span>).<span class="ruby-identifier">to_i</span>
|
147
|
+
22: <span class="ruby-identifier">cur_version</span> = <span class="ruby-identifier">version</span>.<span class="ruby-identifier">to_i</span>
|
148
|
+
23: <span class="ruby-identifier">target_version</span> = <span class="ruby-identifier">cur_version</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">step</span>
|
149
|
+
24: <span class="ruby-identifier">target_version</span> = <span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_version</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
150
|
+
25:
|
151
|
+
26: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">down</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-value str">"migrations"</span>), <span class="ruby-identifier">target_version</span>)
|
152
|
+
27: <span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div id="method-M000013" class="method-detail">
|
159
|
+
<a name="M000013"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="#M000013" class="method-signature">
|
163
|
+
<span class="method-name">version</span><span class="method-args">()</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p><a class="source-toggle" href="#"
|
169
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
170
|
+
<div class="method-source-code" id="M000013-source">
|
171
|
+
<pre>
|
172
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 12</span>
|
173
|
+
12: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
|
174
|
+
13: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">current_version</span>
|
175
|
+
14: <span class="ruby-keyword kw">end</span>
|
176
|
+
</pre>
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
<div id="validator-badges">
|
189
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
</body>
|
193
|
+
</html>
|
@@ -0,0 +1,224 @@
|
|
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</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</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/database_rb.html">
|
59
|
+
lib/database.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="#M000010">db_settings</a>
|
84
|
+
<a href="#M000012">drop_or_create_database</a>
|
85
|
+
<a href="#M000011">establish_connection</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
<div id="class-list">
|
97
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
98
|
+
|
99
|
+
Module <a href="Database/Migrator.html" class="link">Mack::Database::Migrator</a><br />
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Class methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000010" class="method-detail">
|
114
|
+
<a name="M000010"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000010" class="method-signature">
|
118
|
+
<span class="method-name">db_settings</span><span class="method-args">(env)</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000010-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 31</span>
|
128
|
+
31: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
129
|
+
32: <span class="ruby-identifier">dbs</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>(<span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</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">"config"</span>, <span class="ruby-value str">"database.yml"</span>))).<span class="ruby-identifier">result</span>)
|
130
|
+
33: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">env</span>]
|
131
|
+
34: <span class="ruby-identifier">dbs</span>.<span class="ruby-identifier">symbolize_keys!</span>
|
132
|
+
35: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dbs</span>
|
133
|
+
36: <span class="ruby-keyword kw">end</span>
|
134
|
+
</pre>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div id="method-M000012" class="method-detail">
|
140
|
+
<a name="M000012"></a>
|
141
|
+
|
142
|
+
<div class="method-heading">
|
143
|
+
<a href="#M000012" class="method-signature">
|
144
|
+
<span class="method-name">drop_or_create_database</span><span class="method-args">(env, mode = :drop_and_create)</span>
|
145
|
+
</a>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
<p>
|
150
|
+
Perform db create or drop
|
151
|
+
</p>
|
152
|
+
<p>
|
153
|
+
By default the mode is drop then create, but caller will be able to call
|
154
|
+
this routine with a specific action (:drop, :create, or :drop_and_create)
|
155
|
+
</p>
|
156
|
+
<p><a class="source-toggle" href="#"
|
157
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
158
|
+
<div class="method-source-code" id="M000012-source">
|
159
|
+
<pre>
|
160
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 48</span>
|
161
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">drop_or_create_database</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-identifier">:drop_and_create</span>)
|
162
|
+
49: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
163
|
+
50: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
|
164
|
+
51: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"mysql"</span>
|
165
|
+
52: <span class="ruby-identifier">establish_mysql_connection</span>
|
166
|
+
53: <span class="ruby-identifier">drop_mysql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop_and_create</span>
|
167
|
+
54: <span class="ruby-identifier">create_mysql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:create</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop_and_create</span>
|
168
|
+
55:
|
169
|
+
56: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"postgresql"</span>
|
170
|
+
57: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PGHOST'</span>] = <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:host</span>]
|
171
|
+
58: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PGPORT'</span>] = <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:port</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:port</span>]
|
172
|
+
59: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PGPASSWORD'</span>] = <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:password</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:password</span>]
|
173
|
+
60:
|
174
|
+
61: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">clear_active_connections!</span>
|
175
|
+
62: <span class="ruby-identifier">drop_postgresql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop_and_create</span>
|
176
|
+
63: <span class="ruby-identifier">create_postgresql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:create</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop_and_create</span>
|
177
|
+
64:
|
178
|
+
65: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"sqlite3"</span>
|
179
|
+
66: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">clear_active_connections!</span>
|
180
|
+
67: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span>(<span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:database</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:drop_and_create</span>
|
181
|
+
68: <span class="ruby-keyword kw">end</span>
|
182
|
+
69: <span class="ruby-keyword kw">end</span>
|
183
|
+
</pre>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div id="method-M000011" class="method-detail">
|
189
|
+
<a name="M000011"></a>
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<a href="#M000011" class="method-signature">
|
193
|
+
<span class="method-name">establish_connection</span><span class="method-args">(env)</span>
|
194
|
+
</a>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
<p><a class="source-toggle" href="#"
|
199
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
200
|
+
<div class="method-source-code" id="M000011-source">
|
201
|
+
<pre>
|
202
|
+
<span class="ruby-comment cmt"># File lib/database.rb, line 38</span>
|
203
|
+
38: <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>)
|
204
|
+
39: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
205
|
+
40: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-identifier">dbs</span>)
|
206
|
+
41: <span class="ruby-keyword kw">end</span>
|
207
|
+
</pre>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
</div>
|
214
|
+
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
<div id="validator-badges">
|
220
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
</body>
|
224
|
+
</html>
|
@@ -0,0 +1,225 @@
|
|
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::Genosaurus::ActiveRecord::Helpers</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::Genosaurus::ActiveRecord::Helpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/genosaurus_helpers_rb.html">
|
59
|
+
lib/genosaurus_helpers.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="#M000002">columns</a>
|
84
|
+
<a href="#M000003">db_directory</a>
|
85
|
+
<a href="#M000004">migrations_directory</a>
|
86
|
+
<a href="#M000005">next_migration_number</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
<!-- if includes -->
|
94
|
+
|
95
|
+
<div id="section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if method_list -->
|
105
|
+
<div id="methods">
|
106
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
107
|
+
|
108
|
+
<div id="method-M000002" class="method-detail">
|
109
|
+
<a name="M000002"></a>
|
110
|
+
|
111
|
+
<div class="method-heading">
|
112
|
+
<a href="#M000002" class="method-signature">
|
113
|
+
<span class="method-name">columns</span><span class="method-args">(name = param(:name))</span>
|
114
|
+
</a>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="method-description">
|
118
|
+
<p><a class="source-toggle" href="#"
|
119
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000002-source">
|
121
|
+
<pre>
|
122
|
+
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 6</span>
|
123
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>(<span class="ruby-identifier">name</span> = <span class="ruby-identifier">param</span>(<span class="ruby-identifier">:name</span>))
|
124
|
+
7: <span class="ruby-identifier">ivar_cache</span>(<span class="ruby-value str">"form_columns"</span>) <span class="ruby-keyword kw">do</span>
|
125
|
+
8: <span class="ruby-identifier">cs</span> = []
|
126
|
+
9: <span class="ruby-identifier">cols</span> = (<span class="ruby-identifier">param</span>(<span class="ruby-identifier">:cols</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">:columns</span>))
|
127
|
+
10: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cols</span>
|
128
|
+
11: <span class="ruby-identifier">cols</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">x</span><span class="ruby-operator">|</span>
|
129
|
+
12: <span class="ruby-identifier">cs</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Genosaurus</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ModelColumn</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">x</span>)
|
130
|
+
13: <span class="ruby-keyword kw">end</span>
|
131
|
+
14: <span class="ruby-keyword kw">end</span>
|
132
|
+
15: <span class="ruby-identifier">cs</span>
|
133
|
+
16: <span class="ruby-keyword kw">end</span>
|
134
|
+
17: <span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="method-M000003" class="method-detail">
|
141
|
+
<a name="M000003"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="#M000003" class="method-signature">
|
145
|
+
<span class="method-name">db_directory</span><span class="method-args">()</span>
|
146
|
+
</a>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p><a class="source-toggle" href="#"
|
151
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
152
|
+
<div class="method-source-code" id="M000003-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 19</span>
|
155
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">db_directory</span>
|
156
|
+
20: <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>)
|
157
|
+
21: <span class="ruby-keyword kw">end</span>
|
158
|
+
</pre>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-M000004" class="method-detail">
|
164
|
+
<a name="M000004"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000004" class="method-signature">
|
168
|
+
<span class="method-name">migrations_directory</span><span class="method-args">()</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000004-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 23</span>
|
178
|
+
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">migrations_directory</span>
|
179
|
+
24: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">db_directory</span>, <span class="ruby-value str">"migrations"</span>)
|
180
|
+
25: <span class="ruby-keyword kw">end</span>
|
181
|
+
</pre>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div id="method-M000005" class="method-detail">
|
187
|
+
<a name="M000005"></a>
|
188
|
+
|
189
|
+
<div class="method-heading">
|
190
|
+
<a href="#M000005" class="method-signature">
|
191
|
+
<span class="method-name">next_migration_number</span><span class="method-args">()</span>
|
192
|
+
</a>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
<p><a class="source-toggle" href="#"
|
197
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000005-source">
|
199
|
+
<pre>
|
200
|
+
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 27</span>
|
201
|
+
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_migration_number</span>
|
202
|
+
28: <span class="ruby-identifier">last</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">migrations_directory</span>, <span class="ruby-value str">"*.rb"</span>)).<span class="ruby-identifier">last</span>
|
203
|
+
29: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last</span>
|
204
|
+
30: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">last</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^\d+/</span>).<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">succ</span>
|
205
|
+
31: <span class="ruby-keyword kw">end</span>
|
206
|
+
32: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"001"</span>
|
207
|
+
33: <span class="ruby-keyword kw">end</span>
|
208
|
+
</pre>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
|
220
|
+
<div id="validator-badges">
|
221
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
</body>
|
225
|
+
</html>
|