alphabetical_schema 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9bf68a728becb44ad8837f93f6ebbd2da8923950d34dc4da27dae6625ece44a9
4
+ data.tar.gz: 7cad315f7ad60c5ce27a0ecc85f3ef01e1f14c9f67994ccd5ed271edd82f9107
5
+ SHA512:
6
+ metadata.gz: 075e2a2de6b643aa9b8383b686fa53ed6a31f8e8867b126a0f7017e98d2b01ecaee95320590b5d111ef49b2231b24dbe139f35819fe4b2f1c2f6e0809fdddd68
7
+ data.tar.gz: d5e43f1b4d0d1ce96afd16f505e3d9279c8ff17add35fd3d853243bf24be68043ba31fe3e442b90b345267b9d361555710fb7fae860793a9d16d8a7de5707c8c
@@ -0,0 +1,19 @@
1
+ name: RSpec
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.6
17
+ - run: bundle install
18
+ - run: bundle exec appraisal install
19
+ - run: bundle exec appraisal rspec
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /spec/internal/db/*.sqlite
10
+ /Gemfile.lock
11
+ /gemfiles/*.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "rails-5.2" do
2
+ gem "rails", "~> 5.2.0"
3
+ end
4
+
5
+ appraise "rails-6.0" do
6
+ gem "rails", "~> 6.0.0"
7
+ end
8
+
9
+ appraise "rails-6.1" do
10
+ gem "rails", "~> 6.1.0"
11
+ end
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in alphabetical_schema.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "sqlite3"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Fabian Schwahn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # AlphabeticalSchema
2
+
3
+ This gem sorts the columns in your schema.rb file alphabetically to prevent conflicts.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'alphabetical_schema'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Run `rake db:migrate`.
16
+
17
+ ## License
18
+
19
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/alphabetical_schema/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "alphabetical_schema"
7
+ spec.version = AlphabeticalSchema::VERSION
8
+ spec.authors = ["Fabian Schwahn"]
9
+ spec.email = ["fabian.schwahn@gmail.com"]
10
+
11
+ spec.summary = "Sort schema.rb alphabetically to prevent conflicts"
12
+ spec.homepage = "https://github.com/denkungsart/alphabetical_schema"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.4.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_dependency "rails", "< 7"
28
+
29
+ spec.add_development_dependency "appraisal"
30
+ spec.add_development_dependency "combustion", "~> 1.3"
31
+ spec.add_development_dependency "rspec-rails"
32
+ end
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "sqlite3"
7
+ gem "rails", "~> 5.2.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "sqlite3"
7
+ gem "rails", "~> 6.0.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "sqlite3"
7
+ gem "rails", "~> 6.1.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "alphabetical_schema/version"
4
+
5
+ module AlphabeticalSchema
6
+ class SortedConnection < SimpleDelegator
7
+ def columns(table_name)
8
+ super.sort_by(&:name)
9
+ end
10
+ end
11
+
12
+ module SchemaDumperPatch
13
+ def initialize(*)
14
+ super
15
+ @connection = ::AlphabeticalSchema::SortedConnection.new(@connection)
16
+ end
17
+ end
18
+ end
19
+
20
+ require "active_record/schema_dumper"
21
+ ActiveRecord::SchemaDumper.prepend(::AlphabeticalSchema::SchemaDumperPatch)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AlphabeticalSchema
4
+ VERSION = "0.1.0"
5
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alphabetical_schema
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabian Schwahn
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: combustion
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - fabian.schwahn@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".github/workflows/ruby.yml"
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - Appraisals
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - alphabetical_schema.gemspec
85
+ - gemfiles/rails_5.2.gemfile
86
+ - gemfiles/rails_6.0.gemfile
87
+ - gemfiles/rails_6.1.gemfile
88
+ - lib/alphabetical_schema.rb
89
+ - lib/alphabetical_schema/version.rb
90
+ homepage: https://github.com/denkungsart/alphabetical_schema
91
+ licenses:
92
+ - MIT
93
+ metadata:
94
+ homepage_uri: https://github.com/denkungsart/alphabetical_schema
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.4.0
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubygems_version: 3.1.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Sort schema.rb alphabetically to prevent conflicts
114
+ test_files: []