Skip to content

Commit

Permalink
Modernize gem.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 21, 2024
1 parent c0d46eb commit 6b7a301
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 35 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ jobs:
timeout-minutes: 5
run: bundle exec bake test

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
include-hidden-files: true
if-no-files-found: error
name: coverage-${{matrix.os}}-${{matrix.ruby}}
path: .covered.db

Expand All @@ -85,7 +87,7 @@ jobs:
ruby-version: "3.3"
bundler-cache: true

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4

- name: Validate coverage
timeout-minutes: 5
Expand Down
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: normal

Layout/BlockAlignment:
Enabled: true

Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: start_of_line
Expand Down Expand Up @@ -44,3 +47,7 @@ Layout/EmptyLinesAroundModuleBody:

Style/FrozenStringLiteralComment:
Enabled: true

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
10 changes: 5 additions & 5 deletions config/sus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require 'covered/sus'
require "covered/sus"
include Covered::Sus

Bundler.require(:adapters)

::CREDENTIALS = {
username: 'test',
password: 'test',
database: 'test',
host: '127.0.0.1'
username: "test",
password: "test",
database: "test",
host: "127.0.0.1"
}
7 changes: 4 additions & 3 deletions db-migrate.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ Gem::Specification.new do |spec|
spec.authors = ["Samuel Williams"]
spec.license = "MIT"

spec.cert_chain = ['release.cert']
spec.signing_key = File.expand_path('~/.gem/release.pem')
spec.cert_chain = ["release.cert"]
spec.signing_key = File.expand_path("~/.gem/release.pem")

spec.homepage = "https://github.com/socketry/db-migrate"

spec.metadata = {
"documentation_uri" => "https://socketry.github.io/db-migrate/",
"funding_uri" => "https://github.com/sponsors/ioquatix/",
"source_code_uri" => "https://github.com/socketry/db-migrate.git",
}

spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
spec.files = Dir.glob(["{lib}/**/*", "*.md"], File::FNM_DOTMATCH, base: __dir__)

spec.required_ruby_version = ">= 3.1"

Expand Down
8 changes: 4 additions & 4 deletions fixtures/db/migrate/client_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.

require 'db/client'
require 'db/adapters'
require 'db/migrate'
require "db/client"
require "db/adapters"
require "db/migrate"

require 'sus/fixtures/async'
require "sus/fixtures/async"

module DB
module Migrate
Expand Down
6 changes: 3 additions & 3 deletions lib/db/migrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require_relative 'migrate/version'
require_relative 'migrate/migration'
require_relative 'migrate/information_schema'
require_relative "migrate/version"
require_relative "migrate/migration"
require_relative "migrate/information_schema"
2 changes: 1 addition & 1 deletion lib/db/migrate/create_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require_relative 'drop_index'
require_relative "drop_index"

module DB
module Migrate
Expand Down
4 changes: 2 additions & 2 deletions lib/db/migrate/create_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require_relative 'create_index'
require_relative 'drop_table'
require_relative "create_index"
require_relative "drop_table"

module DB
module Migrate
Expand Down
2 changes: 1 addition & 1 deletion lib/db/migrate/drop_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require_relative 'create_index'
require_relative "create_index"

module DB
module Migrate
Expand Down
10 changes: 5 additions & 5 deletions lib/db/migrate/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require 'async'
require "async"

require_relative 'create_table'
require_relative 'rename_table'
require_relative 'create_index'
require_relative "create_table"
require_relative "rename_table"
require_relative "create_index"

module DB
module Migrate
Expand All @@ -20,7 +20,7 @@ def initialize(name, session)
def call(&block)
create_table?(:migration) do
primary_key
column :name, 'TEXT NOT NULL', unique: true, index: true
column :name, "TEXT NOT NULL", unique: true, index: true
timestamps
end

Expand Down
2 changes: 1 addition & 1 deletion lib/db/migrate/rename_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require_relative 'drop_index'
require_relative "drop_index"

module DB
module Migrate
Expand Down
4 changes: 2 additions & 2 deletions test/db/migrate.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
# Copyright, 2024, by Samuel Williams.

require 'db/migrate'
require "db/migrate"

describe DB::Migrate do
it "has a version number" do
Expand Down
6 changes: 3 additions & 3 deletions test/db/migrate/create_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require 'db/migrate/client_context'
require "db/migrate/client_context"

describe DB::Migrate::CreateTable do
DB::Adapters.each do |name, klass|
Expand All @@ -14,8 +14,8 @@
DB::Migrate.migrate(self, client) do
create_table :user, drop_if_exists: true do
primary_key
column :name, 'TEXT', null: false
column :password, 'TEXT', null: false
column :name, "TEXT", null: false
column :password, "TEXT", null: false
timestamps
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/db/migrate/information_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require 'db/migrate/client_context'
require "db/migrate/client_context"

describe DB::Migrate::InformationSchema do
DB::Adapters.each do |name, klass|
describe klass, unique: name do
include_context DB::Migrate::ClientContext, klass.new(**CREDENTIALS)

with 'table_exist?' do
with "table_exist?" do
it "can confirm table does not exist" do
client.session do |session|
information_schema = DB::Migrate::InformationSchema.new(session)
Expand Down
2 changes: 1 addition & 1 deletion test/db/migrate/rename_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.

require 'db/migrate/client_context'
require "db/migrate/client_context"

describe DB::Migrate::CreateTable do
DB::Adapters.each do |name, klass|
Expand Down

0 comments on commit 6b7a301

Please sign in to comment.