fix-db-schema-conflicts 3.0.1 → 3.0.2

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
  SHA1:
3
- metadata.gz: a22f4fef26050e4e70f51478ba4514f7966814ef
4
- data.tar.gz: de684bf1d48ce3057065863af4aaba2ddd6473b0
3
+ metadata.gz: ecdcc56d2a2876277bf55418402686c906e329b8
4
+ data.tar.gz: 5f23bb38ec5e70d7e0f76bbe287785a7ffc85b33
5
5
  SHA512:
6
- metadata.gz: 8cc025eecba85b55061e46ba58eb643fa8c1af686a8603011a121905553ca9fcc2e89019ed5f07f31b8893ca2ce28e12be3daf6261712fd0c279210f4df3720d
7
- data.tar.gz: dde9a90e6b9c7d75612c70168599c2dcec5f78823b86bc7719cc9572956b3f348d08c34953bb0099b5aa92d3f343998e536f2b4890331f893072851a1dbc919b
6
+ metadata.gz: 2473ee6a7474dd182784d6d2f20f7cece39ecc1467c346ac53d1f002d99920520c3ff6871b8e54aa9ba62b80560fe144d4083c945901191390bd568985979efb
7
+ data.tar.gz: 9cdb6b11e152112577faa8ba66eb21a76c20f19119211893975ee00a0da054c0c217f7a9ce62c0b87ddae6490e08cb9dee67f18babd9b44b56ddeba50fd6b2f2
@@ -0,0 +1,35 @@
1
+ # Configuration for Rubocop >= 0.49.0
2
+
3
+ Layout/AlignHash:
4
+ EnforcedColonStyle: 'key'
5
+ EnforcedHashRocketStyle: 'key'
6
+
7
+ Layout/ExtraSpacing:
8
+ # When true, allows most uses of extra spacing if the intent is to align
9
+ # things with the previous or next line, not counting empty lines or comment
10
+ # lines.
11
+ AllowForAlignment: false
12
+
13
+ Layout/SpaceBeforeFirstArg:
14
+ Enabled: true
15
+
16
+ Style/NumericLiterals:
17
+ Enabled: false
18
+
19
+ Metrics/BlockNesting:
20
+ Max: 2
21
+
22
+ Style/WordArray:
23
+ Enabled: false
24
+
25
+ Style/TrailingCommaInLiteral:
26
+ EnforcedStyleForMultiline: 'comma'
27
+
28
+ Style/TrailingCommaInArguments:
29
+ EnforcedStyleForMultiline: 'comma'
30
+
31
+ Style/HashSyntax:
32
+ EnforcedStyle: 'ruby19'
33
+
34
+ Style/StringLiterals:
35
+ EnforcedStyle: double_quotes
@@ -1,3 +1,5 @@
1
+ # Configuration for Rubocop >= 0.38.0, < 0.49.0
2
+
1
3
  Style/ExtraSpacing:
2
4
  # When true, allows most uses of extra spacing if the intent is to align
3
5
  # things with the previous or next line, not counting empty lines or comment
data/README.md CHANGED
@@ -83,6 +83,8 @@ old Ruby.
83
83
  - [@amckinnell](https://github.com/amckinnell)
84
84
 
85
85
  ## Releases
86
+ - 3.0.2
87
+ - Added support for new Rubocop 0.49+ schema (amckinnell)
86
88
  - 3.0.1
87
89
  - Improve formatting to be more consistent (amckinnell)
88
90
  - Bump rake dependency to bypass a rake bug in older version (amckinnell)
@@ -0,0 +1,17 @@
1
+ module FixDBSchemaConflicts
2
+ class AutocorrectConfiguration
3
+ def self.load
4
+ new.load
5
+ end
6
+
7
+ def load
8
+ at_least_rubocop_49? ? '.rubocop_schema.49.yml' : '.rubocop_schema.yml'
9
+ end
10
+
11
+ private
12
+
13
+ def at_least_rubocop_49?
14
+ Gem::Version.new('0.49.0') <= Gem.loaded_specs['rubocop'].version
15
+ end
16
+ end
17
+ end
@@ -1,15 +1,18 @@
1
1
  require 'shellwords'
2
+ require_relative '../autocorrect_configuration'
2
3
 
3
4
  namespace :db do
4
5
  namespace :schema do
5
6
  task :dump do
6
7
  puts "Dumping database schema with fix-db-schema-conflicts gem"
8
+
7
9
  filename = ENV['SCHEMA'] || if defined? ActiveRecord::Tasks::DatabaseTasks
8
10
  File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
9
11
  else
10
12
  "#{Rails.root}/db/schema.rb"
11
13
  end
12
- rubocop_yml = File.expand_path('../../../../.rubocop_schema.yml', __FILE__)
14
+ autocorrect_config = FixDBSchemaConflicts::AutocorrectConfiguration.load
15
+ rubocop_yml = File.expand_path("../../../../#{autocorrect_config}", __FILE__)
13
16
  `bundle exec rubocop --auto-correct --config #{rubocop_yml} #{filename.shellescape}`
14
17
  end
15
18
  end
@@ -1,3 +1,3 @@
1
1
  module FixDBSchemaConflicts
2
- VERSION='3.0.1'
2
+ VERSION='3.0.2'
3
3
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Fix DB Schema Conflicts' do
3
+ RSpec.describe 'Fix DB Schema Conflicts' do
4
4
 
5
5
  let(:expected_lines) { reference_db_schema.lines }
6
6
 
7
7
  it 'generates a sorted schema with no extra spacing' do
8
8
 
9
- `cd spec/test-app && rm db/schema.rb && rake db:migrate`
9
+ `cd spec/test-app && rm -f db/schema.rb && rake db:migrate`
10
10
 
11
11
  generated_lines = File.readlines('spec/test-app/db/schema.rb')
12
12
 
@@ -40,9 +40,9 @@ RSpec.configure do |config|
40
40
  mocks.verify_partial_doubles = true
41
41
  end
42
42
 
43
- # The settings below are suggested to provide a good initial experience
44
- # with RSpec, but feel free to customize to your heart's content.
45
- =begin
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+
46
46
  # These two settings work together to allow you to limit a spec run
47
47
  # to individual examples or groups you care about by tagging them with
48
48
  # `:focus` metadata. When nothing is tagged with `:focus`, all examples
@@ -53,7 +53,7 @@ RSpec.configure do |config|
53
53
  # Allows RSpec to persist some state between runs in order to support
54
54
  # the `--only-failures` and `--next-failure` CLI options. We recommend
55
55
  # you configure your source control system to ignore this file.
56
- config.example_status_persistence_file_path = "spec/examples.txt"
56
+ # config.example_status_persistence_file_path = "spec/examples.txt"
57
57
 
58
58
  # Limits the available syntax to the non-monkey patched syntax that is
59
59
  # recommended. For more details, see:
@@ -79,7 +79,7 @@ RSpec.configure do |config|
79
79
  # Print the 10 slowest examples and example groups at the
80
80
  # end of the spec run, to help surface which specs are running
81
81
  # particularly slow.
82
- config.profile_examples = 10
82
+ # config.profile_examples = 10
83
83
 
84
84
  # Run specs in random order to surface order dependencies. If you find an
85
85
  # order dependency and want to debug it, you can fix the order by providing
@@ -92,5 +92,4 @@ RSpec.configure do |config|
92
92
  # test failures related to randomization by passing the same `--seed` value
93
93
  # as the one that triggered the failure.
94
94
  Kernel.srand config.seed
95
- =end
96
95
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'fix_db_schema_conflicts/autocorrect_configuration'
3
+
4
+ RSpec.describe FixDBSchemaConflicts::AutocorrectConfiguration do
5
+ subject(:autocorrect_config) { described_class }
6
+
7
+ it 'for versions up to 0.49.0' do
8
+ installed_rubocop(version: '0.39.0')
9
+
10
+ expect(autocorrect_config.load).to eq('.rubocop_schema.yml')
11
+ end
12
+
13
+ it 'for versions 0.49.0 and above' do
14
+ installed_rubocop(version: '0.49.0')
15
+
16
+ expect(autocorrect_config.load).to eq('.rubocop_schema.49.yml')
17
+ end
18
+
19
+ def installed_rubocop(version:)
20
+ allow(Gem).to receive_message_chain(:loaded_specs, :[], :version)
21
+ .and_return(Gem::Version.new(version))
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-db-schema-conflicts
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Moffatt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -104,6 +104,7 @@ extra_rdoc_files: []
104
104
  files:
105
105
  - ".gitignore"
106
106
  - ".rspec"
107
+ - ".rubocop_schema.49.yml"
107
108
  - ".rubocop_schema.yml"
108
109
  - ".travis.yml"
109
110
  - Gemfile
@@ -112,6 +113,7 @@ files:
112
113
  - Rakefile
113
114
  - fix-db-schema-conflicts.gemspec
114
115
  - lib/fix-db-schema-conflicts.rb
116
+ - lib/fix_db_schema_conflicts/autocorrect_configuration.rb
115
117
  - lib/fix_db_schema_conflicts/railtie.rb
116
118
  - lib/fix_db_schema_conflicts/schema_dumper.rb
117
119
  - lib/fix_db_schema_conflicts/tasks/db.rake
@@ -184,6 +186,7 @@ files:
184
186
  - spec/test-app/test/test_helper.rb
185
187
  - spec/test-app/vendor/assets/javascripts/.keep
186
188
  - spec/test-app/vendor/assets/stylesheets/.keep
189
+ - spec/unit/autocorrect_configuration_spec.rb
187
190
  homepage: https://github.com/jakeonrails/fix-db-schema-conflicts
188
191
  licenses:
189
192
  - MIT
@@ -277,3 +280,4 @@ test_files:
277
280
  - spec/test-app/test/test_helper.rb
278
281
  - spec/test-app/vendor/assets/javascripts/.keep
279
282
  - spec/test-app/vendor/assets/stylesheets/.keep
283
+ - spec/unit/autocorrect_configuration_spec.rb