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.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +38 -0
  3. data/Appraisals +2 -2
  4. data/README.md +3 -9
  5. data/Rakefile +7 -1
  6. data/bin/ridgepole +97 -108
  7. data/gemfiles/activerecord_5.2.gemfile +1 -1
  8. data/lib/ridgepole/cli/config.rb +43 -43
  9. data/lib/ridgepole/client.rb +65 -63
  10. data/lib/ridgepole/default_limit.rb +26 -24
  11. data/lib/ridgepole/delta.rb +367 -369
  12. data/lib/ridgepole/diff.rb +366 -377
  13. data/lib/ridgepole/dsl_parser.rb +22 -20
  14. data/lib/ridgepole/dsl_parser/context.rb +95 -93
  15. data/lib/ridgepole/dsl_parser/table_definition.rb +125 -123
  16. data/lib/ridgepole/dumper.rb +73 -71
  17. data/lib/ridgepole/execute_expander.rb +55 -55
  18. data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +3 -3
  19. data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
  20. data/lib/ridgepole/ext/pp_sort_hash.rb +14 -14
  21. data/lib/ridgepole/ext/schema_dumper.rb +1 -1
  22. data/lib/ridgepole/external_sql_executer.rb +20 -20
  23. data/lib/ridgepole/logger.rb +17 -15
  24. data/lib/ridgepole/migration_ext.rb +6 -8
  25. data/lib/ridgepole/schema_statements_ext.rb +3 -3
  26. data/lib/ridgepole/version.rb +1 -1
  27. data/ridgepole.gemspec +11 -10
  28. data/spec/cli_helper.rb +2 -2
  29. data/spec/erb_helper.rb +6 -2
  30. data/spec/hide_pending_formatter.rb +5 -4
  31. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +8 -8
  32. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +8 -8
  33. data/spec/mysql/bigint_pk/int_pk_spec.rb +13 -13
  34. data/spec/mysql/cli/config_spec.rb +52 -53
  35. data/spec/mysql/cli/ridgepole_spec.rb +111 -111
  36. data/spec/mysql/collation/collation_spec.rb +39 -39
  37. data/spec/mysql/comment/comment_spec.rb +36 -36
  38. data/spec/mysql/default_lambda/default_lambda_spec.rb +30 -30
  39. data/spec/mysql/diff/diff2_spec.rb +18 -18
  40. data/spec/mysql/diff/diff_spec.rb +11 -11
  41. data/spec/mysql/dump/dump_class_method_spec.rb +2 -2
  42. data/spec/mysql/dump/dump_some_tables_spec.rb +14 -14
  43. data/spec/mysql/dump/dump_spec.rb +2 -2
  44. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +3 -3
  45. data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -8
  46. data/spec/mysql/fk/migrate_change_fk_spec.rb +40 -40
  47. data/spec/mysql/fk/migrate_create_fk_spec.rb +40 -40
  48. data/spec/mysql/fk/migrate_drop_fk_spec.rb +60 -60
  49. data/spec/mysql/migrate/check_orphan_index_spec.rb +6 -6
  50. data/spec/mysql/migrate/migrate_add_column2_spec.rb +43 -43
  51. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +50 -50
  52. data/spec/mysql/migrate/migrate_add_column_spec.rb +11 -11
  53. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +8 -8
  54. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +11 -11
  55. data/spec/mysql/migrate/migrate_change_column2_spec.rb +20 -20
  56. data/spec/mysql/migrate/migrate_change_column3_spec.rb +60 -60
  57. data/spec/mysql/migrate/migrate_change_column4_spec.rb +16 -16
  58. data/spec/mysql/migrate/migrate_change_column5_spec.rb +24 -24
  59. data/spec/mysql/migrate/migrate_change_column6_spec.rb +40 -40
  60. data/spec/mysql/migrate/migrate_change_column7_spec.rb +4 -4
  61. data/spec/mysql/migrate/migrate_change_column8_spec.rb +9 -9
  62. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +48 -48
  63. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +16 -16
  64. data/spec/mysql/migrate/migrate_change_column_spec.rb +11 -11
  65. data/spec/mysql/migrate/migrate_change_index2_spec.rb +20 -20
  66. data/spec/mysql/migrate/migrate_change_index3_spec.rb +43 -43
  67. data/spec/mysql/migrate/migrate_change_index4_spec.rb +24 -24
  68. data/spec/mysql/migrate/migrate_change_index5_spec.rb +16 -16
  69. data/spec/mysql/migrate/migrate_change_index6_spec.rb +12 -12
  70. data/spec/mysql/migrate/migrate_change_index7_spec.rb +20 -20
  71. data/spec/mysql/migrate/migrate_change_index8_spec.rb +20 -20
  72. data/spec/mysql/migrate/migrate_change_index_spec.rb +17 -17
  73. data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +10 -10
  74. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +18 -18
  75. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +37 -37
  76. data/spec/mysql/migrate/migrate_create_index2_spec.rb +12 -12
  77. data/spec/mysql/migrate/migrate_create_index_spec.rb +11 -11
  78. data/spec/mysql/migrate/migrate_create_table_spec.rb +8 -8
  79. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +6 -6
  80. data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +12 -12
  81. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +11 -11
  82. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +9 -9
  83. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +12 -12
  84. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +10 -10
  85. data/spec/mysql/migrate/migrate_drop_column_spec.rb +11 -11
  86. data/spec/mysql/migrate/migrate_drop_index_spec.rb +11 -11
  87. data/spec/mysql/migrate/migrate_drop_table_spec.rb +8 -8
  88. data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +6 -6
  89. data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +6 -6
  90. data/spec/mysql/migrate/migrate_empty_spec.rb +4 -4
  91. data/spec/mysql/migrate/migrate_execute_spec.rb +55 -55
  92. data/spec/mysql/migrate/migrate_log_file_spec.rb +9 -9
  93. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +9 -9
  94. data/spec/mysql/migrate/migrate_noop_spec.rb +19 -19
  95. data/spec/mysql/migrate/migrate_primary_key_spec.rb +18 -18
  96. data/spec/mysql/migrate/migrate_rename_column_spec.rb +17 -17
  97. data/spec/mysql/migrate/migrate_rename_table_spec.rb +26 -26
  98. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +16 -16
  99. data/spec/mysql/migrate/migrate_same_spec.rb +4 -4
  100. data/spec/mysql/migrate/migrate_script_error_spec.rb +8 -8
  101. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +8 -8
  102. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +9 -9
  103. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +8 -8
  104. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +9 -9
  105. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +64 -64
  106. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +12 -12
  107. data/spec/mysql/migrate/migrate_with_tables_spec.rb +29 -29
  108. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +18 -18
  109. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +8 -8
  110. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +8 -8
  111. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +8 -8
  112. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
  113. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
  114. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
  115. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
  116. data/spec/mysql57/json/add_json_column_spec.rb +8 -8
  117. data/spec/mysql57/json/change_json_column_spec.rb +24 -24
  118. data/spec/mysql57/json/drop_json_column_spec.rb +8 -8
  119. data/spec/mysql57/virtual/add_virtual_column_spec.rb +9 -9
  120. data/spec/mysql57/virtual/change_virtual_column_spec.rb +9 -9
  121. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +9 -9
  122. data/spec/postgresql/diff/diff_spec.rb +18 -18
  123. data/spec/postgresql/dump/dump_spec.rb +2 -2
  124. data/spec/postgresql/fk/migrate_change_fk_spec.rb +24 -24
  125. data/spec/postgresql/fk/migrate_create_fk_spec.rb +40 -40
  126. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +44 -44
  127. data/spec/postgresql/migrate/migrate_add_column_spec.rb +21 -21
  128. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -2
  129. data/spec/postgresql/migrate/migrate_bigint_spec.rb +12 -12
  130. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +8 -8
  131. data/spec/postgresql/migrate/migrate_change_column_spec.rb +19 -19
  132. data/spec/postgresql/migrate/migrate_change_index_spec.rb +13 -13
  133. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +19 -19
  134. data/spec/postgresql/migrate/migrate_create_table_spec.rb +8 -8
  135. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +18 -18
  136. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -11
  137. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +12 -12
  138. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +8 -8
  139. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +11 -11
  140. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +8 -8
  141. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +8 -8
  142. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +97 -0
  143. data/spec/postgresql/migrate/migrate_references_spec.rb +24 -24
  144. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +11 -11
  145. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +16 -16
  146. data/spec/postgresql/migrate/migrate_same_spec.rb +4 -4
  147. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
  148. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
  149. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
  150. data/spec/processing_for_travis.rb +1 -1
  151. data/spec/spec_condition.rb +2 -2
  152. data/spec/spec_const.rb +9 -9
  153. data/spec/spec_helper.rb +21 -23
  154. 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(:args => ['-h'])
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 <<-EOS
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
- EOS
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(:args => ['-c', conf, '-e', conf, conf])
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 <<-EOS
72
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
75
+ MSG
76
76
  end
77
77
 
78
78
  specify 'not split with outfile' do
79
- Tempfile.open("#{File.basename __FILE__}.#{$$}") do |f|
80
- out, status = run_cli(:args => ['-c', conf, '-e', '-o', f.path])
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 <<-EOS
84
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
87
+ MSG
88
88
  end
89
89
  end
90
90
 
91
91
  specify 'not split with output stdout' do
92
- out, status = run_cli(:args => ['-c', conf, '-e', '-o', '-'])
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 <<-EOS
96
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
99
+ MSG
100
100
  end
101
101
 
102
102
  specify 'split' do
103
- out, status = run_cli(:args => ['-c', conf, '-e', '--split'])
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 <<-EOS
107
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
111
+ MSG
112
112
  end
113
113
 
114
114
  specify 'split with outdir' do
115
- Tempfile.open("#{File.basename __FILE__}.#{$$}") do |f|
116
- out, status = run_cli(:args => ['-c', conf, '-e', '--split', '-o', f.path, conf, conf])
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 <<-EOS
120
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
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(:args => ['-c', conf, '-a'])
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 <<-EOS
135
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
141
+ MSG
142
142
  end
143
143
 
144
144
  specify 'apply with conf file' do
145
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
146
- conf_file.puts <<-EOS
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
- EOS
149
+ YAML
150
150
  conf_file.flush
151
151
 
152
- out, status = run_cli(:args => ['-c', conf_file.path, '-a', '--debug'])
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 <<-EOS
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
- EOS
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__}.#{$$}", '.yml']) do |conf_file|
168
- conf_file.puts <<-EOS
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
- EOS
175
+ YAML
176
176
  conf_file.flush
177
177
 
178
- out, status = run_cli(:args => ['-c', conf_file.path, '-a', '--debug'])
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 <<-EOS
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
- EOS
188
+ MSG
189
189
  end
190
190
  end
191
191
 
192
192
  specify 'dry-run' do
193
- out, status = run_cli(:args => ['-c', conf, '-a', '--dry-run'])
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 <<-EOS
197
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false, :color=>false}])
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
- EOS
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(:args => ['-c', conf, '-a'])
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 <<-EOS
213
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
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
- EOS
218
+ MSG
219
219
  end
220
220
 
221
221
  specify 'dry-run' do
222
- out, status = run_cli(:args => ['-c', conf, '-a', '--dry-run'])
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 <<-EOS
226
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false, :color=>false}])
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
- EOS
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(:args => ['-c', conf, '-d', conf, conf])
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 <<-EOS
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}])
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
- EOS
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(:args => ['-c', conf, '-d', conf, conf])
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 <<-EOS
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}])
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
- EOS
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__}.#{$$}", '.yml']) do |conf_file|
283
- conf_file.puts <<-EOS
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
- EOS
286
+ YAML
287
287
  conf_file.flush
288
288
 
289
- out, status = run_cli(:args => ['-c', conf, '-d', conf_file.path, conf])
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 <<-EOS
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}])
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
- EOS
297
+ MSG
298
298
  end
299
299
  end
300
300
 
301
301
  specify '.yml (file2)' do
302
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
303
- conf_file.puts <<-EOS
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
- EOS
306
+ YAML
307
307
  conf_file.flush
308
308
 
309
- out, status = run_cli(:args => ['-c', conf, '-d', conf, conf_file.path])
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 <<-EOS
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}])
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
- EOS
317
+ MSG
318
318
  end
319
319
  end
320
320
 
321
321
  specify '.yml (development)' do
322
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
323
- conf_file.puts <<-EOS
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
- EOS
330
+ YAML
331
331
  conf_file.flush
332
332
 
333
- out, status = run_cli(:args => ['-c', conf, '-d', conf_file.path, conf])
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 <<-EOS
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}])
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
- EOS
341
+ MSG
342
342
  end
343
343
  end
344
344
 
345
345
  specify '.yml (production)' do
346
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yml']) do |conf_file|
347
- conf_file.puts <<-EOS
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
- EOS
354
+ YAML
355
355
  conf_file.flush
356
356
 
357
- out, status = run_cli(:args => ['-c', conf, '-d', conf_file.path, conf, '-E', :production])
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 <<-EOS
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}])
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
- EOS
365
+ MSG
366
366
  end
367
367
  end
368
368
 
369
369
  specify '.yaml' do
370
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.yaml']) do |conf_file|
371
- conf_file.puts <<-EOS
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
- EOS
374
+ YAML
375
375
  conf_file.flush
376
376
 
377
- out, status = run_cli(:args => ['-c', conf, '-d', conf_file.path, conf])
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 <<-EOS
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}])
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
- EOS
385
+ MSG
386
386
  end
387
387
  end
388
388
 
389
389
  specify '.rb' do
390
- Tempfile.open(["#{File.basename __FILE__}.#{$$}", '.rb']) do |conf_file|
391
- conf_file.puts <<-EOS
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
- EOS
394
+ RUBY
395
395
  conf_file.flush
396
396
 
397
- out, status = run_cli(:args => ['-c', conf, '-d', conf_file.path, conf])
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 <<-EOS
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}])
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
- EOS
405
+ MSG
406
406
  end
407
407
  end
408
408
  end