From 421858e55413ee58d87d30ff9ef18d5138232c51 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Fri, 1 Sep 2023 09:17:30 +0800 Subject: [PATCH] Support dry-configurable 0.10 - 0.12 --- .github/workflows/main.yml | 13 +++++++------ CHANGELOG.md | 2 ++ Gemfile.dry-config-0.12 | 16 ++++++++++++++++ Gemfile.dry-config-0.14 | 16 ++++++++++++++++ lib/sequel_data/migrate.rb | 8 +++++++- lib/sequel_data/migrate/version.rb | 2 +- sequel-data-migrate.gemspec | 2 +- 7 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 Gemfile.dry-config-0.12 create mode 100644 Gemfile.dry-config-0.14 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6a0b84..ff3eb54 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,6 @@ name: Ruby -on: - push: - branches: - - master - - pull_request: +on: push jobs: build: @@ -18,6 +13,12 @@ jobs: - '3.0' - '3.1' - '3.2' + gemfile: + - 'Gemfile.dry-config-0.12' + - 'Gemfile.dry-config-0.14' + env: + BUNDLE_GEMFILE: ${{ matrix.gemfile }} + RUBY_VERSION: ${{ matrix.ruby }} steps: - uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c5020b..94ffb71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +- Support dry-configuration version 0.10.x - 0.12.x + ## [0.1.0] - 2023-04-11 - Initial release diff --git a/Gemfile.dry-config-0.12 b/Gemfile.dry-config-0.12 new file mode 100644 index 0000000..5b742bf --- /dev/null +++ b/Gemfile.dry-config-0.12 @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in sequel-data-migrate.gemspec +gemspec + +gem "rake", "~> 13.0" +gem "rbs" +gem "sqlite3" + +gem "rspec" + +gem "rubocop" +gem "rubocop-rspec" +gem "dry-configurable", "0.12" diff --git a/Gemfile.dry-config-0.14 b/Gemfile.dry-config-0.14 new file mode 100644 index 0000000..fbc6219 --- /dev/null +++ b/Gemfile.dry-config-0.14 @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in sequel-data-migrate.gemspec +gemspec + +gem "rake", "~> 13.0" +gem "rbs" +gem "sqlite3" + +gem "rspec" + +gem "rubocop" +gem "rubocop-rspec" +gem "dry-configurable", "0.14" diff --git a/lib/sequel_data/migrate.rb b/lib/sequel_data/migrate.rb index 46943c3..bc5d1ec 100644 --- a/lib/sequel_data/migrate.rb +++ b/lib/sequel_data/migrate.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "dry-configurable" +require "dry/configurable/version" require "sequel_data/migrate/version" require "sequel_data/migrate/errors" require "sequel_data/migrate/migrator" @@ -13,7 +14,12 @@ module Migrate setting :db_configuration do setting :host end - setting :migration_path, default: "db/data" + + if Dry::Configurable::VERSION >= "0.13.0" + setting :migration_path, default: "db/data" + else + setting :migration_path, "db/data" + end def self.migrate Migrator.new(config).migrate diff --git a/lib/sequel_data/migrate/version.rb b/lib/sequel_data/migrate/version.rb index 511d153..c086381 100644 --- a/lib/sequel_data/migrate/version.rb +++ b/lib/sequel_data/migrate/version.rb @@ -2,6 +2,6 @@ module SequelData module Migrate - VERSION = "0.1.0" + VERSION = "0.1.1" end end diff --git a/sequel-data-migrate.gemspec b/sequel-data-migrate.gemspec index 24f6c29..3828de8 100644 --- a/sequel-data-migrate.gemspec +++ b/sequel-data-migrate.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "dry-configurable", ">= 0.13.0" + spec.add_dependency "dry-configurable", ">= 0.10.0" spec.add_dependency "sequel", ">= 4.0.0" spec.metadata["rubygems_mfa_required"] = "true" end