Copy dependency file instead of moving them

This allows for using the native crystal File.copy function
and the caching of downloaded tarballs.
This commit is contained in:
syeopite 2024-02-19 11:44:22 -08:00
parent 37340f227d
commit facf727e66
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
1 changed files with 4 additions and 3 deletions

View File

@ -42,14 +42,15 @@ class Dependency
target_path = sprintf(full_target_path, {"file_extension": ".#{extension}"}) target_path = sprintf(full_target_path, {"file_extension": ".#{extension}"})
end end
target_path = Path[target_path]
if download_as = @dependency_config.dig?(YAML::Any.new("install_instructions"), YAML::Any.new("download_as")) if download_as = @dependency_config.dig?(YAML::Any.new("install_instructions"), YAML::Any.new("download_as"))
destination_path = "#{@destination_path}/#{sprintf(download_as.as_s, {"file_extension": ".#{extension}"})}" destination_path = "#{@destination_path}/#{sprintf(download_as.as_s, {"file_extension": ".#{extension}"})}"
else else
destination_path = @destination_path destination_path = Path[@destination_path].join(target_path.basename)
end end
# https://github.com/crystal-lang/crystal/issues/7777 File.copy(target_path, destination_path)
`mv #{target_path} #{destination_path}`
end end
private def fetch_path(is_css) private def fetch_path(is_css)