ridgepole 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: dd3d82e112d8ef525a7a909538e864b1dc6b4d1b6eaabad978e2ec552962fd63
4
- data.tar.gz: 76dcd540c7ae97d1c226077f2b09979fa16e9937ec8a8d8d9f81b001bcdb2ee2
3
+ metadata.gz: df3bfdcffa2eb5efe360debc1e37b578cde066eca7c9893f38cd110cab576b31
4
+ data.tar.gz: 44af328c711fe5f4d9cf2accbf5eef8a0738daa7b7047cfb47c0ec403ee34149
5
5
  SHA512:
6
- metadata.gz: f641654487c60639c6de8633cba4ee8d3dc55a52b200ee43857f670a818c6699ba4271de56616152b8d378aac2c0e1eee118c17aa362c2e5e451542e5be540c3
7
- data.tar.gz: b502738eb29e65a73e03dc0d64cec03cb250227c319888d65c7869bb123166fbd6354a9accfb25072484ed50e4bbbccd98e674b89dad51618341284bc8c1aeed
6
+ metadata.gz: f2d96fd5d2683583ea72cb91fcb7659c8c9f2d76b9e3b323b0eb1af99cbb737c3f7e79888aefd6b71e850ac6a34e4c7b291bcff141574bc43a28ac112efc4d2b
7
+ data.tar.gz: d191764d26bfb55e70a95ef9f1a806a22e97746b54dcf1616cb3e4ae58425b2d187b9d3c023f70e62c1f6a507546888871e8a5ccb410a87dd1b22601b2b71902
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ AllCops:
3
3
  - "gemfiles/**/*"
4
4
  - "omnibus-ridgepole/**/*"
5
5
  - "vendor/bundle/**/*"
6
- TargetRubyVersion: 2.4
6
+ TargetRubyVersion: 2.5
7
7
  NewCops: enable
8
8
  Bundler/OrderedGems:
9
9
  Include:
data/.simplecov CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- SimpleCov.start do
3
+ SimpleCov.configure do
4
4
  # exclude directories and files
5
5
  add_filter '/spec/'
6
6
  end
data/CHANGELOG.md CHANGED
@@ -1,99 +1,107 @@
1
1
  # Changelog
2
2
 
3
- ## 1.0 (2021/12/19)
3
+ ## 1.0
4
+
5
+ ### 1.0.1 (2022/01/15)
6
+
7
+ * Fix code for RuboCop 1.24.1
8
+ * Fix PostgreSQL spec for Rails 7.0
9
+ * Update ERBh gem (for development)
10
+
11
+ ### 1.0.0 (2021/12/19)
4
12
 
5
13
  * Support Rails 7.0
6
- * `--skip-drop-table` by default ([pull#363](https://github.com/winebarrel/ridgepole/pull/363))
14
+ * `--skip-drop-table` by default ([pull#363](https://github.com/ridgepole/ridgepole/pull/363))
7
15
 
8
16
  ## 0.9
9
17
 
10
18
  ### 0.9.6
11
19
 
12
- * Fix malformed error ([pull#362](https://github.com/winebarrel/ridgepole/pull/362))
20
+ * Fix malformed error ([pull#362](https://github.com/ridgepole/ridgepole/pull/362))
13
21
 
14
22
  ### 0.9.5
15
23
 
16
- * Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/winebarrel/ridgepole/pull/357))
24
+ * Call `super` in `disable_table_options.rb` ([pull#357](https://github.com/ridgepole/ridgepole/pull/357))
17
25
 
18
26
  ### 0.9.4
19
27
 
20
- * Fix `--alter-extra` option for unique index ([pull#356](https://github.com/winebarrel/ridgepole/pull/356))
28
+ * Fix `--alter-extra` option for unique index ([pull#356](https://github.com/ridgepole/ridgepole/pull/356))
21
29
 
22
30
  ### 0.9.3
23
31
 
24
- * Fix `limit` option for `t.integer` ([pull#354](https://github.com/winebarrel/ridgepole/pull/354))
32
+ * Fix `limit` option for `t.integer` ([pull#354](https://github.com/ridgepole/ridgepole/pull/354))
25
33
 
26
34
  ### 0.9.2
27
35
 
28
- * Support `t.column index option` ([pull#353](https://github.com/winebarrel/ridgepole/pull/353))
36
+ * Support `t.column index option` ([pull#353](https://github.com/ridgepole/ridgepole/pull/353))
29
37
 
30
38
  ### 0.9.1
31
39
 
32
- * Support `t.foreign_key` ([pull#348](https://github.com/winebarrel/ridgepole/pull/348))
40
+ * Support `t.foreign_key` ([pull#348](https://github.com/ridgepole/ridgepole/pull/348))
33
41
 
34
42
  ### 0.9.0
35
43
 
36
- * Remove `--mysql-use-alter` option ([pull#330](https://github.com/winebarrel/ridgepole/pull/330))
37
- * Add `--table-hash-options` option ([pull#331](https://github.com/winebarrel/ridgepole/pull/331))
38
- * Support Rails 6.1 ([pull#323](https://github.com/winebarrel/ridgepole/pull/323))
39
- * Disable Rails 5.0 support ([pull#335](https://github.com/winebarrel/ridgepole/pull/335))
40
- * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/winebarrel/ridgepole/pull/334))
44
+ * Remove `--mysql-use-alter` option ([pull#330](https://github.com/ridgepole/ridgepole/pull/330))
45
+ * Add `--table-hash-options` option ([pull#331](https://github.com/ridgepole/ridgepole/pull/331))
46
+ * Support Rails 6.1 ([pull#323](https://github.com/ridgepole/ridgepole/pull/323))
47
+ * Disable Rails 5.0 support ([pull#335](https://github.com/ridgepole/ridgepole/pull/335))
48
+ * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/ridgepole/ridgepole/pull/334))
41
49
 
42
50
  ## 0.8
43
51
 
44
52
  ### 0.8.13
45
53
 
46
- * Support `serial` and `bigserial` column types ([pull#321](https://github.com/winebarrel/ridgepole/pull/321))
54
+ * Support `serial` and `bigserial` column types ([pull#321](https://github.com/ridgepole/ridgepole/pull/321))
47
55
 
48
56
  ### 0.8.12
49
57
 
50
- * Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
58
+ * Pluralize column specified by `references` ([pull#317](https://github.com/ridgepole/ridgepole/pull/317))
51
59
 
52
60
  ### 0.8.11
53
61
 
54
- * Fix FK index check support multiple PK ([pull#315](https://github.com/winebarrel/ridgepole/pull/315))
55
- * Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
62
+ * Fix FK index check support multiple PK ([pull#315](https://github.com/ridgepole/ridgepole/pull/315))
63
+ * Support t.reference() foreign_key option ([pull#316](https://github.com/ridgepole/ridgepole/pull/316))
56
64
 
57
65
  ### 0.8.10
58
66
 
59
- * Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/winebarrel/ridgepole/pull/310))
67
+ * Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/ridgepole/ridgepole/pull/310))
60
68
 
61
69
  ### 0.8.9
62
70
 
63
- * Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/winebarrel/ridgepole/pull/306))
64
- * Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/winebarrel/ridgepole/pull/307))
71
+ * Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/ridgepole/ridgepole/pull/306))
72
+ * Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/ridgepole/ridgepole/pull/307))
65
73
 
66
74
  ### 0.8.8
67
75
 
68
- * Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/winebarrel/ridgepole/pull/303))
76
+ * Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/ridgepole/ridgepole/pull/303))
69
77
 
70
78
  ### 0.8.7
71
79
 
72
- * Support `require_relative` ([pull#298](https://github.com/winebarrel/ridgepole/pull/298))
80
+ * Support `require_relative` ([pull#298](https://github.com/ridgepole/ridgepole/pull/298))
73
81
 
74
82
  ### 0.8.6
75
83
 
76
- * Support multiple databases feature ([pull#297](https://github.com/winebarrel/ridgepole/pull/297))
84
+ * Support multiple databases feature ([pull#297](https://github.com/ridgepole/ridgepole/pull/297))
77
85
 
78
86
  ### 0.8.5
79
87
 
80
- * Improve warning message on table options ([pull#291](https://github.com/winebarrel/ridgepole/pull/291))
88
+ * Improve warning message on table options ([pull#291](https://github.com/ridgepole/ridgepole/pull/291))
81
89
 
82
90
  ### 0.8.4
83
91
 
84
- * Display a warning if an InnoDB table doesn't have any indexes on a column where it has a foreign key ([pull#290](https://github.com/winebarrel/ridgepole/pull/290))
92
+ * Display a warning if an InnoDB table doesn't have any indexes on a column where it has a foreign key ([pull#290](https://github.com/ridgepole/ridgepole/pull/290))
85
93
 
86
94
  ### 0.8.3
87
95
 
88
- * Fix "topological sort failed" error ([pull#287](https://github.com/winebarrel/ridgepole/pull/287))
96
+ * Fix "topological sort failed" error ([pull#287](https://github.com/ridgepole/ridgepole/pull/287))
89
97
 
90
98
  ### 0.8.2
91
99
 
92
- * Support `postgres://` schema ([pull#285](https://github.com/winebarrel/ridgepole/pull/285))
100
+ * Support `postgres://` schema ([pull#285](https://github.com/ridgepole/ridgepole/pull/285))
93
101
 
94
102
  ### 0.8.1
95
103
 
96
- * Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/winebarrel/ridgepole/pull/284))
104
+ * Drop tables in an order considering foreign key constraints ([pull#284](https://github.com/ridgepole/ridgepole/pull/284))
97
105
 
98
106
  ### 0.8.0
99
107
 
@@ -103,32 +111,32 @@
103
111
 
104
112
  ### 0.7.8
105
113
 
106
- * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/winebarrel/ridgepole/pull/278))
114
+ * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/ridgepole/ridgepole/pull/278))
107
115
 
108
116
  ### 0.7.7
109
117
 
110
- * Support URI query string ([pull#273](https://github.com/winebarrel/ridgepole/pull/273))
118
+ * Support URI query string ([pull#273](https://github.com/ridgepole/ridgepole/pull/273))
111
119
 
112
120
  ### 0.7.6
113
121
 
114
- * Fix database url check ([pull#266](https://github.com/winebarrel/ridgepole/pull/266))
115
- * Add ignore option ([pull#267](https://github.com/winebarrel/ridgepole/pull/267))
122
+ * Fix database url check ([pull#266](https://github.com/ridgepole/ridgepole/pull/266))
123
+ * Add ignore option ([pull#267](https://github.com/ridgepole/ridgepole/pull/267))
116
124
 
117
125
  ### 0.7.5
118
126
 
119
- * Fix polymorphic options ([pull#263](https://github.com/winebarrel/ridgepole/pull/263))
120
- * Fix `--mysql-use-alter` option ([pull#246](https://github.com/winebarrel/ridgepole/pull/264))
121
- * Fix Database URI parsing ([pull#265](https://github.com/winebarrel/ridgepole/pull/265))
127
+ * Fix polymorphic options ([pull#263](https://github.com/ridgepole/ridgepole/pull/263))
128
+ * Fix `--mysql-use-alter` option ([pull#246](https://github.com/ridgepole/ridgepole/pull/264))
129
+ * Fix Database URI parsing ([pull#265](https://github.com/ridgepole/ridgepole/pull/265))
122
130
 
123
131
  ### 0.7.4
124
132
 
125
- * Fix `add_foreign_key` options ([issue#250](https://github.com/winebarrel/ridgepole/issues/250))
133
+ * Fix `add_foreign_key` options ([issue#250](https://github.com/ridgepole/ridgepole/issues/250))
126
134
 
127
135
  ### 0.7.3
128
136
 
129
- * Add `--mysql-change-table-comment option` ([pull#166](https://github.com/winebarrel/ridgepole/pull/166))
137
+ * Add `--mysql-change-table-comment option` ([pull#166](https://github.com/ridgepole/ridgepole/pull/166))
130
138
  * Refactoring with RuboCop
131
- * Support primary key adding/dropping ([issue#246](https://github.com/winebarrel/ridgepole/issues/246))
139
+ * Support primary key adding/dropping ([issue#246](https://github.com/ridgepole/ridgepole/issues/246))
132
140
 
133
141
  ### 0.7.2
134
142
 
@@ -161,33 +169,33 @@
161
169
 
162
170
  ### 0.6.6
163
171
 
164
- * Use `t.column` for migration ([pull#114](https://github.com/winebarrel/ridgepole/pull/114))
165
- * Support DATABASE_URL format ([pull#118](https://github.com/winebarrel/ridgepole/pull/118))
166
- * Add Ruby2.4 CI ([pull#119](https://github.com/winebarrel/ridgepole/pull/119))
172
+ * Use `t.column` for migration ([pull#114](https://github.com/ridgepole/ridgepole/pull/114))
173
+ * Support DATABASE_URL format ([pull#118](https://github.com/ridgepole/ridgepole/pull/118))
174
+ * Add Ruby2.4 CI ([pull#119](https://github.com/ridgepole/ridgepole/pull/119))
167
175
 
168
176
  ### 0.6.5
169
177
 
170
178
  * Fix rails version `'>= 4.2', '< 6'`
171
- * Support new types ([pull#84](https://github.com/winebarrel/ridgepole/pull/84))
172
- * Support `default: -> { ... }` ([pull#85](https://github.com/winebarrel/ridgepole/pull/85))
179
+ * Support new types ([pull#84](https://github.com/ridgepole/ridgepole/pull/84))
180
+ * Support `default: -> { ... }` ([pull#85](https://github.com/ridgepole/ridgepole/pull/85))
173
181
  * Support DDL Comment (Rails5 only)
174
182
  * Output schema diff when pass `--verbose`
175
- * Support composite primary key (Rails5 only / [pull#97](https://github.com/winebarrel/ridgepole/pull/97))
183
+ * Support composite primary key (Rails5 only / [pull#97](https://github.com/ridgepole/ridgepole/pull/97))
176
184
 
177
185
  ### 0.6.4
178
186
 
179
- * Execute sql using external script ([pull#56](https://github.com/winebarrel/ridgepole/pull/56))
187
+ * Execute sql using external script ([pull#56](https://github.com/ridgepole/ridgepole/pull/56))
180
188
  * Add `--mysql-use-alter` option
181
189
  * Add `--alter-extra` option
182
190
  * Add `--dump-with-default-fk-name` option
183
- * Support `t.index` ([pull#64](https://github.com/winebarrel/ridgepole/pull/64))
191
+ * Support `t.index` ([pull#64](https://github.com/ridgepole/ridgepole/pull/64))
184
192
  * Remove migration_comments
185
193
  * Fix foreign key apply order
186
194
 
187
195
  ### 0.6.3
188
196
 
189
- * Fix `default` option ([pull#48](https://github.com/winebarrel/ridgepole/pull/48))
190
- * Add `--enable-migration-comments` option ([pull#50](https://github.com/winebarrel/ridgepole/pull/50))
197
+ * Fix `default` option ([pull#48](https://github.com/ridgepole/ridgepole/pull/48))
198
+ * Add `--enable-migration-comments` option ([pull#50](https://github.com/ridgepole/ridgepole/pull/50))
191
199
  * Disable `rename_table_indexes`
192
200
 
193
201
  ### 0.6.1
data/README.md CHANGED
@@ -6,14 +6,14 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
6
6
  (like Chef/Puppet)
7
7
 
8
8
  [![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)
9
- [![Build Status](https://github.com/winebarrel/ridgepole/workflows/test/badge.svg?branch=1.0)](https://github.com/winebarrel/ridgepole/actions)
10
- [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=1.0)](https://coveralls.io/github/winebarrel/ridgepole?branch=1.0)
9
+ [![Build Status](https://github.com/ridgepole/ridgepole/workflows/test/badge.svg?branch=1.0)](https://github.com/ridgepole/ridgepole/actions)
10
+ [![Coverage Status](https://coveralls.io/repos/github/ridgepole/ridgepole/badge.svg?branch=1.0)](https://coveralls.io/github/ridgepole/ridgepole?branch=1.0)
11
11
 
12
12
  **Notice**
13
13
 
14
14
  * ActiveRecord 6.1 is supported in ridgepole v0.9, but the ActiveRecord dump has been changed, so there is a difference between ActiveRecord 5.x/6.0 format.
15
15
  * **If you use ActiveRecord 6.1, please modify Schemafile format**.
16
- * cf. https://github.com/winebarrel/ridgepole/pull/323
16
+ * cf. https://github.com/ridgepole/ridgepole/pull/323
17
17
  * `DROP TABLE` is skipped by default in v1.0 and later versions.
18
18
  * If you want to `DROP TABLE`, please pass `--drop-table`.
19
19
  * cf. https://github.com/ridgepole/ridgepole/pull/363
@@ -303,16 +303,17 @@ Apply `Schemafile`
303
303
 
304
304
  ## Run tests
305
305
 
306
+
306
307
  ```sh
307
308
  docker-compose up -d
308
309
  bundle install
309
310
  bundle exec appraisal install
310
- bundle exec appraisal activerecord-5.1 rake
311
- # POSTGRESQL=1 bundle exec appraisal activerecord-5.1 rake
312
- # MYSQL57=1 bundle exec appraisal activerecord-5.1 rake
311
+ bundle exec appraisal activerecord-7.0 rake
312
+ # POSTGRESQL=1 bundle exec appraisal activerecord-7.0 rake
313
+ # MYSQL57=1 bundle exec appraisal activerecord-7.0 rake
313
314
  ```
314
315
 
315
- **Notice:** mysql-client/postgresql-client is required.
316
+ **Notice:** Ruby 2.6 or above/mysql-client/postgresql-client is required.
316
317
 
317
318
  ## Demo
318
319
 
@@ -321,6 +322,6 @@ bundle exec appraisal activerecord-5.1 rake
321
322
 
322
323
  ## Example project
323
324
 
324
- * https://github.com/winebarrel/ridgepole-example
325
- * https://github.com/winebarrel/ridgepole-example/pull/1
326
- * https://github.com/winebarrel/ridgepole-example/pull/2
325
+ * https://github.com/ridgepole/ridgepole-example
326
+ * https://github.com/ridgepole/ridgepole-example/pull/1
327
+ * https://github.com/ridgepole/ridgepole-example/pull/2
data/bin/ridgepole CHANGED
@@ -74,106 +74,104 @@ def noop_migrate(delta, options)
74
74
  end
75
75
 
76
76
  ARGV.options do |opt|
77
- begin
78
- opt.on('-c', '--config CONF_OR_FILE') { |v| config = v }
79
- opt.on('-E', '--env ENVIRONMENT') { |v| env = v }
80
- opt.on('-s', '--spec-name SPEC_NAME') { |v| spec_name = v }
81
- opt.on('-a', '--apply') { set_mode[:apply] }
82
- opt.on('-m', '--merge') do
83
- set_mode[:apply]
84
- options[:merge] = true
77
+ opt.on('-c', '--config CONF_OR_FILE') { |v| config = v }
78
+ opt.on('-E', '--env ENVIRONMENT') { |v| env = v }
79
+ opt.on('-s', '--spec-name SPEC_NAME') { |v| spec_name = v }
80
+ opt.on('-a', '--apply') { set_mode[:apply] }
81
+ opt.on('-m', '--merge') do
82
+ set_mode[:apply]
83
+ options[:merge] = true
84
+ end
85
+ opt.on('-f', '--file SCHEMAFILE') { |v| file = v }
86
+ opt.on('', '--dry-run') { options[:dry_run] = true }
87
+ opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v }
88
+ opt.on('', '--table-hash-options OPTIONS') do |v|
89
+ # NOTE: Ruby2.4 doesn't support `symbolize_names: true`
90
+ hash = YAML.safe_load(v).deep_symbolize_keys
91
+
92
+ case hash[:id]
93
+ when String
94
+ hash[:id] = hash[:id].to_sym
95
+ when Hash
96
+ hash[:id][:type] = hash[:id][:type].to_sym if hash[:id][:type]
85
97
  end
86
- opt.on('-f', '--file SCHEMAFILE') { |v| file = v }
87
- opt.on('', '--dry-run') { options[:dry_run] = true }
88
- opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v }
89
- opt.on('', '--table-hash-options OPTIONS') do |v|
90
- # NOTE: Ruby2.4 doesn't support `symbolize_names: true`
91
- hash = YAML.safe_load(v).deep_symbolize_keys
92
-
93
- case hash[:id]
94
- when String
95
- hash[:id] = hash[:id].to_sym
96
- when Hash
97
- hash[:id][:type] = hash[:id][:type].to_sym if hash[:id][:type]
98
- end
99
98
 
100
- options[:table_hash_options] = hash
101
- end
102
- opt.on('', '--alter-extra ALTER_SPEC') { |v| options[:alter_extra] = v }
103
- opt.on('', '--external-script SCRIPT') { |v| options[:external_script] = v }
104
- opt.on('', '--bulk-change') do
105
- raise OptionParser::InvalidOption, 'Cannot use `bulk-change` in `merge`' if options[:merge]
99
+ options[:table_hash_options] = hash
100
+ end
101
+ opt.on('', '--alter-extra ALTER_SPEC') { |v| options[:alter_extra] = v }
102
+ opt.on('', '--external-script SCRIPT') { |v| options[:external_script] = v }
103
+ opt.on('', '--bulk-change') do
104
+ raise OptionParser::InvalidOption, 'Cannot use `bulk-change` in `merge`' if options[:merge]
106
105
 
107
- options[:bulk_change] = true
108
- end
106
+ options[:bulk_change] = true
107
+ end
109
108
 
110
- COLUMN_TYPES.each do |column_type, column_type_alias|
111
- opt.on('', "--default-#{column_type_alias}-limit LIMIT", Integer) do |v|
112
- options[:"default_#{column_type}_limit"] = v
113
- end
109
+ COLUMN_TYPES.each do |column_type, column_type_alias|
110
+ opt.on('', "--default-#{column_type_alias}-limit LIMIT", Integer) do |v|
111
+ options[:"default_#{column_type}_limit"] = v
114
112
  end
113
+ end
115
114
 
116
- opt.on('', '--pre-query QUERY') { |v| options[:pre_query] = v }
117
- opt.on('', '--post-query QUERY') { |v| options[:post_query] = v }
118
- opt.on('-e', '--export') { set_mode[:export] }
119
- opt.on('', '--split') { split = true }
120
- opt.on('', '--split-with-dir') { split = :with_dir }
121
- opt.on('-d', '--diff DSL1 DSL2') do |diff_arg1|
122
- set_mode[:diff]
123
- diff_arg2 = ARGV.first
124
-
125
- if [diff_arg1, diff_arg2].any? { |i| i.nil? || i.start_with?('-') }
126
- puts opt.help
127
- exit 1
128
- end
115
+ opt.on('', '--pre-query QUERY') { |v| options[:pre_query] = v }
116
+ opt.on('', '--post-query QUERY') { |v| options[:post_query] = v }
117
+ opt.on('-e', '--export') { set_mode[:export] }
118
+ opt.on('', '--split') { split = true }
119
+ opt.on('', '--split-with-dir') { split = :with_dir }
120
+ opt.on('-d', '--diff DSL1 DSL2') do |diff_arg1|
121
+ set_mode[:diff]
122
+ diff_arg2 = ARGV.first
129
123
 
130
- ARGV.shift
131
- diff_files = [diff_arg1, diff_arg2]
132
- end
133
- opt.on('', '--with-apply') { diff_with_apply = true }
134
- opt.on('-o', '--output SCHEMAFILE') { |v| output_file = v }
135
- opt.on('-t', '--tables TABLES', Array) { |v| options[:tables] = v }
136
- opt.on('', '--ignore-tables REGEX_LIST', Array) { |v| options[:ignore_tables] = v.map { |i| Regexp.new(i) } }
137
- opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true }
138
- opt.on('', '--dump-with-default-fk-name') { options[:dump_with_default_fk_name] = true }
139
- opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
140
- opt.on('', '--drop-table') { options[:force_drop_table] = true }
141
- opt.on('', '--mysql-change-table-options') { options[:mysql_change_table_options] = true }
142
- opt.on('', '--mysql-change-table-comment') { options[:mysql_change_table_comment] = true }
143
- opt.on('', '--check-relation-type DEF_PK') { |v| options[:check_relation_type] = v }
144
- opt.on('', '--ignore-table-comment') { options[:ignore_table_comment] = true }
145
- opt.on('', '--skip-column-comment-change') { options[:skip_column_comment_change] = true }
146
- opt.on('', '--allow-pk-change') { options[:allow_pk_change] = true }
147
- opt.on('', '--create-table-with-index') { options[:create_table_with_index] = true }
148
-
149
- opt.on('', '--mysql-dump-auto-increment') do
150
- options[:mysql_dump_auto_increment] = true
124
+ if [diff_arg1, diff_arg2].any? { |i| i.nil? || i.start_with?('-') }
125
+ puts opt.help
126
+ exit 1
151
127
  end
152
128
 
153
- opt.on('-r', '--require LIBS', Array) { |v| v.each { |i| require i } }
154
- opt.on('', '--log-file LOG_FILE') { |v| options[:log_file] = v }
155
- opt.on('', '--verbose') { Ridgepole::Logger.verbose = true }
156
- opt.on('', '--debug') { options[:debug] = true }
157
- opt.on('', '--[no-]color') { |v| options[:color] = v }
158
-
159
- opt.on('-v', '--version') do
160
- puts opt.ver
161
- exit
162
- end
129
+ ARGV.shift
130
+ diff_files = [diff_arg1, diff_arg2]
131
+ end
132
+ opt.on('', '--with-apply') { diff_with_apply = true }
133
+ opt.on('-o', '--output SCHEMAFILE') { |v| output_file = v }
134
+ opt.on('-t', '--tables TABLES', Array) { |v| options[:tables] = v }
135
+ opt.on('', '--ignore-tables REGEX_LIST', Array) { |v| options[:ignore_tables] = v.map { |i| Regexp.new(i) } }
136
+ opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true }
137
+ opt.on('', '--dump-with-default-fk-name') { options[:dump_with_default_fk_name] = true }
138
+ opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
139
+ opt.on('', '--drop-table') { options[:force_drop_table] = true }
140
+ opt.on('', '--mysql-change-table-options') { options[:mysql_change_table_options] = true }
141
+ opt.on('', '--mysql-change-table-comment') { options[:mysql_change_table_comment] = true }
142
+ opt.on('', '--check-relation-type DEF_PK') { |v| options[:check_relation_type] = v }
143
+ opt.on('', '--ignore-table-comment') { options[:ignore_table_comment] = true }
144
+ opt.on('', '--skip-column-comment-change') { options[:skip_column_comment_change] = true }
145
+ opt.on('', '--allow-pk-change') { options[:allow_pk_change] = true }
146
+ opt.on('', '--create-table-with-index') { options[:create_table_with_index] = true }
147
+
148
+ opt.on('', '--mysql-dump-auto-increment') do
149
+ options[:mysql_dump_auto_increment] = true
150
+ end
163
151
 
164
- opt.parse!
152
+ opt.on('-r', '--require LIBS', Array) { |v| v.each { |i| require i } }
153
+ opt.on('', '--log-file LOG_FILE') { |v| options[:log_file] = v }
154
+ opt.on('', '--verbose') { Ridgepole::Logger.verbose = true }
155
+ opt.on('', '--debug') { options[:debug] = true }
156
+ opt.on('', '--[no-]color') { |v| options[:color] = v }
165
157
 
166
- if !mode || (%i[apply export].include?(mode) && !config) || (options[:with_apply] && !config)
167
- puts opt.help
168
- exit 1
169
- end
170
- rescue StandardError => e
171
- warn("[ERROR] #{e.message}")
158
+ opt.on('-v', '--version') do
159
+ puts opt.ver
160
+ exit
161
+ end
172
162
 
173
- puts "\t" + e.backtrace.join("\n\t") unless e.is_a?(OptionParser::ParseError)
163
+ opt.parse!
174
164
 
165
+ if !mode || (%i[apply export].include?(mode) && !config) || (options[:with_apply] && !config)
166
+ puts opt.help
175
167
  exit 1
176
168
  end
169
+ rescue StandardError => e
170
+ warn("[ERROR] #{e.message}")
171
+
172
+ puts "\t" + e.backtrace.join("\n\t") unless e.is_a?(OptionParser::ParseError)
173
+
174
+ exit 1
177
175
  end
178
176
 
179
177
  begin
@@ -25,20 +25,18 @@ module Ridgepole
25
25
  readable = ready[0]
26
26
 
27
27
  readable.each do |f|
28
- begin
29
- data = f.read_nonblock(1024)
30
- next if data.nil?
31
-
32
- data.chomp!
33
-
34
- if f == stderr
35
- @logger.warn("[WARNING] #{script_basename}: #{data}")
36
- else
37
- @logger.info("#{script_basename}: #{data}")
38
- end
39
- rescue EOFError
40
- files.delete f
28
+ data = f.read_nonblock(1024)
29
+ next if data.nil?
30
+
31
+ data.chomp!
32
+
33
+ if f == stderr
34
+ @logger.warn("[WARNING] #{script_basename}: #{data}")
35
+ else
36
+ @logger.info("#{script_basename}: #{data}")
41
37
  end
38
+ rescue EOFError
39
+ files.delete f
42
40
  end
43
41
  end
44
42
  rescue EOFError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/ridgepole.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'appraisal', '>= 2.2.0'
31
31
  spec.add_development_dependency 'bundler'
32
- spec.add_development_dependency 'erbh', '>= 0.1.2'
32
+ spec.add_development_dependency 'erbh', '>= 0.2.1'
33
33
  spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
34
34
  spec.add_development_dependency 'hash_order_helper', '>= 0.1.6'
35
35
  spec.add_development_dependency 'mysql2'
@@ -38,9 +38,10 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'rspec', '>= 3.0.0'
39
39
  spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.1.3'
40
40
  spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
41
- spec.add_development_dependency 'rubocop', '1.9.1'
41
+ spec.add_development_dependency 'rubocop', '1.24.1'
42
42
  spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
43
43
  spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
44
44
  spec.add_development_dependency 'simplecov'
45
45
  spec.add_development_dependency 'simplecov-lcov'
46
+ spec.metadata['rubygems_mfa_required'] = 'true'
46
47
  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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-18 00:00:00.000000000 Z
11
+ date: 2022-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 0.1.2
81
+ version: 0.2.1
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: 0.1.2
88
+ version: 0.2.1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: hash_modern_inspect
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -204,14 +204,14 @@ dependencies:
204
204
  requirements:
205
205
  - - '='
206
206
  - !ruby/object:Gem::Version
207
- version: 1.9.1
207
+ version: 1.24.1
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - '='
213
213
  - !ruby/object:Gem::Version
214
- version: 1.9.1
214
+ version: 1.24.1
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: rubocop-rake
217
217
  requirement: !ruby/object:Gem::Requirement
@@ -319,7 +319,8 @@ files:
319
319
  homepage: https://github.com/ridgepole/ridgepole
320
320
  licenses:
321
321
  - MIT
322
- metadata: {}
322
+ metadata:
323
+ rubygems_mfa_required: 'true'
323
324
  post_install_message:
324
325
  rdoc_options: []
325
326
  require_paths: