fix-db-schema-conflicts 3.0.0 → 3.1.0

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
- SHA1:
3
- metadata.gz: 2e315e5775c46ac6fa1f379e072246214f4a405a
4
- data.tar.gz: 595fe95951f639b7b4019d637101d869e3023eb6
2
+ SHA256:
3
+ metadata.gz: b478d22000068319b1a6168be5d1a3293538c3e9d6c30cba29ef8fe54341d2e3
4
+ data.tar.gz: 631289c91436eadb879c88201636646abb70fd232bae5b2d08af5cecb28475dd
5
5
  SHA512:
6
- metadata.gz: d3e058a81af618b6aad52b69cb7cd0e7f23b63a20a995e8319314b50ec2e49d541b10e89da3907ec6a9139f9a486ece8f64f8690085783284e33b154240dbdcc
7
- data.tar.gz: 55e00726a4912d6599f5bb75fd8bc07ec971a103cc5b95bf5395dbca1b7783a9763406da97f60ab3139b7a7f1094bce072c38278d5f25f837b5ff65d6198da3e
6
+ metadata.gz: bf4dcbfe59f4b1ed4e205a83fc4fe83ef6df634397a0ffb7ef2da4bf835c790ef9f99b4df23a7b8688f34af81fa2320d90f1f66152190f994df80b8e5f9584e7
7
+ data.tar.gz: 73b62a679824f8ab4fd8809514e1c542f165d024a431a0254ccd6951d6cead1a299a32a63f670cd058598a916ac21d2b38b12a18abfbb23edee8449ec1092220
@@ -0,0 +1,22 @@
1
+ name: Run rspec
2
+ on:
3
+ push:
4
+ pull_request:
5
+ branches: [ master ]
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-18.04
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: [ 2.4, 2.5, 2.6 ]
13
+ name: rspec with ruby ${{ matrix.ruby }}
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true
20
+ bundler: 1
21
+
22
+ - run: bundle exec rspec
@@ -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
@@ -0,0 +1,38 @@
1
+ # Configuration for Rubocop >= 0.53.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/TrailingCommaInArrayLiteral:
26
+ EnforcedStyleForMultiline: 'comma'
27
+
28
+ Style/TrailingCommaInHashLiteral:
29
+ EnforcedStyleForMultiline: 'comma'
30
+
31
+ Style/TrailingCommaInArguments:
32
+ EnforcedStyleForMultiline: 'comma'
33
+
34
+ Style/HashSyntax:
35
+ EnforcedStyle: 'ruby19'
36
+
37
+ Style/StringLiterals:
38
+ EnforcedStyle: double_quotes
@@ -0,0 +1,41 @@
1
+ # Configuration for Rubocop >= 0.77.0
2
+
3
+ Layout/ExtraSpacing:
4
+ # When true, allows most uses of extra spacing if the intent is to align
5
+ # things with the previous or next line, not counting empty lines or comment
6
+ # lines.
7
+ AllowForAlignment: false
8
+
9
+ Layout/HashAlignment:
10
+ EnforcedColonStyle: 'key'
11
+ EnforcedHashRocketStyle: 'key'
12
+
13
+ Layout/LineLength:
14
+ Enabled: false
15
+
16
+ Layout/SpaceBeforeFirstArg:
17
+ Enabled: true
18
+
19
+ Style/NumericLiterals:
20
+ Enabled: false
21
+
22
+ Metrics/BlockNesting:
23
+ Max: 2
24
+
25
+ Style/WordArray:
26
+ Enabled: false
27
+
28
+ Style/TrailingCommaInArrayLiteral:
29
+ EnforcedStyleForMultiline: 'comma'
30
+
31
+ Style/TrailingCommaInHashLiteral:
32
+ EnforcedStyleForMultiline: 'comma'
33
+
34
+ Style/TrailingCommaInArguments:
35
+ EnforcedStyleForMultiline: 'comma'
36
+
37
+ Style/HashSyntax:
38
+ EnforcedStyle: 'ruby19'
39
+
40
+ Style/StringLiterals:
41
+ EnforcedStyle: double_quotes
data/.rubocop_schema.yml CHANGED
@@ -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
@@ -18,7 +20,7 @@ Style/AlignHash:
18
20
  EnforcedHashRocketStyle: 'key'
19
21
 
20
22
  Style/WordArray:
21
- MinSize: 3
23
+ Enabled: false
22
24
 
23
25
  Style/TrailingCommaInLiteral:
24
26
  EnforcedStyleForMultiline: 'comma'
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- [![Build Status](https://travis-ci.org/jakeonrails/fix-db-schema-conflicts.svg?branch=master)](https://travis-ci.org/jakeonrails/fix-db-schema-conflicts)
2
-
3
1
  # fix-db-schema-conflicts
4
2
 
5
3
  It prevents db/schema.rb conflicts in your Rails projects when working with
@@ -37,8 +35,8 @@ auto-correct flag to ensure a consistent output format.
37
35
  ## Usage
38
36
 
39
37
  You don't have to do anything different. It should just work. Simply run `rake
40
- db:migrate` or `rake db:schema:dump` as you would before and `fix-db-schema-
41
- conflicts` will do the rest.
38
+ db:migrate` or `rake db:schema:dump` as you would before and
39
+ `fix-db-schema-conflicts` will do the rest.
42
40
 
43
41
  ## Installation
44
42
 
@@ -54,8 +52,8 @@ And then execute:
54
52
 
55
53
  ## Older versions of Rubocop:
56
54
 
57
- If you wish to use a version of Rubocop `< 0.36.0` or below, use `gem 'fix-db-
58
- schema-conflicts', '~> 1.0.2'`
55
+ If you wish to use a version of Rubocop `< 0.36.0` or below, use
56
+ `gem 'fix-db-schema-conflicts', '~> 1.0.2'`
59
57
 
60
58
  ## Older versions of Ruby:
61
59
 
@@ -80,9 +78,22 @@ old Ruby.
80
78
  - [@jensljungblad](https://github.com/jensljungblad)
81
79
  - [@vsubramanian](https://github.com/vsubramanian)
82
80
  - [@claytron](https://github.com/claytron)
81
+ - [@amckinnell](https://github.com/amckinnell)
82
+ - [@rosscooperman](https://github.com/rosscooperman)
83
+ - [@cabello](https://github.com/cabello)
84
+ - [@justisb](https://github.com/justisb)
83
85
 
84
86
  ## Releases
85
-
87
+ - 3.1.0
88
+ - Added support for ruby 3 (cabello)
89
+ - Added support for new Rubocop 0.77+ schema (justisb)
90
+ - 3.0.3
91
+ - Added support for new Rubocop 0.53+ schema (rosscooperman)
92
+ - 3.0.2
93
+ - Added support for new Rubocop 0.49+ schema (amckinnell)
94
+ - 3.0.1
95
+ - Improve formatting to be more consistent (amckinnell)
96
+ - Bump rake dependency to bypass a rake bug in older version (amckinnell)
86
97
  - 3.0.0
87
98
  - Only support Ruby 2.2+ since lower versions haved reached EOL.
88
99
  - 2.0.1
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.6'
22
- spec.add_development_dependency 'rake', '~> 11.1.1'
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec', '~>3.4.0'
24
24
  spec.add_development_dependency 'rails', '~> 4.2.0'
25
25
  spec.add_development_dependency 'sqlite3', '~> 1.3.0'
26
26
 
27
27
  spec.add_dependency 'rubocop', '>= 0.38.0'
28
28
 
29
- spec.required_ruby_version = '~> 2.0'
29
+ spec.required_ruby_version = '>= 2.0.0', '< 4'
30
30
  end
@@ -0,0 +1,25 @@
1
+ module FixDBSchemaConflicts
2
+ class AutocorrectConfiguration
3
+ def self.load
4
+ new.load
5
+ end
6
+
7
+ def load
8
+ if less_than_rubocop?(49)
9
+ '.rubocop_schema.yml'
10
+ elsif less_than_rubocop?(53)
11
+ '.rubocop_schema.49.yml'
12
+ elsif less_than_rubocop?(77)
13
+ '.rubocop_schema.53.yml'
14
+ else
15
+ '.rubocop_schema.77.yml'
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def less_than_rubocop?(ver)
22
+ Gem.loaded_specs['rubocop'].version < Gem::Version.new("0.#{ver}.0")
23
+ end
24
+ end
25
+ 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.0'
2
+ VERSION='3.1.0'
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
 
@@ -20,8 +20,6 @@ end
20
20
 
21
21
  def reference_db_schema
22
22
  <<-RUBY
23
- # encoding: UTF-8
24
-
25
23
  # This file is auto-generated from the current state of the database. Instead
26
24
  # of editing this file, please use the migrations feature of Active Record to
27
25
  # incrementally modify your database, and then regenerate this schema definition.
data/spec/spec_helper.rb CHANGED
@@ -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
File without changes
@@ -1,5 +1,3 @@
1
- # encoding: UTF-8
2
-
3
1
  # This file is auto-generated from the current state of the database. Instead
4
2
  # of editing this file, please use the migrations feature of Active Record to
5
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -0,0 +1,35 @@
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
+ it 'for versions 0.53.0 and above' do
20
+ installed_rubocop(version: '0.53.0')
21
+
22
+ expect(autocorrect_config.load).to eq('.rubocop_schema.53.yml')
23
+ end
24
+
25
+ it 'for versions 0.77.0 and above' do
26
+ installed_rubocop(version: '0.77.0')
27
+
28
+ expect(autocorrect_config.load).to eq('.rubocop_schema.77.yml')
29
+ end
30
+
31
+ def installed_rubocop(version:)
32
+ allow(Gem).to receive_message_chain(:loaded_specs, :[], :version)
33
+ .and_return(Gem::Version.new(version))
34
+ end
35
+ end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-db-schema-conflicts
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Moffatt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 11.1.1
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 11.1.1
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -102,16 +102,20 @@ executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
+ - ".github/workflows/rspec.yml"
105
106
  - ".gitignore"
106
107
  - ".rspec"
108
+ - ".rubocop_schema.49.yml"
109
+ - ".rubocop_schema.53.yml"
110
+ - ".rubocop_schema.77.yml"
107
111
  - ".rubocop_schema.yml"
108
- - ".travis.yml"
109
112
  - Gemfile
110
113
  - LICENSE.txt
111
114
  - README.md
112
115
  - Rakefile
113
116
  - fix-db-schema-conflicts.gemspec
114
117
  - lib/fix-db-schema-conflicts.rb
118
+ - lib/fix_db_schema_conflicts/autocorrect_configuration.rb
115
119
  - lib/fix_db_schema_conflicts/railtie.rb
116
120
  - lib/fix_db_schema_conflicts/schema_dumper.rb
117
121
  - lib/fix_db_schema_conflicts/tasks/db.rake
@@ -123,6 +127,7 @@ files:
123
127
  - spec/test-app/Gemfile.lock
124
128
  - spec/test-app/README.rdoc
125
129
  - spec/test-app/Rakefile
130
+ - spec/test-app/app/assets/config/manifest.js
126
131
  - spec/test-app/app/assets/images/.keep
127
132
  - spec/test-app/app/assets/javascripts/application.js
128
133
  - spec/test-app/app/assets/stylesheets/application.css
@@ -184,28 +189,31 @@ files:
184
189
  - spec/test-app/test/test_helper.rb
185
190
  - spec/test-app/vendor/assets/javascripts/.keep
186
191
  - spec/test-app/vendor/assets/stylesheets/.keep
192
+ - spec/unit/autocorrect_configuration_spec.rb
187
193
  homepage: https://github.com/jakeonrails/fix-db-schema-conflicts
188
194
  licenses:
189
195
  - MIT
190
196
  metadata: {}
191
- post_install_message:
197
+ post_install_message:
192
198
  rdoc_options: []
193
199
  require_paths:
194
200
  - lib
195
201
  required_ruby_version: !ruby/object:Gem::Requirement
196
202
  requirements:
197
- - - "~>"
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 2.0.0
206
+ - - "<"
198
207
  - !ruby/object:Gem::Version
199
- version: '2.0'
208
+ version: '4'
200
209
  required_rubygems_version: !ruby/object:Gem::Requirement
201
210
  requirements:
202
211
  - - ">="
203
212
  - !ruby/object:Gem::Version
204
213
  version: '0'
205
214
  requirements: []
206
- rubyforge_project:
207
- rubygems_version: 2.4.8
208
- signing_key:
215
+ rubygems_version: 3.0.9
216
+ signing_key:
209
217
  specification_version: 4
210
218
  summary: Helps prevent unneeded db/schema.rb conflicts
211
219
  test_files:
@@ -216,6 +224,7 @@ test_files:
216
224
  - spec/test-app/Gemfile.lock
217
225
  - spec/test-app/README.rdoc
218
226
  - spec/test-app/Rakefile
227
+ - spec/test-app/app/assets/config/manifest.js
219
228
  - spec/test-app/app/assets/images/.keep
220
229
  - spec/test-app/app/assets/javascripts/application.js
221
230
  - spec/test-app/app/assets/stylesheets/application.css
@@ -277,3 +286,4 @@ test_files:
277
286
  - spec/test-app/test/test_helper.rb
278
287
  - spec/test-app/vendor/assets/javascripts/.keep
279
288
  - spec/test-app/vendor/assets/stylesheets/.keep
289
+ - spec/unit/autocorrect_configuration_spec.rb
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.2.0"
4
- - "2.3.0"
5
- - "2.4.0"