ridgepole 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04ff9c0b5b25d5bed40e085992ae9f4a605381e6
4
- data.tar.gz: 799269ed647277c33317a16596cbb068498592d6
3
+ metadata.gz: 4c25d9aef1cc8cf9681a16b2ae0c2716ba5ea2f6
4
+ data.tar.gz: d1c1b753ee684549250adfad53fda34b3650755c
5
5
  SHA512:
6
- metadata.gz: 6717299b01c508286c13ee9dffcfcfb5cc6066a4629de48a0f7000bdcc2b6059b4a480dc7589307036c7fd5eb7be6cb0f761db8b738dc8a54e47b8be60054da4
7
- data.tar.gz: 4a82f7ae17dcbdafd2748f22142bdf5986d4005bb7ca6400dd0a57a13e0543c4f4f4cf51f0e14aa5bf27ca14029424221fe4234984f8a739adab64c3ea362ae2
6
+ metadata.gz: 63e2d23d8cf04c4fdbd66d46ddffbc37cc5371a38652372d2f9fca5f362f9d55f70e4edcb404f74c209c6b7c981689c37478a7b6076228f3b919fc06aaf52cca
7
+ data.tar.gz: ea794d306d4a9e3d86e7207cb0f042df1d5532e6e0c867d84196c12b0267cca7f3009b1219acd9a041483aacae0a6e5edcca0118484552e16d426cc6fe8dbbf9
@@ -59,7 +59,7 @@ class Ridgepole::Delta
59
59
  end
60
60
 
61
61
  Ridgepole::ExecuteExpander.without_operation(callback) do
62
- eval_script(script, buf)
62
+ eval_script(script, options.merge(:out => buf))
63
63
  end
64
64
 
65
65
  buf.string.strip
@@ -67,13 +67,13 @@ class Ridgepole::Delta
67
67
  ActiveRecord::Migration.disable_logging = disable_logging_orig
68
68
  end
69
69
  else
70
- eval_script(script)
70
+ eval_script(script, options)
71
71
  end
72
72
  end
73
73
 
74
- def eval_script(script, out = $stdout)
74
+ def eval_script(script, options = {})
75
75
  begin
76
- with_pre_post_query(out) do
76
+ with_pre_post_query(options) do
77
77
  ActiveRecord::Schema.new.instance_eval(script, SCRIPT_NAME, 1)
78
78
  end
79
79
  rescue => e
@@ -81,9 +81,11 @@ class Ridgepole::Delta
81
81
  end
82
82
  end
83
83
 
84
- def with_pre_post_query(out = $stdout)
84
+ def with_pre_post_query(options = {})
85
+ out = options[:out] || $stdout
86
+
85
87
  if (pre_query = @options[:pre_query])
86
- if @options[:noop]
88
+ if options[:noop]
87
89
  out.puts(pre_query)
88
90
  else
89
91
  ActiveRecord::Base.connection.execute(pre_query)
@@ -93,7 +95,7 @@ class Ridgepole::Delta
93
95
  retval = yield
94
96
 
95
97
  if (post_query = @options[:post_query])
96
- if @options[:noop]
98
+ if options[:noop]
97
99
  out.puts(post_query)
98
100
  else
99
101
  ActiveRecord::Base.connection.execute(post_query)
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.3.7'
2
+ VERSION = '0.3.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2014-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord