Skip to content

Commit 948baaa

Browse files
committed
Problem: source_url_directory_name is not always correct
It is implied from extension name, however, that is not always true. Solution: make it implied from a respective source, such as github This also corrects how we inject GitHub-related methods (only when GitHub method is used)
1 parent 96362f4 commit 948baaa

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/pgpm/package/git_hub.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ class Package
77
module GitHub
88
Config = Data.define(:name, :download_version_tags)
99

10-
def sources
11-
commit = version_git_tag || version_git_commit
12-
[Pgpm::OnDemandFile.new("#{version}.tar.gz", lambda {
13-
URI.open("https://github.com/#{self.class.github_config.name}/archive/#{commit}.tar.gz")
14-
})] + super
10+
module Methods
11+
def sources
12+
commit = version_git_tag || version_git_commit
13+
[Pgpm::OnDemandFile.new("#{version}.tar.gz", lambda {
14+
URI.open("https://github.com/#{self.class.github_config.name}/archive/#{commit}.tar.gz")
15+
})] + super
16+
end
17+
18+
def source_url_directory_name
19+
commit = version_git_tag || version_git_commit
20+
"#{self.class.github_config.name.split("/").last}-#{commit}"
21+
end
1522
end
1623

1724
module ClassMethods
@@ -20,6 +27,7 @@ module ClassMethods
2027
def github(name, download_version_tags: true)
2128
@github_config = Config.new(name:, download_version_tags:)
2229
include Pgpm::Package::Git
30+
include Methods
2331
git "https://github.com/#{@github_config.name}", download_version_tags:
2432
end
2533
end

0 commit comments

Comments
 (0)