ridgepole 0.1.7 → 0.1.8
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 +4 -4
- data/bin/ridgepole +14 -13
- data/lib/ridgepole/diff.rb +7 -1
- data/lib/ridgepole/dumper.rb +12 -1
- data/lib/ridgepole/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05061ff918fcb6b202148dc98f4bf065826dc25f
|
4
|
+
data.tar.gz: 829f395a92d73a5872d72463348be4b95dfb0e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c24eafa825eb9c3a5c74ba28b3e26413afd6b0ddf1e5d336116e4a5298b1e5b10116e10317f2e780b9ef99a0a2e149c245253fd2812d5d2e61e9dfc6e585218a
|
7
|
+
data.tar.gz: ac295ab3f0f6d40343836049e17e51ac83ca380041bba4b348f9b2b500681cd8bef98f8598ebb705c71f2441b0eb3cdf0f562a646ed490dce9ac11e58a36ca5e
|
data/bin/ridgepole
CHANGED
@@ -30,19 +30,20 @@ end
|
|
30
30
|
|
31
31
|
ARGV.options do |opt|
|
32
32
|
begin
|
33
|
-
opt.on('-c', '--config CONF_OR_FILE')
|
34
|
-
opt.on('-a', '--apply')
|
35
|
-
opt.on('-m', '--merge')
|
36
|
-
opt.on('-f', '--file FILE')
|
37
|
-
opt.on('', '--dry-run')
|
38
|
-
opt.on('-e', '--export')
|
39
|
-
opt.on('', '--split')
|
40
|
-
opt.on('', '--split-with-dir')
|
41
|
-
opt.on('-o', '--output FILE')
|
42
|
-
opt.on('-t', '--tables TABLES', Array)
|
43
|
-
opt.on('', '--
|
44
|
-
opt.on(''
|
45
|
-
opt.on('' , '--
|
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
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -155,7 +155,13 @@ class Ridgepole::Diff
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def target?(table_name)
|
158
|
-
|
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)
|
data/lib/ridgepole/dumper.rb
CHANGED
@@ -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
|
-
|
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#/ &&
|
data/lib/ridgepole/version.rb
CHANGED