ridgepole 0.1.7 → 0.1.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: 285b15a3e94f13fc1f92e1dae5007dc652fb05e5
4
- data.tar.gz: 8b50b50a5f5a55dd9a5052e84436251c6eb1da35
3
+ metadata.gz: 05061ff918fcb6b202148dc98f4bf065826dc25f
4
+ data.tar.gz: 829f395a92d73a5872d72463348be4b95dfb0e20
5
5
  SHA512:
6
- metadata.gz: a18bbd06c5e3768d7c21b41ba40eea52b4e463b4547971d6b476b45b9b382e2155e7d4e665f24998968661d5859ddbaeadc9ddbe5288bd1ecba1f036032c2e27
7
- data.tar.gz: 3c9825f7f58163f3958edd86bd0c67edb2832b86b887d5ee7deffb2d5529bf0ba784d24945601995286ffc8de7ca64a62ee9315de229965fa20934c034948e49
6
+ metadata.gz: c24eafa825eb9c3a5c74ba28b3e26413afd6b0ddf1e5d336116e4a5298b1e5b10116e10317f2e780b9ef99a0a2e149c245253fd2812d5d2e61e9dfc6e585218a
7
+ data.tar.gz: ac295ab3f0f6d40343836049e17e51ac83ca380041bba4b348f9b2b500681cd8bef98f8598ebb705c71f2441b0eb3cdf0f562a646ed490dce9ac11e58a36ca5e
@@ -30,19 +30,20 @@ end
30
30
 
31
31
  ARGV.options do |opt|
32
32
  begin
33
- opt.on('-c', '--config CONF_OR_FILE') {|v| config = v }
34
- opt.on('-a', '--apply') { set_mode[:apply] }
35
- opt.on('-m', '--merge') { set_mode[:apply]; options[:merge] = true }
36
- opt.on('-f', '--file FILE') {|v| file = v }
37
- opt.on('', '--dry-run') { options[:dry_run] = true }
38
- opt.on('-e', '--export') { set_mode[:export] }
39
- opt.on('', '--split') {|v| split = true }
40
- opt.on('', '--split-with-dir') {|v| split = :with_dir }
41
- opt.on('-o', '--output FILE') {|v| output_file = v }
42
- opt.on('-t', '--tables TABLES', Array) {|v| options[:tables] = v }
43
- opt.on('', '--disable-mysql-unsigned') { options[:disable_mysql_unsigned] = true }
44
- opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
45
- opt.on('' , '--debug') { options[:debug] = true }
33
+ opt.on('-c', '--config CONF_OR_FILE') {|v| config = v }
34
+ opt.on('-a', '--apply') { set_mode[:apply] }
35
+ opt.on('-m', '--merge') { set_mode[:apply]; options[:merge] = true }
36
+ opt.on('-f', '--file FILE') {|v| file = v }
37
+ opt.on('', '--dry-run') { options[:dry_run] = true }
38
+ opt.on('-e', '--export') { set_mode[:export] }
39
+ opt.on('', '--split') {|v| split = true }
40
+ opt.on('', '--split-with-dir') {|v| split = :with_dir }
41
+ opt.on('-o', '--output FILE') {|v| output_file = v }
42
+ opt.on('-t', '--tables TABLES', Array) {|v| options[:tables] = v }
43
+ opt.on('', '--ignore-tables TABLES', Array) {|v| options[:ignore_tables] = v.map {|i| Regexp.new(i) } }
44
+ opt.on('', '--disable-mysql-unsigned') { options[:disable_mysql_unsigned] = true }
45
+ opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
46
+ opt.on('' , '--debug') { options[:debug] = true }
46
47
  opt.parse!
47
48
 
48
49
  unless config and mode
@@ -155,7 +155,13 @@ class Ridgepole::Diff
155
155
  end
156
156
 
157
157
  def target?(table_name)
158
- not @options[:tables] or @options[:tables].include?(table_name)
158
+ if @options[:ignore_tables] and @options[:ignore_tables].any? {|i| i =~ table_name }
159
+ false
160
+ elsif @options[:tables] and not @options[:tables].include?(table_name)
161
+ false
162
+ else
163
+ true
164
+ end
159
165
  end
160
166
 
161
167
  def normalize_column_options!(opts)
@@ -7,6 +7,7 @@ class Ridgepole::Dumper
7
7
  stream = StringIO.new
8
8
  conn = ActiveRecord::Base.connection
9
9
  target_tables = @options[:tables]
10
+ ignore_tables = @options[:ignore_tables]
10
11
 
11
12
  if target_tables
12
13
  conn.tables.each do |tbl|
@@ -15,9 +16,19 @@ class Ridgepole::Dumper
15
16
  end
16
17
  end
17
18
 
19
+ if ignore_tables
20
+ conn.tables.each do |tbl|
21
+ if ignore_tables.any? {|i| i =~ tbl }
22
+ ActiveRecord::SchemaDumper.ignore_tables << tbl
23
+ end
24
+ end
25
+ end
26
+
18
27
  ActiveRecord::SchemaDumper.dump(conn, stream)
19
28
 
20
- ActiveRecord::SchemaDumper.ignore_tables.clear if target_tables
29
+ if target_tables or ignore_tables
30
+ ActiveRecord::SchemaDumper.ignore_tables.clear
31
+ end
21
32
 
22
33
  dsl = stream.string.lines.select {|line|
23
34
  line !~ /\A#/ &&
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara