From c7a3bb48c45e760460bad4466ffec1340a2d98cc Mon Sep 17 00:00:00 2001 From: V1K1NGbg Date: Thu, 22 Aug 2024 17:49:05 -0300 Subject: Teal: convert luarocks.fetch.hg_http --- src/luarocks/fetch/hg_http.lua | 24 ------------------------ src/luarocks/fetch/hg_http.tl | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 24 deletions(-) delete mode 100644 src/luarocks/fetch/hg_http.lua create mode 100644 src/luarocks/fetch/hg_http.tl diff --git a/src/luarocks/fetch/hg_http.lua b/src/luarocks/fetch/hg_http.lua deleted file mode 100644 index 8f506daf..00000000 --- a/src/luarocks/fetch/hg_http.lua +++ /dev/null @@ -1,24 +0,0 @@ - ---- Fetch back-end for retrieving sources from hg repositories --- that use http:// transport. For example, for fetching a repository --- that requires the following command line: --- `hg clone http://example.com/foo` --- you can use this in the rockspec: --- source = { url = "hg+http://example.com/foo" } -local hg_http = {} - -local hg = require("luarocks.fetch.hg") - ---- Download sources for building a rock, using hg over http. --- @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 hg_http.get_sources(rockspec, extract, dest_dir) - rockspec.source.url = rockspec.source.url:gsub("^hg.", "") - return hg.get_sources(rockspec, extract, dest_dir) -end - -return hg_http diff --git a/src/luarocks/fetch/hg_http.tl b/src/luarocks/fetch/hg_http.tl new file mode 100644 index 00000000..a4ce48fd --- /dev/null +++ b/src/luarocks/fetch/hg_http.tl @@ -0,0 +1,27 @@ + +--- Fetch back-end for retrieving sources from hg repositories +-- that use http:// transport. For example, for fetching a repository +-- that requires the following command line: +-- `hg clone http://example.com/foo` +-- you can use this in the rockspec: +-- source = { url = "hg+http://example.com/foo" } +local record hg_http +end + +local hg = require("luarocks.fetch.hg") + +local type Rockspec = require("luarocks.core.types.rockspec").Rockspec + +--- Download sources for building a rock, using hg over http. +-- @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 hg_http.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string + rockspec.source.url = rockspec.source.url:gsub("^hg.", "") + return hg.get_sources(rockspec, extract, dest_dir) +end + +return hg_http -- cgit v1.2.3-55-g6feb