ridgepole 0.7.3.beta → 0.7.3.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -0
- data/Appraisals +2 -2
- data/README.md +3 -9
- data/Rakefile +7 -1
- data/bin/ridgepole +97 -108
- data/gemfiles/activerecord_5.2.gemfile +1 -1
- data/lib/ridgepole/cli/config.rb +43 -43
- data/lib/ridgepole/client.rb +65 -63
- data/lib/ridgepole/default_limit.rb +26 -24
- data/lib/ridgepole/delta.rb +367 -369
- data/lib/ridgepole/diff.rb +366 -377
- data/lib/ridgepole/dsl_parser.rb +22 -20
- data/lib/ridgepole/dsl_parser/context.rb +95 -93
- data/lib/ridgepole/dsl_parser/table_definition.rb +125 -123
- data/lib/ridgepole/dumper.rb +73 -71
- data/lib/ridgepole/execute_expander.rb +55 -55
- data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +3 -3
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
- data/lib/ridgepole/ext/pp_sort_hash.rb +14 -14
- data/lib/ridgepole/ext/schema_dumper.rb +1 -1
- data/lib/ridgepole/external_sql_executer.rb +20 -20
- data/lib/ridgepole/logger.rb +17 -15
- data/lib/ridgepole/migration_ext.rb +6 -8
- data/lib/ridgepole/schema_statements_ext.rb +3 -3
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +11 -10
- data/spec/cli_helper.rb +2 -2
- data/spec/erb_helper.rb +6 -2
- data/spec/hide_pending_formatter.rb +5 -4
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +8 -8
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +8 -8
- data/spec/mysql/bigint_pk/int_pk_spec.rb +13 -13
- data/spec/mysql/cli/config_spec.rb +52 -53
- data/spec/mysql/cli/ridgepole_spec.rb +111 -111
- data/spec/mysql/collation/collation_spec.rb +39 -39
- data/spec/mysql/comment/comment_spec.rb +36 -36
- data/spec/mysql/default_lambda/default_lambda_spec.rb +30 -30
- data/spec/mysql/diff/diff2_spec.rb +18 -18
- data/spec/mysql/diff/diff_spec.rb +11 -11
- data/spec/mysql/dump/dump_class_method_spec.rb +2 -2
- data/spec/mysql/dump/dump_some_tables_spec.rb +14 -14
- data/spec/mysql/dump/dump_spec.rb +2 -2
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +3 -3
- data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -8
- data/spec/mysql/fk/migrate_change_fk_spec.rb +40 -40
- data/spec/mysql/fk/migrate_create_fk_spec.rb +40 -40
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +60 -60
- data/spec/mysql/migrate/check_orphan_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +43 -43
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +50 -50
- data/spec/mysql/migrate/migrate_add_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +60 -60
- data/spec/mysql/migrate/migrate_change_column4_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +24 -24
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +40 -40
- data/spec/mysql/migrate/migrate_change_column7_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_column8_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +48 -48
- data/spec/mysql/migrate/migrate_change_column_float_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +43 -43
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +24 -24
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_index_spec.rb +17 -17
- data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +10 -10
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +37 -37
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_create_index_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_create_table_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +10 -10
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_empty_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_execute_spec.rb +55 -55
- data/spec/mysql/migrate/migrate_log_file_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_noop_spec.rb +19 -19
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +17 -17
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +26 -26
- data/spec/mysql/migrate/migrate_same_default_null_spec.rb +16 -16
- data/spec/mysql/migrate/migrate_same_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_script_error_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +9 -9
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +64 -64
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +29 -29
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +18 -18
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +8 -8
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +8 -8
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +8 -8
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
- data/spec/mysql57/json/add_json_column_spec.rb +8 -8
- data/spec/mysql57/json/change_json_column_spec.rb +24 -24
- data/spec/mysql57/json/drop_json_column_spec.rb +8 -8
- data/spec/mysql57/virtual/add_virtual_column_spec.rb +9 -9
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +9 -9
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +9 -9
- data/spec/postgresql/diff/diff_spec.rb +18 -18
- data/spec/postgresql/dump/dump_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +24 -24
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +40 -40
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +44 -44
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +21 -21
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +12 -12
- data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +19 -19
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +13 -13
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +19 -19
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +18 -18
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +12 -12
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_primary_key_spec.rb +97 -0
- data/spec/postgresql/migrate/migrate_references_spec.rb +24 -24
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +11 -11
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +16 -16
- data/spec/postgresql/migrate/migrate_same_spec.rb +4 -4
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
- data/spec/processing_for_travis.rb +1 -1
- data/spec/spec_condition.rb +2 -2
- data/spec/spec_const.rb +9 -9
- data/spec/spec_helper.rb +21 -23
- metadata +54 -37
@@ -8,11 +8,11 @@ describe 'ridgepole' do
|
|
8
8
|
|
9
9
|
context 'when help' do
|
10
10
|
specify do
|
11
|
-
out, status = run_cli(:
|
11
|
+
out, status = run_cli(args: ['-h'])
|
12
12
|
out = out.gsub(/Usage: .*\n/, '')
|
13
13
|
|
14
14
|
expect(status.success?).to be_truthy
|
15
|
-
expect(out).to match_fuzzy <<-
|
15
|
+
expect(out).to match_fuzzy <<-MSG
|
16
16
|
-c, --config CONF_OR_FILE
|
17
17
|
-E, --env ENVIRONMENT
|
18
18
|
-a, --apply
|
@@ -59,171 +59,171 @@ describe 'ridgepole' do
|
|
59
59
|
--debug
|
60
60
|
--[no-]color
|
61
61
|
-v, --version
|
62
|
-
|
62
|
+
MSG
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'when export' do
|
67
67
|
specify 'not split' do
|
68
|
-
out, status = run_cli(:
|
68
|
+
out, status = run_cli(args: ['-c', conf, '-e', conf, conf])
|
69
69
|
|
70
70
|
expect(status.success?).to be_truthy
|
71
|
-
expect(out).to match_fuzzy <<-
|
72
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
71
|
+
expect(out).to match_fuzzy <<-MSG
|
72
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
73
73
|
# Export Schema
|
74
74
|
Ridgepole::Client#dump
|
75
|
-
|
75
|
+
MSG
|
76
76
|
end
|
77
77
|
|
78
78
|
specify 'not split with outfile' do
|
79
|
-
Tempfile.open("#{File.basename __FILE__}.#{
|
80
|
-
out, status = run_cli(:
|
79
|
+
Tempfile.open("#{File.basename __FILE__}.#{$PROCESS_ID}") do |f|
|
80
|
+
out, status = run_cli(args: ['-c', conf, '-e', '-o', f.path])
|
81
81
|
|
82
82
|
expect(status.success?).to be_truthy
|
83
|
-
expect(out).to match_fuzzy <<-
|
84
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
83
|
+
expect(out).to match_fuzzy <<-MSG
|
84
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
85
85
|
Export Schema to `#{f.path}`
|
86
86
|
Ridgepole::Client#dump
|
87
|
-
|
87
|
+
MSG
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
specify 'not split with output stdout' do
|
92
|
-
out, status = run_cli(:
|
92
|
+
out, status = run_cli(args: ['-c', conf, '-e', '-o', '-'])
|
93
93
|
|
94
94
|
expect(status.success?).to be_truthy
|
95
|
-
expect(out).to match_fuzzy <<-
|
96
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
95
|
+
expect(out).to match_fuzzy <<-MSG
|
96
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
97
97
|
# Export Schema
|
98
98
|
Ridgepole::Client#dump
|
99
|
-
|
99
|
+
MSG
|
100
100
|
end
|
101
101
|
|
102
102
|
specify 'split' do
|
103
|
-
out, status = run_cli(:
|
103
|
+
out, status = run_cli(args: ['-c', conf, '-e', '--split'])
|
104
104
|
|
105
105
|
expect(status.success?).to be_truthy
|
106
|
-
expect(out).to match_fuzzy <<-
|
107
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
106
|
+
expect(out).to match_fuzzy <<-MSG
|
107
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
108
108
|
Export Schema
|
109
109
|
Ridgepole::Client#dump
|
110
110
|
write `Schemafile`
|
111
|
-
|
111
|
+
MSG
|
112
112
|
end
|
113
113
|
|
114
114
|
specify 'split with outdir' do
|
115
|
-
Tempfile.open("#{File.basename __FILE__}.#{
|
116
|
-
out, status = run_cli(:
|
115
|
+
Tempfile.open("#{File.basename __FILE__}.#{$PROCESS_ID}") do |f|
|
116
|
+
out, status = run_cli(args: ['-c', conf, '-e', '--split', '-o', f.path, conf, conf])
|
117
117
|
|
118
118
|
expect(status.success?).to be_truthy
|
119
|
-
expect(out).to match_fuzzy <<-
|
120
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
119
|
+
expect(out).to match_fuzzy <<-MSG
|
120
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
121
121
|
Export Schema
|
122
122
|
Ridgepole::Client#dump
|
123
123
|
write `#{f.path}`
|
124
|
-
|
124
|
+
MSG
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
129
|
context 'when apply' do
|
130
130
|
specify 'apply' do
|
131
|
-
out, status = run_cli(:
|
131
|
+
out, status = run_cli(args: ['-c', conf, '-a'])
|
132
132
|
|
133
133
|
expect(status.success?).to be_truthy
|
134
|
-
expect(out).to match_fuzzy <<-
|
135
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
134
|
+
expect(out).to match_fuzzy <<-MSG
|
135
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
136
136
|
Apply `Schemafile`
|
137
137
|
Ridgepole::Client#diff
|
138
138
|
Ridgepole::Delta#differ?
|
139
139
|
Ridgepole::Delta#migrate
|
140
140
|
No change
|
141
|
-
|
141
|
+
MSG
|
142
142
|
end
|
143
143
|
|
144
144
|
specify 'apply with conf file' do
|
145
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
146
|
-
conf_file.puts <<-
|
145
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
146
|
+
conf_file.puts <<-YAML
|
147
147
|
adapter: mysql2
|
148
148
|
database: ridgepole_test_for_conf_file
|
149
|
-
|
149
|
+
YAML
|
150
150
|
conf_file.flush
|
151
151
|
|
152
|
-
out, status = run_cli(:
|
152
|
+
out, status = run_cli(args: ['-c', conf_file.path, '-a', '--debug'])
|
153
153
|
|
154
154
|
expect(status.success?).to be_truthy
|
155
|
-
expect(out).to match_fuzzy <<-
|
155
|
+
expect(out).to match_fuzzy <<-MSG
|
156
156
|
Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>true, :color=>false}])
|
157
157
|
Apply `Schemafile`
|
158
158
|
Ridgepole::Client#diff
|
159
159
|
Ridgepole::Delta#differ?
|
160
160
|
Ridgepole::Delta#migrate
|
161
161
|
No change
|
162
|
-
|
162
|
+
MSG
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
specify 'apply with conf file (production)' do
|
167
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
168
|
-
conf_file.puts <<-
|
167
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
168
|
+
conf_file.puts <<-YAML
|
169
169
|
development:
|
170
170
|
adapter: mysql2
|
171
171
|
database: ridgepole_development
|
172
172
|
production:
|
173
173
|
adapter: mysql2
|
174
174
|
database: ridgepole_production
|
175
|
-
|
175
|
+
YAML
|
176
176
|
conf_file.flush
|
177
177
|
|
178
|
-
out, status = run_cli(:
|
178
|
+
out, status = run_cli(args: ['-c', conf_file.path, '-a', '--debug'])
|
179
179
|
|
180
180
|
expect(status.success?).to be_truthy
|
181
|
-
expect(out).to match_fuzzy <<-
|
181
|
+
expect(out).to match_fuzzy <<-MSG
|
182
182
|
Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, {:dry_run=>false, :debug=>true, :color=>false}])
|
183
183
|
Apply `Schemafile`
|
184
184
|
Ridgepole::Client#diff
|
185
185
|
Ridgepole::Delta#differ?
|
186
186
|
Ridgepole::Delta#migrate
|
187
187
|
No change
|
188
|
-
|
188
|
+
MSG
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
192
|
specify 'dry-run' do
|
193
|
-
out, status = run_cli(:
|
193
|
+
out, status = run_cli(args: ['-c', conf, '-a', '--dry-run'])
|
194
194
|
|
195
195
|
expect(status.success?).to be_truthy
|
196
|
-
expect(out).to match_fuzzy <<-
|
197
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
196
|
+
expect(out).to match_fuzzy <<-MSG
|
197
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>true, :debug=>false, :color=>false}])
|
198
198
|
Apply `Schemafile` (dry-run)
|
199
199
|
Ridgepole::Client#diff
|
200
200
|
Ridgepole::Delta#differ?
|
201
201
|
No change
|
202
|
-
|
202
|
+
MSG
|
203
203
|
end
|
204
204
|
|
205
205
|
context 'when differ true' do
|
206
206
|
let(:differ) { true }
|
207
207
|
|
208
208
|
specify 'apply' do
|
209
|
-
out, status = run_cli(:
|
209
|
+
out, status = run_cli(args: ['-c', conf, '-a'])
|
210
210
|
|
211
211
|
expect(status.success?).to be_truthy
|
212
|
-
expect(out).to match_fuzzy <<-
|
213
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
212
|
+
expect(out).to match_fuzzy <<-MSG
|
213
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
214
214
|
Apply `Schemafile`
|
215
215
|
Ridgepole::Client#diff
|
216
216
|
Ridgepole::Delta#differ?
|
217
217
|
Ridgepole::Delta#migrate
|
218
|
-
|
218
|
+
MSG
|
219
219
|
end
|
220
220
|
|
221
221
|
specify 'dry-run' do
|
222
|
-
out, status = run_cli(:
|
222
|
+
out, status = run_cli(args: ['-c', conf, '-a', '--dry-run'])
|
223
223
|
|
224
224
|
expect(status.success?).to be_truthy
|
225
|
-
expect(out).to match_fuzzy <<-
|
226
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
225
|
+
expect(out).to match_fuzzy <<-MSG
|
226
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>true, :debug=>false, :color=>false}])
|
227
227
|
Apply `Schemafile` (dry-run)
|
228
228
|
Ridgepole::Client#diff
|
229
229
|
Ridgepole::Delta#differ?
|
@@ -235,35 +235,35 @@ describe 'ridgepole' do
|
|
235
235
|
Ridgepole::Delta#migrate
|
236
236
|
# create_table :table do
|
237
237
|
# end
|
238
|
-
|
238
|
+
MSG
|
239
239
|
end
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
243
|
context 'when diff' do
|
244
244
|
specify do
|
245
|
-
out, status = run_cli(:
|
245
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf, conf])
|
246
246
|
|
247
247
|
expect(status.success?).to be_truthy
|
248
|
-
expect(out).to match_fuzzy <<-
|
249
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
250
|
-
Ridgepole::Client.diff([#{conn_spec_str(
|
248
|
+
expect(out).to match_fuzzy <<-MSG
|
249
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
250
|
+
Ridgepole::Client.diff([#{conn_spec_str('ridgepole_test')}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
251
251
|
Ridgepole::Delta#differ?
|
252
|
-
|
252
|
+
MSG
|
253
253
|
end
|
254
254
|
|
255
255
|
context 'when differ true' do
|
256
256
|
let(:differ) { true }
|
257
257
|
|
258
258
|
specify do
|
259
|
-
out, status = run_cli(:
|
259
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf, conf])
|
260
260
|
|
261
261
|
# Exit code 1 if there is a difference
|
262
262
|
expect(status.success?).to be_falsey
|
263
263
|
|
264
|
-
expect(out).to match_fuzzy <<-
|
265
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
266
|
-
Ridgepole::Client.diff([#{conn_spec_str(
|
264
|
+
expect(out).to match_fuzzy <<-MSG
|
265
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
266
|
+
Ridgepole::Client.diff([#{conn_spec_str('ridgepole_test')}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
267
267
|
Ridgepole::Delta#differ?
|
268
268
|
Ridgepole::Delta#script
|
269
269
|
Ridgepole::Delta#script
|
@@ -273,136 +273,136 @@ describe 'ridgepole' do
|
|
273
273
|
Ridgepole::Delta#migrate
|
274
274
|
# create_table :table do
|
275
275
|
# end
|
276
|
-
|
276
|
+
MSG
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
280
|
context 'when config file' do
|
281
281
|
specify '.yml' do
|
282
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
283
|
-
conf_file.puts <<-
|
282
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
283
|
+
conf_file.puts <<-YAML
|
284
284
|
adapter: mysql2
|
285
285
|
database: ridgepole_test_for_conf_file
|
286
|
-
|
286
|
+
YAML
|
287
287
|
conf_file.flush
|
288
288
|
|
289
|
-
out, status = run_cli(:
|
289
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf_file.path, conf])
|
290
290
|
|
291
291
|
expect(status.success?).to be_truthy
|
292
292
|
|
293
|
-
expect(out).to match_fuzzy <<-
|
294
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
295
|
-
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str(
|
293
|
+
expect(out).to match_fuzzy <<-MSG
|
294
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
295
|
+
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
296
296
|
Ridgepole::Delta#differ?
|
297
|
-
|
297
|
+
MSG
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
301
|
specify '.yml (file2)' do
|
302
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
303
|
-
conf_file.puts <<-
|
302
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
303
|
+
conf_file.puts <<-YAML
|
304
304
|
adapter: mysql2
|
305
305
|
database: ridgepole_test_for_conf_file
|
306
|
-
|
306
|
+
YAML
|
307
307
|
conf_file.flush
|
308
308
|
|
309
|
-
out, status = run_cli(:
|
309
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf, conf_file.path])
|
310
310
|
|
311
311
|
expect(status.success?).to be_truthy
|
312
312
|
|
313
|
-
expect(out).to match_fuzzy <<-
|
314
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
315
|
-
Ridgepole::Client.diff([#{conn_spec_str(
|
313
|
+
expect(out).to match_fuzzy <<-MSG
|
314
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
315
|
+
Ridgepole::Client.diff([#{conn_spec_str('ridgepole_test')}, {"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>false, :color=>false}])
|
316
316
|
Ridgepole::Delta#differ?
|
317
|
-
|
317
|
+
MSG
|
318
318
|
end
|
319
319
|
end
|
320
320
|
|
321
321
|
specify '.yml (development)' do
|
322
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
323
|
-
conf_file.puts <<-
|
322
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
323
|
+
conf_file.puts <<-YAML
|
324
324
|
development:
|
325
325
|
adapter: mysql2
|
326
326
|
database: ridgepole_development
|
327
327
|
production:
|
328
328
|
adapter: mysql2
|
329
329
|
database: ridgepole_production
|
330
|
-
|
330
|
+
YAML
|
331
331
|
conf_file.flush
|
332
332
|
|
333
|
-
out, status = run_cli(:
|
333
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf_file.path, conf])
|
334
334
|
|
335
335
|
expect(status.success?).to be_truthy
|
336
336
|
|
337
|
-
expect(out).to match_fuzzy <<-
|
338
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
339
|
-
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, #{conn_spec_str(
|
337
|
+
expect(out).to match_fuzzy <<-MSG
|
338
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
339
|
+
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
340
340
|
Ridgepole::Delta#differ?
|
341
|
-
|
341
|
+
MSG
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
345
|
specify '.yml (production)' do
|
346
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
347
|
-
conf_file.puts <<-
|
346
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yml']) do |conf_file|
|
347
|
+
conf_file.puts <<-YAML
|
348
348
|
development:
|
349
349
|
adapter: mysql2
|
350
350
|
database: ridgepole_development
|
351
351
|
production:
|
352
352
|
adapter: mysql2
|
353
353
|
database: ridgepole_production
|
354
|
-
|
354
|
+
YAML
|
355
355
|
conf_file.flush
|
356
356
|
|
357
|
-
out, status = run_cli(:
|
357
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf_file.path, conf, '-E', :production])
|
358
358
|
|
359
359
|
expect(status.success?).to be_truthy
|
360
360
|
|
361
|
-
expect(out).to match_fuzzy <<-
|
362
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
363
|
-
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_production"}, #{conn_spec_str(
|
361
|
+
expect(out).to match_fuzzy <<-MSG
|
362
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
363
|
+
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_production"}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
364
364
|
Ridgepole::Delta#differ?
|
365
|
-
|
365
|
+
MSG
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
369
|
specify '.yaml' do
|
370
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
371
|
-
conf_file.puts <<-
|
370
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.yaml']) do |conf_file|
|
371
|
+
conf_file.puts <<-YAML
|
372
372
|
adapter: mysql2
|
373
373
|
database: ridgepole_test_for_conf_file
|
374
|
-
|
374
|
+
YAML
|
375
375
|
conf_file.flush
|
376
376
|
|
377
|
-
out, status = run_cli(:
|
377
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf_file.path, conf])
|
378
378
|
|
379
379
|
expect(status.success?).to be_truthy
|
380
380
|
|
381
|
-
expect(out).to match_fuzzy <<-
|
382
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
383
|
-
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str(
|
381
|
+
expect(out).to match_fuzzy <<-MSG
|
382
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
383
|
+
Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
384
384
|
Ridgepole::Delta#differ?
|
385
|
-
|
385
|
+
MSG
|
386
386
|
end
|
387
387
|
end
|
388
388
|
|
389
389
|
specify '.rb' do
|
390
|
-
Tempfile.open(["#{File.basename __FILE__}.#{
|
391
|
-
conf_file.puts <<-
|
390
|
+
Tempfile.open(["#{File.basename __FILE__}.#{$PROCESS_ID}", '.rb']) do |conf_file|
|
391
|
+
conf_file.puts <<-RUBY
|
392
392
|
create_table :table do
|
393
393
|
end
|
394
|
-
|
394
|
+
RUBY
|
395
395
|
conf_file.flush
|
396
396
|
|
397
|
-
out, status = run_cli(:
|
397
|
+
out, status = run_cli(args: ['-c', conf, '-d', conf_file.path, conf])
|
398
398
|
|
399
399
|
expect(status.success?).to be_truthy
|
400
400
|
|
401
|
-
expect(out).to match_fuzzy <<-
|
402
|
-
Ridgepole::Client#initialize([#{conn_spec_str(
|
403
|
-
Ridgepole::Client.diff([#{conf_file.path}, #{conn_spec_str(
|
401
|
+
expect(out).to match_fuzzy <<-MSG
|
402
|
+
Ridgepole::Client#initialize([#{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
403
|
+
Ridgepole::Client.diff([#{conf_file.path}, #{conn_spec_str('ridgepole_test')}, {:dry_run=>false, :debug=>false, :color=>false}])
|
404
404
|
Ridgepole::Delta#differ?
|
405
|
-
|
405
|
+
MSG
|
406
406
|
end
|
407
407
|
end
|
408
408
|
end
|