mack-data_mapper 0.6.0.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +115 -4
- data/lib/mack-data_mapper.rb +14 -12
- data/lib/{database.rb → mack-data_mapper/database.rb} +0 -0
- data/lib/mack-data_mapper/dm_patches/dm-timestamps.rb +6 -0
- data/lib/mack-data_mapper/dm_patches/migrations.rb +9 -0
- data/lib/{genosaurus_helpers.rb → mack-data_mapper/genosaurus_helpers.rb} +1 -1
- data/lib/{helpers → mack-data_mapper/helpers}/orm_helpers.rb +4 -2
- data/lib/{migration_generator → mack-data_mapper/migration_generator}/migration_generator.rb +0 -0
- data/lib/{migration_generator → mack-data_mapper/migration_generator}/templates/db/migrations/%=@migration_name%.rb.template +0 -0
- data/lib/{model_column.rb → mack-data_mapper/model_column.rb} +3 -3
- data/lib/{model_generator → mack-data_mapper/model_generator}/manifest.yml +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/model_generator.rb +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/model.rb.template +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/rspec.rb.template +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/test_case.rb.template +0 -0
- data/lib/{resource.rb → mack-data_mapper/resource.rb} +0 -0
- data/lib/{runner.rb → mack-data_mapper/runner.rb} +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/manifest.yml +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/scaffold_generator.rb +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/controllers/controller.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/helpers/controllers/helper.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/edit.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/index.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/new.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/show.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/test/functional/rspec.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/test/functional/test_case.rb.template +0 -0
- data/lib/{tasks → mack-data_mapper/tasks}/db_create_drop_tasks.rake +0 -0
- data/lib/{tasks → mack-data_mapper/tasks}/db_migration_tasks.rake +3 -3
- data/lib/{tasks → mack-data_mapper/tasks}/test_tasks.rake +0 -0
- data/lib/{test_extensions.rb → mack-data_mapper/test_extensions.rb} +3 -3
- data/lib/mack-data_mapper_tasks.rb +1 -1
- metadata +103 -69
- data/doc/classes/DataMapper/Resource.html +0 -154
- data/doc/classes/Mack.html +0 -127
- data/doc/classes/Mack/Database.html +0 -210
- data/doc/classes/Mack/Genosaurus/DataMapper/Helpers.html +0 -225
- data/doc/classes/Mack/Genosaurus/DataMapper/ModelColumn.html +0 -237
- data/doc/classes/Mack/Testing/DataMapperHelpers.html +0 -151
- data/doc/classes/Mack/Testing/Helpers.html +0 -155
- data/doc/classes/Mack/ViewHelpers/DataMapperHelpers.html +0 -279
- data/doc/classes/MigrationGenerator.html +0 -161
- data/doc/classes/ModelGenerator.html +0 -183
- data/doc/classes/ScaffoldGenerator.html +0 -123
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -121
- data/doc/files/lib/database_rb.html +0 -101
- data/doc/files/lib/dm_patches/confirmation_validation_rb.html +0 -101
- data/doc/files/lib/dm_patches/dm-cli_rb.html +0 -108
- data/doc/files/lib/dm_patches/migrations_rb.html +0 -101
- data/doc/files/lib/dm_patches/pooling_rb.html +0 -109
- data/doc/files/lib/genosaurus_helpers_rb.html +0 -101
- data/doc/files/lib/helpers/orm_helpers_rb.html +0 -101
- data/doc/files/lib/mack-data_mapper_rb.html +0 -110
- data/doc/files/lib/mack-data_mapper_tasks_rb.html +0 -101
- data/doc/files/lib/migration_generator/migration_generator_rb.html +0 -151
- data/doc/files/lib/model_column_rb.html +0 -101
- data/doc/files/lib/model_generator/model_generator_rb.html +0 -173
- data/doc/files/lib/resource_rb.html +0 -101
- data/doc/files/lib/runner_rb.html +0 -101
- data/doc/files/lib/scaffold_generator/scaffold_generator_rb.html +0 -114
- data/doc/files/lib/test_extensions_rb.html +0 -109
- data/doc/fr_class_index.html +0 -37
- data/doc/fr_file_index.html +0 -43
- data/doc/fr_method_index.html +0 -42
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/dm_patches/confirmation_validation.rb +0 -19
- data/lib/dm_patches/dm-cli.rb +0 -1
- data/lib/dm_patches/migrations.rb +0 -23
- data/lib/dm_patches/pooling.rb +0 -229
@@ -1,154 +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: DataMapper::Resource</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">DataMapper::Resource</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/resource_rb.html">
|
59
|
-
lib/resource.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="#M000001">to_param</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 Instance methods</h3>
|
104
|
-
|
105
|
-
<div id="method-M000001" class="method-detail">
|
106
|
-
<a name="M000001"></a>
|
107
|
-
|
108
|
-
<div class="method-heading">
|
109
|
-
<a href="#M000001" class="method-signature">
|
110
|
-
<span class="method-name">to_param</span><span class="method-args">()</span>
|
111
|
-
</a>
|
112
|
-
</div>
|
113
|
-
|
114
|
-
<div class="method-description">
|
115
|
-
<p>
|
116
|
-
Returns the key of the <a href="Resource.html">DataMapper::Resource</a>
|
117
|
-
object when passed into a url helper
|
118
|
-
</p>
|
119
|
-
<p>
|
120
|
-
Example:
|
121
|
-
</p>
|
122
|
-
<pre>
|
123
|
-
class User
|
124
|
-
include DataMapper::Resource
|
125
|
-
property :name, String, :key => true
|
126
|
-
end
|
127
|
-
users_show_url(User.new(:username => "markbates")) # => /users/markbates
|
128
|
-
</pre>
|
129
|
-
<p><a class="source-toggle" href="#"
|
130
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
131
|
-
<div class="method-source-code" id="M000001-source">
|
132
|
-
<pre>
|
133
|
-
<span class="ruby-comment cmt"># File lib/resource.rb, line 12</span>
|
134
|
-
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_param</span>
|
135
|
-
13: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">key</span>
|
136
|
-
14: <span class="ruby-keyword kw">end</span>
|
137
|
-
</pre>
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
|
143
|
-
</div>
|
144
|
-
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
|
149
|
-
<div id="validator-badges">
|
150
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
</body>
|
154
|
-
</html>
|
data/doc/classes/Mack.html
DELETED
@@ -1,127 +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</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</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
|
-
<a href="../files/lib/genosaurus_helpers_rb.html">
|
63
|
-
lib/genosaurus_helpers.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../files/lib/helpers/orm_helpers_rb.html">
|
67
|
-
lib/helpers/orm_helpers.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../files/lib/model_column_rb.html">
|
71
|
-
lib/model_column.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
<a href="../files/lib/test_extensions_rb.html">
|
75
|
-
lib/test_extensions.rb
|
76
|
-
</a>
|
77
|
-
<br />
|
78
|
-
</td>
|
79
|
-
</tr>
|
80
|
-
|
81
|
-
</table>
|
82
|
-
</div>
|
83
|
-
<!-- banner header -->
|
84
|
-
|
85
|
-
<div id="bodyContent">
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<div id="contextContent">
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
<!-- if includes -->
|
100
|
-
|
101
|
-
<div id="section">
|
102
|
-
|
103
|
-
<div id="class-list">
|
104
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
105
|
-
|
106
|
-
Module <a href="Mack/Database.html" class="link">Mack::Database</a><br />
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<!-- if method_list -->
|
117
|
-
|
118
|
-
|
119
|
-
</div>
|
120
|
-
|
121
|
-
|
122
|
-
<div id="validator-badges">
|
123
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
124
|
-
</div>
|
125
|
-
|
126
|
-
</body>
|
127
|
-
</html>
|
@@ -1,210 +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/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="#M000013">create</a>
|
84
|
-
<a href="#M000014">drop</a>
|
85
|
-
<a href="#M000012">establish_connection</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-M000013" class="method-detail">
|
108
|
-
<a name="M000013"></a>
|
109
|
-
|
110
|
-
<div class="method-heading">
|
111
|
-
<a href="#M000013" class="method-signature">
|
112
|
-
<span class="method-name">create</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
113
|
-
</a>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
<div class="method-description">
|
117
|
-
<p>
|
118
|
-
Creates a database, if it doesn‘t already exist for the specified
|
119
|
-
environment
|
120
|
-
</p>
|
121
|
-
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
123
|
-
<div class="method-source-code" id="M000013-source">
|
124
|
-
<pre>
|
125
|
-
<span class="ruby-comment cmt"># File lib/database.rb, line 20</span>
|
126
|
-
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>)
|
127
|
-
21: <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>)
|
128
|
-
22: <span class="ruby-identifier">create_database</span>(<span class="ruby-identifier">repis</span>)
|
129
|
-
23: <span class="ruby-keyword kw">end</span>
|
130
|
-
</pre>
|
131
|
-
</div>
|
132
|
-
</div>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<div id="method-M000014" class="method-detail">
|
136
|
-
<a name="M000014"></a>
|
137
|
-
|
138
|
-
<div class="method-heading">
|
139
|
-
<a href="#M000014" class="method-signature">
|
140
|
-
<span class="method-name">drop</span><span class="method-args">(env = Mack.env, repis = :default)</span>
|
141
|
-
</a>
|
142
|
-
</div>
|
143
|
-
|
144
|
-
<div class="method-description">
|
145
|
-
<p>
|
146
|
-
Drops a database, if it exists for the specified environment
|
147
|
-
</p>
|
148
|
-
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
150
|
-
<div class="method-source-code" id="M000014-source">
|
151
|
-
<pre>
|
152
|
-
<span class="ruby-comment cmt"># File lib/database.rb, line 26</span>
|
153
|
-
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>)
|
154
|
-
27: <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>)
|
155
|
-
28: <span class="ruby-identifier">drop_database</span>(<span class="ruby-identifier">repis</span>)
|
156
|
-
29: <span class="ruby-keyword kw">end</span>
|
157
|
-
</pre>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
</div>
|
161
|
-
|
162
|
-
<div id="method-M000012" class="method-detail">
|
163
|
-
<a name="M000012"></a>
|
164
|
-
|
165
|
-
<div class="method-heading">
|
166
|
-
<a href="#M000012" class="method-signature">
|
167
|
-
<span class="method-name">establish_connection</span><span class="method-args">(env = Mack.env)</span>
|
168
|
-
</a>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
<p>
|
173
|
-
Sets up and establishes connections to the database based on the specified
|
174
|
-
environment and the settings in the database.yml file.
|
175
|
-
</p>
|
176
|
-
<p><a class="source-toggle" href="#"
|
177
|
-
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
178
|
-
<div class="method-source-code" id="M000012-source">
|
179
|
-
<pre>
|
180
|
-
<span class="ruby-comment cmt"># File lib/database.rb, line 6</span>
|
181
|
-
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>)
|
182
|
-
7: <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>)
|
183
|
-
8: <span class="ruby-identifier">settings</span> = <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">env</span>]
|
184
|
-
9: <span class="ruby-identifier">settings</span>.<span class="ruby-identifier">symbolize_keys!</span>
|
185
|
-
10: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">settings</span>[<span class="ruby-identifier">:default</span>]
|
186
|
-
11: <span class="ruby-identifier">settings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
187
|
-
12: <span class="ruby-constant">DataMapper</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">symbolize_keys</span>)
|
188
|
-
13: <span class="ruby-keyword kw">end</span>
|
189
|
-
14: <span class="ruby-keyword kw">else</span>
|
190
|
-
15: <span class="ruby-constant">DataMapper</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-identifier">:default</span>, <span class="ruby-identifier">settings</span>)
|
191
|
-
16: <span class="ruby-keyword kw">end</span>
|
192
|
-
17: <span class="ruby-keyword kw">end</span>
|
193
|
-
</pre>
|
194
|
-
</div>
|
195
|
-
</div>
|
196
|
-
</div>
|
197
|
-
|
198
|
-
|
199
|
-
</div>
|
200
|
-
|
201
|
-
|
202
|
-
</div>
|
203
|
-
|
204
|
-
|
205
|
-
<div id="validator-badges">
|
206
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
207
|
-
</div>
|
208
|
-
|
209
|
-
</body>
|
210
|
-
</html>
|