mack-active_record 0.7.1 → 0.7.1.1
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.
- metadata +3 -27
- data/doc/classes/Mack/Database/Generators.html +0 -140
- data/doc/classes/Mack/Database/Migrations.html +0 -228
- data/doc/classes/Mack/Database.html +0 -321
- data/doc/classes/Mack/Testing/ActiveRecordHelpers.html +0 -168
- data/doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html +0 -200
- data/doc/classes/Mack.html +0 -127
- data/doc/classes/MigrationGenerator.html +0 -159
- data/doc/classes/ModelGenerator.html +0 -174
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -111
- data/doc/files/lib/mack-active_record/database_migrations_rb.html +0 -101
- data/doc/files/lib/mack-active_record/database_rb.html +0 -101
- data/doc/files/lib/mack-active_record/generators_rb.html +0 -101
- data/doc/files/lib/mack-active_record/helpers/orm_helpers_rb.html +0 -101
- data/doc/files/lib/mack-active_record/migration_generator/migration_generator_rb.html +0 -149
- data/doc/files/lib/mack-active_record/model_generator/model_generator_rb.html +0 -164
- data/doc/files/lib/mack-active_record/test_extensions_rb.html +0 -109
- data/doc/files/lib/mack-active_record_rb.html +0 -111
- data/doc/files/lib/mack-active_record_tasks_rb.html +0 -108
- data/doc/fr_class_index.html +0 -34
- data/doc/fr_file_index.html +0 -36
- data/doc/fr_method_index.html +0 -38
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.1
|
4
|
+
version: 0.7.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-14 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.7.1
|
33
|
+
version: 0.7.1.1
|
34
34
|
version:
|
35
35
|
description: "mack-active_record was developed by: markbates"
|
36
36
|
email: mark@mackframework.com
|
@@ -58,30 +58,6 @@ files:
|
|
58
58
|
- lib/mack-active_record.rb
|
59
59
|
- lib/mack-active_record_tasks.rb
|
60
60
|
- README
|
61
|
-
- doc/classes/Mack/Database/Generators.html
|
62
|
-
- doc/classes/Mack/Database/Migrations.html
|
63
|
-
- doc/classes/Mack/Database.html
|
64
|
-
- doc/classes/Mack/Testing/ActiveRecordHelpers.html
|
65
|
-
- doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html
|
66
|
-
- doc/classes/Mack.html
|
67
|
-
- doc/classes/MigrationGenerator.html
|
68
|
-
- doc/classes/ModelGenerator.html
|
69
|
-
- doc/created.rid
|
70
|
-
- doc/files/lib/mack-active_record/database_migrations_rb.html
|
71
|
-
- doc/files/lib/mack-active_record/database_rb.html
|
72
|
-
- doc/files/lib/mack-active_record/generators_rb.html
|
73
|
-
- doc/files/lib/mack-active_record/helpers/orm_helpers_rb.html
|
74
|
-
- doc/files/lib/mack-active_record/migration_generator/migration_generator_rb.html
|
75
|
-
- doc/files/lib/mack-active_record/model_generator/model_generator_rb.html
|
76
|
-
- doc/files/lib/mack-active_record/test_extensions_rb.html
|
77
|
-
- doc/files/lib/mack-active_record_rb.html
|
78
|
-
- doc/files/lib/mack-active_record_tasks_rb.html
|
79
|
-
- doc/files/README.html
|
80
|
-
- doc/fr_class_index.html
|
81
|
-
- doc/fr_file_index.html
|
82
|
-
- doc/fr_method_index.html
|
83
|
-
- doc/index.html
|
84
|
-
- doc/rdoc-style.css
|
85
61
|
has_rdoc: true
|
86
62
|
homepage: http://www.mackframework.com
|
87
63
|
post_install_message:
|
@@ -1,140 +0,0 @@
|
|
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-active_record/generators_rb.html">
|
59
|
-
lib/mack-active_record/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="#M000007">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-M000007" class="method-detail">
|
106
|
-
<a name="M000007"></a>
|
107
|
-
|
108
|
-
<div class="method-heading">
|
109
|
-
<a href="#M000007" 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('M000007-source');return false;">[Source]</a></p>
|
117
|
-
<div class="method-source-code" id="M000007-source">
|
118
|
-
<pre>
|
119
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/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>
|
@@ -1,228 +0,0 @@
|
|
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-active_record/database_migrations_rb.html">
|
59
|
-
lib/mack-active_record/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="#M000010">abort_if_pending_migrations</a>
|
84
|
-
<a href="#M000008">migrate</a>
|
85
|
-
<a href="#M000009">rollback</a>
|
86
|
-
<a href="#M000011">version</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 Class methods</h3>
|
107
|
-
|
108
|
-
<div id="method-M000010" class="method-detail">
|
109
|
-
<a name="M000010"></a>
|
110
|
-
|
111
|
-
<div class="method-heading">
|
112
|
-
<a href="#M000010" class="method-signature">
|
113
|
-
<span class="method-name">abort_if_pending_migrations</span><span class="method-args">()</span>
|
114
|
-
</a>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div class="method-description">
|
118
|
-
<p>
|
119
|
-
Not implemented
|
120
|
-
</p>
|
121
|
-
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
123
|
-
<div class="method-source-code" id="M000010-source">
|
124
|
-
<pre>
|
125
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database_migrations.rb, line 19</span>
|
126
|
-
19: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">abort_if_pending_migrations</span>
|
127
|
-
20: <span class="ruby-keyword kw">end</span>
|
128
|
-
</pre>
|
129
|
-
</div>
|
130
|
-
</div>
|
131
|
-
</div>
|
132
|
-
|
133
|
-
<div id="method-M000008" class="method-detail">
|
134
|
-
<a name="M000008"></a>
|
135
|
-
|
136
|
-
<div class="method-heading">
|
137
|
-
<a href="#M000008" class="method-signature">
|
138
|
-
<span class="method-name">migrate</span><span class="method-args">()</span>
|
139
|
-
</a>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
<div class="method-description">
|
143
|
-
<p>
|
144
|
-
Migrates the database to the latest <a
|
145
|
-
href="Migrations.html#M000011">version</a>
|
146
|
-
</p>
|
147
|
-
<p><a class="source-toggle" href="#"
|
148
|
-
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
149
|
-
<div class="method-source-code" id="M000008-source">
|
150
|
-
<pre>
|
151
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database_migrations.rb, line 6</span>
|
152
|
-
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">migrate</span>
|
153
|
-
7: <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">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Paths</span>.<span class="ruby-identifier">db</span>(<span class="ruby-value str">"migrations"</span>))
|
154
|
-
8: <span class="ruby-keyword kw">end</span>
|
155
|
-
</pre>
|
156
|
-
</div>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<div id="method-M000009" class="method-detail">
|
161
|
-
<a name="M000009"></a>
|
162
|
-
|
163
|
-
<div class="method-heading">
|
164
|
-
<a href="#M000009" class="method-signature">
|
165
|
-
<span class="method-name">rollback</span><span class="method-args">(step = 1)</span>
|
166
|
-
</a>
|
167
|
-
</div>
|
168
|
-
|
169
|
-
<div class="method-description">
|
170
|
-
<p>
|
171
|
-
Rolls back the database by the specified number of steps. Default is 1
|
172
|
-
</p>
|
173
|
-
<p><a class="source-toggle" href="#"
|
174
|
-
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
175
|
-
<div class="method-source-code" id="M000009-source">
|
176
|
-
<pre>
|
177
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database_migrations.rb, line 11</span>
|
178
|
-
11: <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>)
|
179
|
-
12: <span class="ruby-identifier">cur_version</span> = <span class="ruby-identifier">version</span>.<span class="ruby-identifier">to_i</span>
|
180
|
-
13: <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>
|
181
|
-
14: <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>
|
182
|
-
15: <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">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Paths</span>.<span class="ruby-identifier">db</span>(<span class="ruby-value str">"migrations"</span>), <span class="ruby-identifier">target_version</span>)
|
183
|
-
16: <span class="ruby-keyword kw">end</span>
|
184
|
-
</pre>
|
185
|
-
</div>
|
186
|
-
</div>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div id="method-M000011" class="method-detail">
|
190
|
-
<a name="M000011"></a>
|
191
|
-
|
192
|
-
<div class="method-heading">
|
193
|
-
<a href="#M000011" class="method-signature">
|
194
|
-
<span class="method-name">version</span><span class="method-args">()</span>
|
195
|
-
</a>
|
196
|
-
</div>
|
197
|
-
|
198
|
-
<div class="method-description">
|
199
|
-
<p>
|
200
|
-
Returns the current <a href="Migrations.html#M000011">version</a> of the
|
201
|
-
database
|
202
|
-
</p>
|
203
|
-
<p><a class="source-toggle" href="#"
|
204
|
-
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
205
|
-
<div class="method-source-code" id="M000011-source">
|
206
|
-
<pre>
|
207
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database_migrations.rb, line 23</span>
|
208
|
-
23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
|
209
|
-
24: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">current_version</span>
|
210
|
-
25: <span class="ruby-keyword kw">end</span>
|
211
|
-
</pre>
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
</div>
|
215
|
-
|
216
|
-
|
217
|
-
</div>
|
218
|
-
|
219
|
-
|
220
|
-
</div>
|
221
|
-
|
222
|
-
|
223
|
-
<div id="validator-badges">
|
224
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
225
|
-
</div>
|
226
|
-
|
227
|
-
</body>
|
228
|
-
</html>
|
@@ -1,321 +0,0 @@
|
|
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/mack-active_record/database_rb.html">
|
59
|
-
lib/mack-active_record/database.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../../files/lib/mack-active_record/database_migrations_rb.html">
|
63
|
-
lib/mack-active_record/database_migrations.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../../files/lib/mack-active_record/generators_rb.html">
|
67
|
-
lib/mack-active_record/generators.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
</td>
|
71
|
-
</tr>
|
72
|
-
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
91
|
-
<a href="#M000003">create</a>
|
92
|
-
<a href="#M000004">drop</a>
|
93
|
-
<a href="#M000006">dump_structure</a>
|
94
|
-
<a href="#M000002">establish_connection</a>
|
95
|
-
<a href="#M000005">load_structure</a>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
|
102
|
-
<!-- if includes -->
|
103
|
-
|
104
|
-
<div id="section">
|
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>
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
<!-- if method_list -->
|
121
|
-
<div id="methods">
|
122
|
-
<h3 class="section-bar">Public Class methods</h3>
|
123
|
-
|
124
|
-
<div id="method-M000003" class="method-detail">
|
125
|
-
<a name="M000003"></a>
|
126
|
-
|
127
|
-
<div class="method-heading">
|
128
|
-
<a href="#M000003" class="method-signature">
|
129
|
-
<span class="method-name">create</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
130
|
-
</a>
|
131
|
-
</div>
|
132
|
-
|
133
|
-
<div class="method-description">
|
134
|
-
<p>
|
135
|
-
Creates a database, if it doesn‘t already exist for the specified
|
136
|
-
environment
|
137
|
-
</p>
|
138
|
-
<p><a class="source-toggle" href="#"
|
139
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
140
|
-
<div class="method-source-code" id="M000003-source">
|
141
|
-
<pre>
|
142
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database.rb, line 12</span>
|
143
|
-
12: <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>)
|
144
|
-
13: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
145
|
-
14: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
|
146
|
-
15: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"mysql"</span>
|
147
|
-
16: <span class="ruby-identifier">establish_mysql_connection</span>
|
148
|
-
17: <span class="ruby-identifier">create_mysql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>)
|
149
|
-
18: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"postgresql"</span>
|
150
|
-
19: <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>]
|
151
|
-
20: <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>]
|
152
|
-
21: <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>]
|
153
|
-
22: <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>
|
154
|
-
23: <span class="ruby-identifier">create_postgresql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>)
|
155
|
-
24: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"sqlite3"</span>
|
156
|
-
25: <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>
|
157
|
-
26: <span class="ruby-keyword kw">end</span>
|
158
|
-
27: <span class="ruby-keyword kw">end</span>
|
159
|
-
</pre>
|
160
|
-
</div>
|
161
|
-
</div>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div id="method-M000004" class="method-detail">
|
165
|
-
<a name="M000004"></a>
|
166
|
-
|
167
|
-
<div class="method-heading">
|
168
|
-
<a href="#M000004" class="method-signature">
|
169
|
-
<span class="method-name">drop</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
170
|
-
</a>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
<div class="method-description">
|
174
|
-
<p>
|
175
|
-
Drops a database, if it exists for the specified environment
|
176
|
-
</p>
|
177
|
-
<p><a class="source-toggle" href="#"
|
178
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
179
|
-
<div class="method-source-code" id="M000004-source">
|
180
|
-
<pre>
|
181
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database.rb, line 30</span>
|
182
|
-
30: <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>)
|
183
|
-
31: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
184
|
-
32: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
|
185
|
-
33: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"mysql"</span>
|
186
|
-
34: <span class="ruby-identifier">establish_mysql_connection</span>
|
187
|
-
35: <span class="ruby-identifier">drop_mysql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>)
|
188
|
-
36: <span class="ruby-comment cmt"># ActiveRecord::Base.connection.drop_database dbs[:database]</span>
|
189
|
-
37: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"postgresql"</span>
|
190
|
-
38: <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>]
|
191
|
-
39: <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>]
|
192
|
-
40: <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>]
|
193
|
-
41: <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>
|
194
|
-
42: <span class="ruby-identifier">drop_postgresql_db</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">dbs</span>)
|
195
|
-
43: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"sqlite3"</span>
|
196
|
-
44: <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>
|
197
|
-
45: <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>])
|
198
|
-
46: <span class="ruby-keyword kw">end</span>
|
199
|
-
47: <span class="ruby-keyword kw">end</span>
|
200
|
-
</pre>
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
<div id="method-M000006" class="method-detail">
|
206
|
-
<a name="M000006"></a>
|
207
|
-
|
208
|
-
<div class="method-heading">
|
209
|
-
<a href="#M000006" class="method-signature">
|
210
|
-
<span class="method-name">dump_structure</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
211
|
-
</a>
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div class="method-description">
|
215
|
-
<p>
|
216
|
-
Dumps the structure of the database to a file.
|
217
|
-
</p>
|
218
|
-
<p><a class="source-toggle" href="#"
|
219
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
220
|
-
<div class="method-source-code" id="M000006-source">
|
221
|
-
<pre>
|
222
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database.rb, line 66</span>
|
223
|
-
66: <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>)
|
224
|
-
67: <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>)
|
225
|
-
68: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
226
|
-
69: <span class="ruby-identifier">structure</span> = <span class="ruby-value str">""</span>
|
227
|
-
70: <span class="ruby-identifier">output_file</span> = <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Paths</span>.<span class="ruby-identifier">db</span>(<span class="ruby-node">"#{env}_schema_structure.sql"</span>)
|
228
|
-
71: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
|
229
|
-
72: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"mysql"</span>
|
230
|
-
73: <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-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">structure_dump</span>}
|
231
|
-
74: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"postgresql"</span>
|
232
|
-
75: <span class="ruby-node">`pg_dump -i -U "#{dbs[:username]}" -s -x -O -n #{ENV["SCHEMA"] ||= "public"} -f #{output_file} #{dbs[:database]}`</span>
|
233
|
-
76: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"sqlite3"</span>
|
234
|
-
77: <span class="ruby-node">`sqlite3 #{dbs[:database]} .schema > #{output_file}`</span>
|
235
|
-
78: <span class="ruby-keyword kw">else</span>
|
236
|
-
79: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Task not supported for '#{dbs[:adapter]}'"</span>
|
237
|
-
80: <span class="ruby-keyword kw">end</span>
|
238
|
-
81: <span class="ruby-keyword kw">end</span>
|
239
|
-
</pre>
|
240
|
-
</div>
|
241
|
-
</div>
|
242
|
-
</div>
|
243
|
-
|
244
|
-
<div id="method-M000002" class="method-detail">
|
245
|
-
<a name="M000002"></a>
|
246
|
-
|
247
|
-
<div class="method-heading">
|
248
|
-
<a href="#M000002" class="method-signature">
|
249
|
-
<span class="method-name">establish_connection</span><span class="method-args">(env = Mack.env)</span>
|
250
|
-
</a>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
<div class="method-description">
|
254
|
-
<p>
|
255
|
-
Sets up and establishes connections to the database based on the specified
|
256
|
-
environment and the settings in the database.yml file.
|
257
|
-
</p>
|
258
|
-
<p><a class="source-toggle" href="#"
|
259
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
260
|
-
<div class="method-source-code" id="M000002-source">
|
261
|
-
<pre>
|
262
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database.rb, line 6</span>
|
263
|
-
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>)
|
264
|
-
7: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
265
|
-
8: <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>)
|
266
|
-
9: <span class="ruby-keyword kw">end</span>
|
267
|
-
</pre>
|
268
|
-
</div>
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
|
272
|
-
<div id="method-M000005" class="method-detail">
|
273
|
-
<a name="M000005"></a>
|
274
|
-
|
275
|
-
<div class="method-heading">
|
276
|
-
<a href="#M000005" class="method-signature">
|
277
|
-
<span class="method-name">load_structure</span><span class="method-args">(file, env = Mack.env, repis = :default)</span>
|
278
|
-
</a>
|
279
|
-
</div>
|
280
|
-
|
281
|
-
<div class="method-description">
|
282
|
-
<p>
|
283
|
-
Loads the structure of the given file into the database
|
284
|
-
</p>
|
285
|
-
<p><a class="source-toggle" href="#"
|
286
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
287
|
-
<div class="method-source-code" id="M000005-source">
|
288
|
-
<pre>
|
289
|
-
<span class="ruby-comment cmt"># File lib/mack-active_record/database.rb, line 50</span>
|
290
|
-
50: <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>)
|
291
|
-
51: <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>)
|
292
|
-
52: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
|
293
|
-
53: <span class="ruby-identifier">sql</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
|
294
|
-
54: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
|
295
|
-
55: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"mysql"</span>, <span class="ruby-value str">"sqlite3"</span>
|
296
|
-
56: <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>
|
297
|
-
57: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">strip!</span>
|
298
|
-
58: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">connection</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>
|
299
|
-
59: <span class="ruby-keyword kw">end</span>
|
300
|
-
60: <span class="ruby-keyword kw">else</span>
|
301
|
-
61: <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">connection</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>
|
302
|
-
62: <span class="ruby-keyword kw">end</span>
|
303
|
-
63: <span class="ruby-keyword kw">end</span>
|
304
|
-
</pre>
|
305
|
-
</div>
|
306
|
-
</div>
|
307
|
-
</div>
|
308
|
-
|
309
|
-
|
310
|
-
</div>
|
311
|
-
|
312
|
-
|
313
|
-
</div>
|
314
|
-
|
315
|
-
|
316
|
-
<div id="validator-badges">
|
317
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
318
|
-
</div>
|
319
|
-
|
320
|
-
</body>
|
321
|
-
</html>
|