Skip to content

Commit a78c257

Browse files
committedJan 19, 2025
Problem: can't find versions of ddlx
Solution: specify a different version pattern This is not strict SemVer, but that's okay. Adds `version_pattern` to `git` and `github` DSLs
1 parent 42f0395 commit a78c257

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
 

‎lib/pgpm/package/git.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module Pgpm
66
class Package
77
module Git
8-
Config = Data.define(:url, :download_version_tags, :tag_prefix)
8+
Config = Data.define(:url, :download_version_tags, :tag_prefix, :version_pattern)
99

1010
module ClassMethods
1111
attr_reader :git_config
@@ -25,7 +25,7 @@ def package_versions
2525
@tags ||=
2626
::Git.ls_remote(git_config.url)["tags"].keys
2727
.filter { |key| !key.end_with?("^{}") }
28-
.filter { |key| key.match?(/^(#{prefix_re})#{SEMVER}/) }
28+
.filter { |key| key.match?(/^(#{prefix_re})#{git_config.version_pattern || SEMVER}/) }
2929
rescue StandardError
3030
@tags ||= []
3131
end
@@ -38,8 +38,8 @@ def package_versions
3838
end
3939
end
4040

41-
def git(url, download_version_tags: true, tag_prefix: /v?/)
42-
@git_config = Config.new(url:, download_version_tags:, tag_prefix:)
41+
def git(url, download_version_tags: true, tag_prefix: /v?/, version_pattern: nil)
42+
@git_config = Config.new(url:, download_version_tags:, tag_prefix:, version_pattern:)
4343
extend Methods
4444
end
4545
end

‎lib/pgpm/package/git_hub.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ def source_url_directory_name
2525
module ClassMethods
2626
attr_reader :github_config
2727

28-
def github(name, download_version_tags: true, tag_prefix: /v?/)
28+
def github(name, download_version_tags: true, tag_prefix: /v?/, version_pattern: nil)
2929
@github_config = Config.new(name:, download_version_tags:)
3030
include Pgpm::Package::Git
3131
include Methods
32-
git "https://github.com/#{@github_config.name}", download_version_tags:, tag_prefix:
32+
git "https://github.com/#{@github_config.name}", download_version_tags:, tag_prefix:, version_pattern:
3333
end
3434
end
3535

‎packages/ddlx.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
class Ddlx < Pgpm::Package
4-
github "lacanoid/pgddl"
4+
github "lacanoid/pgddl", tag_prefix: "", version_pattern: /(0|[1-9]\d*)\.(0|[1-9]\d*)/
55
end

0 commit comments

Comments
 (0)