ridgepole 0.3.4 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d08fea3e3aeaee714ef067586032c6e6eb25049e
4
- data.tar.gz: 2a9acc2fd3f48e8e79b08aec8138fd58bc3559d6
3
+ metadata.gz: a32f500b9c3b34e20718ff38f2d8c105da56a6d9
4
+ data.tar.gz: 60f9a30069f99a53045dcb2ff8666b45a05b5d16
5
5
  SHA512:
6
- metadata.gz: 883436edcae382bf87885bf406f03ff12c17ff91e7cc01cf65c1e0d6a2b55f82edf7088a599da99f66eabf810c1e0cebfe9ab201d97e834b26e87913afaebdfc
7
- data.tar.gz: cffcd28f3981b8fe96d76648e79bca2a2804919c32ee0e9a4f3f8a64278c81955552dfdc9d5484a831d9065d5002ad8c0d4bbda8a6b9a8e6d85e87aaa17e37b4
6
+ metadata.gz: 23552503c21a1ece686ed0fdb79d9c1c2e7cb00696139f719e01d70ab775632110f84add2be4cb28ba87c2cb1ed8546bbafb3fa4d8908bb508b591bc50ec1dd3
7
+ data.tar.gz: 6928abc2468aa26d70bb38e32f27a05c1229c84571a934a699f86e11ed63a75ef388338659ae36ba4af11645a7f4037506a92b07773e6426b8abbc60b9516296
@@ -44,21 +44,20 @@ end
44
44
  require 'active_record/connection_adapters/abstract/schema_statements'
45
45
 
46
46
  module ActiveRecord::ConnectionAdapters::SchemaStatements
47
- def add_index_with_noop(table_name, column_name, options = {})
48
- begin
49
- add_index_without_noop(table_name, column_name, options)
50
- rescue => e
51
- raise e unless Ridgepole::ExecuteExpander.noop
52
- end
53
- end
54
- alias_method_chain :add_index, :noop
55
-
56
- def remove_index_with_noop(table_name, options = {})
57
- begin
58
- remove_index_without_noop(table_name, options)
59
- rescue => e
60
- raise e unless Ridgepole::ExecuteExpander.noop
47
+ def index_name_exists_with_noop?(table_name, column_name, options = {})
48
+ if Ridgepole::ExecuteExpander.noop
49
+ caller_methods = caller.map {|i| i =~ /:\d+:in `(.+)'/ ? $1 : '' }
50
+
51
+ if caller_methods.any? {|i| i =~ /\Aremove_index/ }
52
+ true
53
+ elsif caller_methods.any? {|i| i =~ /\Aadd_index/ }
54
+ false
55
+ else
56
+ index_name_exists_without_noop?(table_name, column_name, options)
57
+ end
58
+ else
59
+ index_name_exists_without_noop?(table_name, column_name, options)
61
60
  end
62
61
  end
63
- alias_method_chain :remove_index, :noop
62
+ alias_method_chain :index_name_exists?, :noop
64
63
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
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.4
4
+ version: 0.3.5
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-01 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord