mack-active_record 0.6.0.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/lib/{database.rb → mack-active_record/database.rb} +0 -0
  2. data/lib/{genosaurus_helpers.rb → mack-active_record/genosaurus_helpers.rb} +0 -0
  3. data/lib/{helpers → mack-active_record/helpers}/orm_helpers.rb +0 -0
  4. data/lib/{migration_generator → mack-active_record/migration_generator}/migration_generator.rb +0 -0
  5. data/lib/{migration_generator → mack-active_record/migration_generator}/templates/db/migrations/%=@migration_name%.rb.template +0 -0
  6. data/lib/{model_column.rb → mack-active_record/model_column.rb} +0 -0
  7. data/lib/{model_generator → mack-active_record/model_generator}/manifest.yml +0 -0
  8. data/lib/{model_generator → mack-active_record/model_generator}/model_generator.rb +0 -0
  9. data/lib/{model_generator → mack-active_record/model_generator}/templates/model.rb.template +0 -0
  10. data/lib/{model_generator → mack-active_record/model_generator}/templates/rspec.rb.template +0 -0
  11. data/lib/{model_generator → mack-active_record/model_generator}/templates/test.rb.template +0 -0
  12. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/manifest.yml +0 -0
  13. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/scaffold_generator.rb +0 -0
  14. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/controllers/controller.rb.template +0 -0
  15. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/edit.html.erb.template +0 -0
  16. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/index.html.erb.template +0 -0
  17. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/new.html.erb.template +0 -0
  18. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/show.html.erb.template +0 -0
  19. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/spec.rb.template +0 -0
  20. data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/test.rb.template +0 -0
  21. data/lib/{tasks → mack-active_record/tasks}/db_create_drop_tasks.rake +0 -0
  22. data/lib/{tasks → mack-active_record/tasks}/db_migration_tasks.rake +0 -0
  23. data/lib/mack-active_record.rb +5 -3
  24. data/lib/mack-active_record_tasks.rb +1 -1
  25. metadata +25 -51
  26. data/doc/classes/Mack/Database/Migrator.html +0 -193
  27. data/doc/classes/Mack/Database.html +0 -224
  28. data/doc/classes/Mack/Genosaurus/ActiveRecord/Helpers.html +0 -225
  29. data/doc/classes/Mack/Genosaurus/ActiveRecord/ModelColumn.html +0 -299
  30. data/doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html +0 -200
  31. data/doc/classes/Mack/ViewHelpers.html +0 -111
  32. data/doc/classes/Mack.html +0 -134
  33. data/doc/classes/MigrationGenerator.html +0 -159
  34. data/doc/classes/ModelGenerator.html +0 -174
  35. data/doc/classes/ScaffoldGenerator.html +0 -123
  36. data/doc/created.rid +0 -1
  37. data/doc/files/README.html +0 -111
  38. data/doc/files/lib/database_rb.html +0 -111
  39. data/doc/files/lib/genosaurus_helpers_rb.html +0 -101
  40. data/doc/files/lib/helpers/orm_helpers_rb.html +0 -101
  41. data/doc/files/lib/mack-active_record_rb.html +0 -110
  42. data/doc/files/lib/mack-active_record_tasks_rb.html +0 -101
  43. data/doc/files/lib/migration_generator/migration_generator_rb.html +0 -149
  44. data/doc/files/lib/model_column_rb.html +0 -101
  45. data/doc/files/lib/model_generator/model_generator_rb.html +0 -164
  46. data/doc/files/lib/scaffold_generator/scaffold_generator_rb.html +0 -114
  47. data/doc/fr_class_index.html +0 -36
  48. data/doc/fr_file_index.html +0 -36
  49. data/doc/fr_method_index.html +0 -41
  50. data/doc/index.html +0 -24
  51. data/doc/rdoc-style.css +0 -208
File without changes
@@ -6,7 +6,7 @@ require 'activerecord'
6
6
  module ActiveRecord # :nodoc:
7
7
  end
8
8
 
9
- fl = File.join(File.dirname(__FILE__))
9
+ fl = File.join(File.dirname(__FILE__), "mack-active_record")
10
10
 
11
11
  require File.join(fl, "database")
12
12
  require File.join(fl, "helpers", "orm_helpers")
@@ -17,9 +17,11 @@ require File.join(fl, "genosaurus_helpers")
17
17
  # require File.join(fl, "#{gen}_generator", "#{gen}_generator")
18
18
  # end
19
19
  [:helpers, :migration_generator, :model_generator, :scaffold_generator].each do |folder|
20
- Dir.glob(File.join(File.dirname(__FILE__), folder.to_s, "**/*.rb")).each {|f| require f}
20
+ Dir.glob(File.join(fl, folder.to_s, "**/*.rb")).each {|f| require f}
21
21
  end
22
22
 
23
23
  ActiveRecord::Base.logger = Mack.logger
24
24
 
25
- Mack::Database.establish_connection(Mack.env)
25
+ Mack::Database.establish_connection(Mack.env)
26
+
27
+ require File.join(File.dirname(__FILE__), 'mack-active_record_tasks')
@@ -1,3 +1,3 @@
1
- Dir.glob(File.join(File.dirname(__FILE__), "tasks", "*.rake")).each do |f|
1
+ Dir.glob(File.join(File.dirname(__FILE__), "mack-active_record", "tasks", "*.rake")).each do |f|
2
2
  load(f)
3
3
  end
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.6.0.1
4
+ version: 0.6.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-07-18 00:00:00 -04:00
12
+ date: 2008-08-04 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,7 +18,7 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - "="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.0.2
24
24
  version:
@@ -31,57 +31,31 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - README
33
33
  files:
34
- - lib/database.rb
35
- - lib/genosaurus_helpers.rb
36
- - lib/helpers/orm_helpers.rb
34
+ - lib/mack-active_record/database.rb
35
+ - lib/mack-active_record/genosaurus_helpers.rb
36
+ - lib/mack-active_record/helpers/orm_helpers.rb
37
+ - lib/mack-active_record/migration_generator/migration_generator.rb
38
+ - lib/mack-active_record/migration_generator/templates/db/migrations/%=@migration_name%.rb.template
39
+ - lib/mack-active_record/model_column.rb
40
+ - lib/mack-active_record/model_generator/manifest.yml
41
+ - lib/mack-active_record/model_generator/model_generator.rb
42
+ - lib/mack-active_record/model_generator/templates/model.rb.template
43
+ - lib/mack-active_record/model_generator/templates/rspec.rb.template
44
+ - lib/mack-active_record/model_generator/templates/test.rb.template
45
+ - lib/mack-active_record/scaffold_generator/manifest.yml
46
+ - lib/mack-active_record/scaffold_generator/scaffold_generator.rb
47
+ - lib/mack-active_record/scaffold_generator/templates/app/controllers/controller.rb.template
48
+ - lib/mack-active_record/scaffold_generator/templates/app/views/edit.html.erb.template
49
+ - lib/mack-active_record/scaffold_generator/templates/app/views/index.html.erb.template
50
+ - lib/mack-active_record/scaffold_generator/templates/app/views/new.html.erb.template
51
+ - lib/mack-active_record/scaffold_generator/templates/app/views/show.html.erb.template
52
+ - lib/mack-active_record/scaffold_generator/templates/spec.rb.template
53
+ - lib/mack-active_record/scaffold_generator/templates/test.rb.template
54
+ - lib/mack-active_record/tasks/db_create_drop_tasks.rake
55
+ - lib/mack-active_record/tasks/db_migration_tasks.rake
37
56
  - lib/mack-active_record.rb
38
57
  - lib/mack-active_record_tasks.rb
39
- - lib/migration_generator/migration_generator.rb
40
- - lib/migration_generator/templates/db/migrations/%=@migration_name%.rb.template
41
- - lib/model_column.rb
42
- - lib/model_generator/manifest.yml
43
- - lib/model_generator/model_generator.rb
44
- - lib/model_generator/templates/model.rb.template
45
- - lib/model_generator/templates/rspec.rb.template
46
- - lib/model_generator/templates/test.rb.template
47
- - lib/scaffold_generator/manifest.yml
48
- - lib/scaffold_generator/scaffold_generator.rb
49
- - lib/scaffold_generator/templates/app/controllers/controller.rb.template
50
- - lib/scaffold_generator/templates/app/views/edit.html.erb.template
51
- - lib/scaffold_generator/templates/app/views/index.html.erb.template
52
- - lib/scaffold_generator/templates/app/views/new.html.erb.template
53
- - lib/scaffold_generator/templates/app/views/show.html.erb.template
54
- - lib/scaffold_generator/templates/spec.rb.template
55
- - lib/scaffold_generator/templates/test.rb.template
56
- - lib/tasks/db_create_drop_tasks.rake
57
- - lib/tasks/db_migration_tasks.rake
58
58
  - README
59
- - doc/classes/Mack/Database/Migrator.html
60
- - doc/classes/Mack/Database.html
61
- - doc/classes/Mack/Genosaurus/ActiveRecord/Helpers.html
62
- - doc/classes/Mack/Genosaurus/ActiveRecord/ModelColumn.html
63
- - doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html
64
- - doc/classes/Mack/ViewHelpers.html
65
- - doc/classes/Mack.html
66
- - doc/classes/MigrationGenerator.html
67
- - doc/classes/ModelGenerator.html
68
- - doc/classes/ScaffoldGenerator.html
69
- - doc/created.rid
70
- - doc/files/lib/database_rb.html
71
- - doc/files/lib/genosaurus_helpers_rb.html
72
- - doc/files/lib/helpers/orm_helpers_rb.html
73
- - doc/files/lib/mack-active_record_rb.html
74
- - doc/files/lib/mack-active_record_tasks_rb.html
75
- - doc/files/lib/migration_generator/migration_generator_rb.html
76
- - doc/files/lib/model_column_rb.html
77
- - doc/files/lib/model_generator/model_generator_rb.html
78
- - doc/files/lib/scaffold_generator/scaffold_generator_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
59
  has_rdoc: true
86
60
  homepage: http://www.mackframework.com
87
61
  post_install_message:
@@ -1,193 +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::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>&nbsp;&nbsp;
84
- <a href="#M000015">rollback</a>&nbsp;&nbsp;
85
- <a href="#M000013">version</a>&nbsp;&nbsp;
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">&quot;db&quot;</span>, <span class="ruby-value str">&quot;migrations&quot;</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">&quot;STEP&quot;</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">&lt;</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">&quot;db&quot;</span>, <span class="ruby-value str">&quot;migrations&quot;</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>
@@ -1,224 +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="#M000010">db_settings</a>&nbsp;&nbsp;
84
- <a href="#M000012">drop_or_create_database</a>&nbsp;&nbsp;
85
- <a href="#M000011">establish_connection</a>&nbsp;&nbsp;
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">&quot;config&quot;</span>, <span class="ruby-value str">&quot;database.yml&quot;</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">&quot;mysql&quot;</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">&quot;postgresql&quot;</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">&quot;sqlite3&quot;</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>