mack-active_record 0.7.0.1 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -150,7 +150,7 @@ href="Migrations.html#M000011">version</a>
150
150
  <pre>
151
151
  <span class="ruby-comment cmt"># File lib/mack-active_record/database_migrations.rb, line 6</span>
152
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">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>))
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">&quot;migrations&quot;</span>))
154
154
  8: <span class="ruby-keyword kw">end</span>
155
155
  </pre>
156
156
  </div>
@@ -179,7 +179,7 @@ Rolls back the database by the specified number of steps. Default is 1
179
179
  12: <span class="ruby-identifier">cur_version</span> = <span class="ruby-identifier">version</span>.<span class="ruby-identifier">to_i</span>
180
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
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">&lt;</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">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>)
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">&quot;migrations&quot;</span>), <span class="ruby-identifier">target_version</span>)
183
183
  16: <span class="ruby-keyword kw">end</span>
184
184
  </pre>
185
185
  </div>
@@ -224,7 +224,7 @@ Dumps the structure of the database to a file.
224
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
225
  68: <span class="ruby-identifier">dbs</span> = <span class="ruby-identifier">db_settings</span>(<span class="ruby-identifier">env</span>)
226
226
  69: <span class="ruby-identifier">structure</span> = <span class="ruby-value str">&quot;&quot;</span>
227
- 70: <span class="ruby-identifier">output_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Mack</span>.<span class="ruby-identifier">root</span>, <span class="ruby-value str">&quot;db&quot;</span>, <span class="ruby-node">&quot;#{env}_schema_structure.sql&quot;</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">&quot;#{env}_schema_structure.sql&quot;</span>)
228
228
  71: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">dbs</span>[<span class="ruby-identifier">:adapter</span>]
229
229
  72: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;mysql&quot;</span>
230
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">&quot;w&quot;</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>}
@@ -168,7 +168,7 @@
168
168
  55: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">empty?</span>
169
169
  56: <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">uniq!</span>
170
170
  57: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">view_partial</span>.<span class="ruby-identifier">nil?</span>
171
- 58: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</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;app&quot;</span>, <span class="ruby-value str">&quot;views&quot;</span>, <span class="ruby-value str">&quot;application&quot;</span>, <span class="ruby-value str">&quot;_error_messages.html.erb&quot;</span>))
171
+ 58: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Paths</span>.<span class="ruby-identifier">views</span>(<span class="ruby-value str">&quot;application&quot;</span>, <span class="ruby-value str">&quot;_error_messages.html.erb&quot;</span>))
172
172
  59: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span>, <span class="ruby-value str">&quot;application/error_messages&quot;</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">app_errors</span>})
173
173
  60: <span class="ruby-keyword kw">else</span>
174
174
  61: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:inline</span>, <span class="ruby-constant">DEFAULT_PARTIAL</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">app_errors</span>})
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Fri, 29 Aug 2008 11:35:52 -0400
1
+ Mon, 08 Sep 2008 10:56:06 -0400
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:26 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:27 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:27 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:42 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:41 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:20 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:42 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -67,7 +67,7 @@ module Mack
67
67
  Mack::Database.establish_connection(env)
68
68
  dbs = db_settings(env)
69
69
  structure = ""
70
- output_file = File.join(Mack.root, "db", "#{env}_schema_structure.sql")
70
+ output_file = Mack::Paths.db("#{env}_schema_structure.sql")
71
71
  case dbs[:adapter]
72
72
  when "mysql"
73
73
  File.open(output_file, "w") {|f| f.puts ActiveRecord::Base.connection.structure_dump}
@@ -82,7 +82,7 @@ module Mack
82
82
 
83
83
  private
84
84
  def self.db_settings(env)
85
- dbs = YAML::load(ERB.new(IO.read(File.join(Mack.root, "config", "database.yml"))).result)
85
+ dbs = YAML::load(ERB.new(IO.read(Mack::Paths.config("database.yml"))).result)
86
86
  dbs = dbs[env]
87
87
  dbs.symbolize_keys!
88
88
  return dbs
@@ -4,7 +4,7 @@ module Mack
4
4
 
5
5
  # Migrates the database to the latest version
6
6
  def self.migrate
7
- ActiveRecord::Migrator.up(File.join(Mack.root, "db", "migrations"))
7
+ ActiveRecord::Migrator.up(Mack::Paths.db("migrations"))
8
8
  end
9
9
 
10
10
  # Rolls back the database by the specified number of steps. Default is 1
@@ -12,7 +12,7 @@ module Mack
12
12
  cur_version = version.to_i
13
13
  target_version = cur_version - step
14
14
  target_version = 0 if target_version < 0
15
- ActiveRecord::Migrator.down(File.join(Mack.root, "db", "migrations"), target_version)
15
+ ActiveRecord::Migrator.down(Mack::Paths.db("migrations"), target_version)
16
16
  end
17
17
 
18
18
  # Not implemented
@@ -55,7 +55,7 @@ module Mack
55
55
  unless app_errors.empty?
56
56
  app_errors.uniq!
57
57
  if view_partial.nil?
58
- if File.exist?(File.join(Mack.root, "app", "views", "application", "_error_messages.html.erb"))
58
+ if File.exist?(Mack::Paths.views("application", "_error_messages.html.erb"))
59
59
  render(:partial, "application/error_messages", :locals => {:errors => app_errors})
60
60
  else
61
61
  render(:inline, DEFAULT_PARTIAL, :locals => {:errors => app_errors})
@@ -23,6 +23,4 @@ end
23
23
 
24
24
  ActiveRecord::Base.logger = Mack.logger
25
25
 
26
- Mack::Database.establish_connection(Mack.env)
27
-
28
- require File.join(File.dirname(__FILE__), 'mack-active_record_tasks')
26
+ Mack::Database.establish_connection(Mack.env)
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.0.1
4
+ version: 0.7.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-08-29 00:00:00 -04:00
12
+ date: 2008-09-08 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.0.1
33
+ version: 0.7.1
34
34
  version:
35
35
  description: "mack-active_record was developed by: markbates"
36
36
  email: mark@mackframework.com