ridgepole 0.7.0.beta2 → 0.7.0.beta3

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: 2de5f94990fb6c37ed124d73e965aefb87b65bf8
4
- data.tar.gz: ed39dba231ba693c1631ea4d94f5d321004773ce
3
+ metadata.gz: 1d0a325ded7085507a9847f39578c9cb41b223cd
4
+ data.tar.gz: 4be25ac77f54a423898e514bed609aa473bd1cbf
5
5
  SHA512:
6
- metadata.gz: 4909ca73aee2594f904db3fa9dba647f812746265f88e875f951733636c9fdb9a5dc8b2ad694774e30d51e1fea9701afe220e21a1a3766a03e76ddc797dd4af6
7
- data.tar.gz: 1861b9094313e0e668687f27ab5854798a97db35136cd10c8d0ab9cd88397940d01fb333f0cebe421c6d1e2405d7b6a5028a8aa4cb0071c2a5ccfa2c91fd010b
6
+ metadata.gz: 640d8aa9837c5d6b6c275b7c195f232e179c42ceb616f7828b2dd1344f8f10dc6705658b33e3275e5621bc1c713c79b41a573327df9b5f34bd7c5be895694331
7
+ data.tar.gz: 5f4f8357cfaeb18f818f23a55712dc2c24d7f10f0396593d6c5acca52b0634fe3534fdcea15781fbab047e3b98f39a7f3066d6302c6e69018fd73afd4718a9b2
data/README.md CHANGED
@@ -8,7 +8,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
8
8
  [![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)
9
9
  [![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.6)](https://travis-ci.org/winebarrel/ridgepole)
10
10
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.6)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.6)
11
- [![Edge Version](https://img.shields.io/badge/edge%20version-0.7.0.beta-green.svg)](https://rubygems.org/gems/ridgepole/versions/0.7.0.beta2)
11
+
12
+ [![Edge Version](https://img.shields.io/badge/edge_version-0.7.0.beta3-brightgreen.svg)](https://rubygems.org/gems/ridgepole/versions/0.7.0.beta3)
12
13
  [![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.7)](https://travis-ci.org/winebarrel/ridgepole)
13
14
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.7)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.7)
14
15
 
@@ -129,6 +130,7 @@ Usage: ridgepole [options]
129
130
  --log-file LOG_FILE
130
131
  --verbose
131
132
  --debug
133
+ --[no-]color
132
134
  -v, --version
133
135
  ```
134
136
 
data/bin/ridgepole CHANGED
@@ -35,6 +35,7 @@ exit_code = 0
35
35
  options = {
36
36
  :dry_run => false,
37
37
  :debug => false,
38
+ :color => $stdout.tty?,
38
39
  }
39
40
 
40
41
  set_mode = proc do |m|
@@ -119,6 +120,7 @@ ARGV.options do |opt|
119
120
  opt.on('' , '--log-file LOG_FILE') {|v| options[:log_file] = v }
120
121
  opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
121
122
  opt.on('' , '--debug') { options[:debug] = true }
123
+ opt.on('' , '--[no-]color') {|v| options[:color] = v }
122
124
 
123
125
  opt.on('-v', '--version') {
124
126
  puts opt.ver
@@ -145,6 +147,7 @@ begin
145
147
  client = Ridgepole::Client.new(Ridgepole::Config.load(config, env), options) if config
146
148
 
147
149
  ActiveRecord::Base.logger = logger
150
+ ActiveSupport::LogSubscriber.colorize_logging = options[:color]
148
151
 
149
152
  case mode
150
153
  when :export
@@ -413,7 +413,7 @@ class Ridgepole::Diff
413
413
  :diff => '-u'
414
414
  )
415
415
 
416
- diffy.to_s(:text).gsub(/\s+\z/m, '')
416
+ diffy.to_s(@options[:color] ? :color : :text).gsub(/\s+\z/m, '')
417
417
  end
418
418
 
419
419
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.7.0.beta2'
2
+ VERSION = '0.7.0.beta3'
3
3
  end
data/lib/ridgepole.rb CHANGED
@@ -10,6 +10,7 @@ require 'active_support'
10
10
  require 'active_support/core_ext'
11
11
 
12
12
  require 'diffy'
13
+ require 'pp_sort_hash'
13
14
 
14
15
  module Ridgepole; end
15
16
 
data/ridgepole.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'activerecord', '>= 5.0.1', '< 6'
24
24
  spec.add_dependency 'diffy'
25
+ spec.add_dependency 'pp_sort_hash'
25
26
  spec.add_development_dependency 'bundler'
26
27
  spec.add_development_dependency 'rake'
27
28
  spec.add_development_dependency 'rspec', '>= 3.0.0'
@@ -50,6 +50,7 @@ describe 'ridgepole' do
50
50
  --log-file LOG_FILE
51
51
  --verbose
52
52
  --debug
53
+ --[no-]color
53
54
  -v, --version
54
55
  EOS
55
56
  end
@@ -61,7 +62,7 @@ describe 'ridgepole' do
61
62
 
62
63
  expect(status.success?).to be_truthy
63
64
  expect(out).to match_fuzzy <<-EOS
64
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
65
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
65
66
  # Export Schema
66
67
  Ridgepole::Client#dump
67
68
  EOS
@@ -73,7 +74,7 @@ describe 'ridgepole' do
73
74
 
74
75
  expect(status.success?).to be_truthy
75
76
  expect(out).to match_fuzzy <<-EOS
76
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
77
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
77
78
  Export Schema to `#{f.path}`
78
79
  Ridgepole::Client#dump
79
80
  EOS
@@ -85,7 +86,7 @@ describe 'ridgepole' do
85
86
 
86
87
  expect(status.success?).to be_truthy
87
88
  expect(out).to match_fuzzy <<-EOS
88
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
89
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
89
90
  # Export Schema
90
91
  Ridgepole::Client#dump
91
92
  EOS
@@ -96,7 +97,7 @@ describe 'ridgepole' do
96
97
 
97
98
  expect(status.success?).to be_truthy
98
99
  expect(out).to match_fuzzy <<-EOS
99
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
100
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
100
101
  Export Schema
101
102
  Ridgepole::Client#dump
102
103
  write `Schemafile`
@@ -109,7 +110,7 @@ describe 'ridgepole' do
109
110
 
110
111
  expect(status.success?).to be_truthy
111
112
  expect(out).to match_fuzzy <<-EOS
112
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
113
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
113
114
  Export Schema
114
115
  Ridgepole::Client#dump
115
116
  write `#{f.path}`
@@ -124,7 +125,7 @@ describe 'ridgepole' do
124
125
 
125
126
  expect(status.success?).to be_truthy
126
127
  expect(out).to match_fuzzy <<-EOS
127
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
128
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
128
129
  Apply `Schemafile`
129
130
  Ridgepole::Client#diff
130
131
  Ridgepole::Delta#differ?
@@ -145,7 +146,7 @@ describe 'ridgepole' do
145
146
 
146
147
  expect(status.success?).to be_truthy
147
148
  expect(out).to match_fuzzy <<-EOS
148
- Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>true}])
149
+ Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>true, :color=>false}])
149
150
  Apply `Schemafile`
150
151
  Ridgepole::Client#diff
151
152
  Ridgepole::Delta#differ?
@@ -171,7 +172,7 @@ describe 'ridgepole' do
171
172
 
172
173
  expect(status.success?).to be_truthy
173
174
  expect(out).to match_fuzzy <<-EOS
174
- Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, {:dry_run=>false, :debug=>true}])
175
+ Ridgepole::Client#initialize([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, {:dry_run=>false, :debug=>true, :color=>false}])
175
176
  Apply `Schemafile`
176
177
  Ridgepole::Client#diff
177
178
  Ridgepole::Delta#differ?
@@ -186,7 +187,7 @@ describe 'ridgepole' do
186
187
 
187
188
  expect(status.success?).to be_truthy
188
189
  expect(out).to match_fuzzy <<-EOS
189
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false}])
190
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false, :color=>false}])
190
191
  Apply `Schemafile` (dry-run)
191
192
  Ridgepole::Client#diff
192
193
  Ridgepole::Delta#differ?
@@ -202,7 +203,7 @@ describe 'ridgepole' do
202
203
 
203
204
  expect(status.success?).to be_truthy
204
205
  expect(out).to match_fuzzy <<-EOS
205
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
206
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
206
207
  Apply `Schemafile`
207
208
  Ridgepole::Client#diff
208
209
  Ridgepole::Delta#differ?
@@ -215,7 +216,7 @@ describe 'ridgepole' do
215
216
 
216
217
  expect(status.success?).to be_truthy
217
218
  expect(out).to match_fuzzy <<-EOS
218
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false}])
219
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>true, :debug=>false, :color=>false}])
219
220
  Apply `Schemafile` (dry-run)
220
221
  Ridgepole::Client#diff
221
222
  Ridgepole::Delta#differ?
@@ -238,8 +239,8 @@ describe 'ridgepole' do
238
239
 
239
240
  expect(status.success?).to be_truthy
240
241
  expect(out).to match_fuzzy <<-EOS
241
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
242
- Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
242
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
243
+ Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
243
244
  Ridgepole::Delta#differ?
244
245
  EOS
245
246
  end
@@ -254,8 +255,8 @@ describe 'ridgepole' do
254
255
  expect(status.success?).to be_falsey
255
256
 
256
257
  expect(out).to match_fuzzy <<-EOS
257
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
258
- Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
258
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
259
+ Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
259
260
  Ridgepole::Delta#differ?
260
261
  Ridgepole::Delta#script
261
262
  Ridgepole::Delta#script
@@ -283,8 +284,8 @@ describe 'ridgepole' do
283
284
  expect(status.success?).to be_truthy
284
285
 
285
286
  expect(out).to match_fuzzy <<-EOS
286
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
287
- Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
287
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
288
+ Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
288
289
  Ridgepole::Delta#differ?
289
290
  EOS
290
291
  end
@@ -303,8 +304,8 @@ describe 'ridgepole' do
303
304
  expect(status.success?).to be_truthy
304
305
 
305
306
  expect(out).to match_fuzzy <<-EOS
306
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
307
- Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, {"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>false}])
307
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
308
+ Ridgepole::Client.diff([#{conn_spec_str("ridgepole_test")}, {"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, {:dry_run=>false, :debug=>false, :color=>false}])
308
309
  Ridgepole::Delta#differ?
309
310
  EOS
310
311
  end
@@ -327,8 +328,8 @@ describe 'ridgepole' do
327
328
  expect(status.success?).to be_truthy
328
329
 
329
330
  expect(out).to match_fuzzy <<-EOS
330
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
331
- Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
331
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
332
+ Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_development"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
332
333
  Ridgepole::Delta#differ?
333
334
  EOS
334
335
  end
@@ -351,8 +352,8 @@ describe 'ridgepole' do
351
352
  expect(status.success?).to be_truthy
352
353
 
353
354
  expect(out).to match_fuzzy <<-EOS
354
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
355
- Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_production"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
355
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
356
+ Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_production"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
356
357
  Ridgepole::Delta#differ?
357
358
  EOS
358
359
  end
@@ -371,8 +372,8 @@ describe 'ridgepole' do
371
372
  expect(status.success?).to be_truthy
372
373
 
373
374
  expect(out).to match_fuzzy <<-EOS
374
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
375
- Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
375
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
376
+ Ridgepole::Client.diff([{"adapter"=>"mysql2", "database"=>"ridgepole_test_for_conf_file"}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
376
377
  Ridgepole::Delta#differ?
377
378
  EOS
378
379
  end
@@ -391,8 +392,8 @@ describe 'ridgepole' do
391
392
  expect(status.success?).to be_truthy
392
393
 
393
394
  expect(out).to match_fuzzy <<-EOS
394
- Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
395
- Ridgepole::Client.diff([#{conf_file.path}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false}])
395
+ Ridgepole::Client#initialize([#{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
396
+ Ridgepole::Client.diff([#{conf_file.path}, #{conn_spec_str("ridgepole_test")}, {:dry_run=>false, :debug=>false, :color=>false}])
396
397
  Ridgepole::Delta#differ?
397
398
  EOS
398
399
  end
@@ -45,14 +45,13 @@ describe 'Ridgepole::Client#diff -> migrate' do
45
45
  "# employees",
46
46
  "# Compare definitions",
47
47
  "# employees",
48
+ " {:definition=>\n {\"birth_date\"=>{:options=>{:null=>false}, :type=>:date},\n \"first_name\"=>{:options=>{:limit=>14, :null=>false}, :type=>:string},\n- \"gender\"=>{:options=>{:limit=>1, :null=>false}, :type=>:string},\n+ \"gender2\"=>{:options=>{:limit=>1, :null=>false}, :type=>:string},\n \"hire_date\"=>{:options=>{:null=>false}, :type=>:date},\n \"last_name\"=>{:options=>{:limit=>16, :null=>false}, :type=>:string}},\n :options=>{:primary_key=>\"emp_no\"}}",
48
49
  "# Load tables",
49
50
  "# employees",
50
51
  "# Load tables",
51
52
  "# employees",
52
53
  ]
53
54
 
54
- expected_verbose_infos << " {\"birth_date\"=>{:type=>:date, :options=>{:null=>false}},\n \"first_name\"=>{:type=>:string, :options=>{:limit=>14, :null=>false}},\n \"last_name\"=>{:type=>:string, :options=>{:limit=>16, :null=>false}},\n- \"gender\"=>{:type=>:string, :options=>{:limit=>1, :null=>false}},\n+ \"gender2\"=>{:type=>:string, :options=>{:limit=>1, :null=>false}},\n \"hire_date\"=>{:type=>:date, :options=>{:null=>false}}},\n :options=>{:primary_key=>\"emp_no\"}}"
55
-
56
55
  expect(verbose_infos).to match_array expected_verbose_infos
57
56
  }
58
57
  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: 0.7.0.beta2
4
+ version: 0.7.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: pp_sort_hash
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: bundler
49
63
  requirement: !ruby/object:Gem::Requirement