From 1286ee558e3cfb4ca0a3d26292eeb53d06e619e2 Mon Sep 17 00:00:00 2001 From: V1K1NGbg Date: Thu, 22 Aug 2024 17:49:05 -0300 Subject: Teal: convert luarocks.fetch.git_http --- src/luarocks/fetch/git_http.lua | 26 -------------------------- src/luarocks/fetch/git_http.tl | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 26 deletions(-) delete mode 100644 src/luarocks/fetch/git_http.lua create mode 100644 src/luarocks/fetch/git_http.tl diff --git a/src/luarocks/fetch/git_http.lua b/src/luarocks/fetch/git_http.lua deleted file mode 100644 index d85e2572..00000000 --- a/src/luarocks/fetch/git_http.lua +++ /dev/null @@ -1,26 +0,0 @@ - ---- Fetch back-end for retrieving sources from Git repositories --- that use http:// transport. For example, for fetching a repository --- that requires the following command line: --- `git clone http://example.com/foo.git` --- you can use this in the rockspec: --- source = { url = "git+http://example.com/foo.git" } --- Prefer using the normal git:// fetch mode as it is more widely --- available in older versions of LuaRocks. -local git_http = {} - -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_http.get_sources(rockspec, extract, dest_dir) - rockspec.source.url = rockspec.source.url:gsub("^git.", "") - return git.get_sources(rockspec, extract, dest_dir, "--") -end - -return git_http diff --git a/src/luarocks/fetch/git_http.tl b/src/luarocks/fetch/git_http.tl new file mode 100644 index 00000000..4ff602d9 --- /dev/null +++ b/src/luarocks/fetch/git_http.tl @@ -0,0 +1,29 @@ + +--- Fetch back-end for retrieving sources from Git repositories +-- that use http:// transport. For example, for fetching a repository +-- that requires the following command line: +-- `git clone http://example.com/foo.git` +-- you can use this in the rockspec: +-- source = { url = "git+http://example.com/foo.git" } +-- Prefer using the normal git:// fetch mode as it is more widely +-- available in older versions of LuaRocks. +local record git_http +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_http.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string + rockspec.source.url = rockspec.source.url:gsub("^git.", "") + return git.get_sources(rockspec, extract, dest_dir, "--") +end + +return git_http -- cgit v1.2.3-55-g6feb