From e1b0b8234fb97e98686e557ed90a8f01019927c3 Mon Sep 17 00:00:00 2001 From: V1K1NGbg Date: Thu, 22 Aug 2024 17:49:05 -0300 Subject: Teal: convert luarocks.fetch.git_file --- src/luarocks/fetch/git_file.lua | 19 ------------------- src/luarocks/fetch/git_file.tl | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 src/luarocks/fetch/git_file.lua create mode 100644 src/luarocks/fetch/git_file.tl diff --git a/src/luarocks/fetch/git_file.lua b/src/luarocks/fetch/git_file.lua deleted file mode 100644 index 8d46bbca..00000000 --- a/src/luarocks/fetch/git_file.lua +++ /dev/null @@ -1,19 +0,0 @@ - ---- Fetch back-end for retrieving sources from local Git repositories. -local git_file = {} - -local git = require("luarocks.fetch.git") - ---- Fetch sources for building a rock from a local Git repository. --- @param rockspec table: The rockspec table --- @param extract boolean: Unused in this module (required for API purposes.) --- @param dest_dir string or nil: If set, will extract to the given directory. --- @return (string, string) or (nil, string): The absolute pathname of --- the fetched source tarball and the temporary directory created to --- store it; or nil and an error message. -function git_file.get_sources(rockspec, extract, dest_dir) - rockspec.source.url = rockspec.source.url:gsub("^git.file://", "") - return git.get_sources(rockspec, extract, dest_dir) -end - -return git_file diff --git a/src/luarocks/fetch/git_file.tl b/src/luarocks/fetch/git_file.tl new file mode 100644 index 00000000..90e14d12 --- /dev/null +++ b/src/luarocks/fetch/git_file.tl @@ -0,0 +1,22 @@ + +--- Fetch back-end for retrieving sources from local Git repositories. +local record git_file +end + +local git = require("luarocks.fetch.git") + +local type Rockspec = require("luarocks.core.types.rockspec").Rockspec + +--- Fetch sources for building a rock from a local Git repository. +-- @param rockspec table: The rockspec table +-- @param extract boolean: Unused in this module (required for API purposes.) +-- @param dest_dir string or nil: If set, will extract to the given directory. +-- @return (string, string) or (nil, string): The absolute pathname of +-- the fetched source tarball and the temporary directory created to +-- store it; or nil and an error message. +function git_file.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string + rockspec.source.url = rockspec.source.url:gsub("^git.file://", "") + return git.get_sources(rockspec, extract, dest_dir) +end + +return git_file -- cgit v1.2.3-55-g6feb