mirror of
https://github.com/TangentFoxy/love-release.git
synced 2025-07-28 02:52:20 +00:00
Centralize LÖVE downloads
This commit is contained in:
@@ -41,16 +41,9 @@ function s.script(project)
|
|||||||
local url = "https://bitbucket.org/rude/love/downloads/"..bin
|
local url = "https://bitbucket.org/rude/love/downloads/"..bin
|
||||||
local cache = utils.cache.."/"..bin
|
local cache = utils.cache.."/"..bin
|
||||||
|
|
||||||
-- Can't cache the archive because luarocks functions use a HEAD request to
|
-- Can't cache the archive because luarocks functions use a HEAD
|
||||||
-- Amazon AWS which will answer a 403.
|
-- request to Amazon AWS which will answer a 403.
|
||||||
-- assert(fs.download(url, cache, true))
|
utils.download(url, cache, false)
|
||||||
if not fs.exists(cache) then
|
|
||||||
local ok, msg = fs.download(url, cache)
|
|
||||||
if not ok then
|
|
||||||
utils.io.err("Tried to download "..url.." to "..cache.."\n")
|
|
||||||
assert(ok, msg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
fs.delete(bin)
|
fs.delete(bin)
|
||||||
assert(fs.copy(cache, bin))
|
assert(fs.copy(cache, bin))
|
||||||
|
@@ -33,12 +33,9 @@ local function release(script, project, arch)
|
|||||||
local url = "https://bitbucket.org/rude/love/downloads/"..bin
|
local url = "https://bitbucket.org/rude/love/downloads/"..bin
|
||||||
local cache = utils.cache.."/"..bin
|
local cache = utils.cache.."/"..bin
|
||||||
|
|
||||||
-- Can't cache the archive because luarocks functions use a HEAD request to
|
-- Can't cache the archive because luarocks functions use a HEAD
|
||||||
-- Amazon AWS which will answer a 403.
|
-- request to Amazon AWS which will answer a 403.
|
||||||
-- assert(fs.download(url, cache, true))
|
utils.download(url, cache, false)
|
||||||
if not fs.exists(cache) then
|
|
||||||
assert(fs.download(url, cache))
|
|
||||||
end
|
|
||||||
|
|
||||||
fs.delete(bin)
|
fs.delete(bin)
|
||||||
assert(fs.copy(cache, bin))
|
assert(fs.copy(cache, bin))
|
||||||
|
@@ -155,4 +155,22 @@ function utils.io.err(string)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--[[ DOWNLOAD ]]--
|
||||||
|
|
||||||
|
--- Downloads and optionally caches a file. Will assert on download
|
||||||
|
-- failure.
|
||||||
|
-- @string url the document to download
|
||||||
|
-- @string dest where to write it
|
||||||
|
-- @bool cacheable cache it or not
|
||||||
|
function utils.download(url, dest, cacheable)
|
||||||
|
if not fs.exists(dest) then
|
||||||
|
local ok, msg = fs.download(url, dest, cacheable)
|
||||||
|
if not ok then
|
||||||
|
utils.io.err("Tried to download "..url.." to "..dest.."\n")
|
||||||
|
assert(ok, msg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
Reference in New Issue
Block a user