comparison share/lua/5.2/luarocks/refresh_cache.lua @ 1132:d137f631bad5

<GreyKnight> (cd luabuild/luarocks-2.0.12; make install)
author HackBot
date Fri, 14 Dec 2012 22:24:27 +0000
parents
children
comparison
equal deleted inserted replaced
1131:ff65dfb63263 1132:d137f631bad5
1
2 --- Module implementing the luarocks-admin "refresh_cache" command.
3 module("luarocks.refresh_cache", package.seeall)
4
5 local util = require("luarocks.util")
6 local cfg = require("luarocks.cfg")
7 local cache = require("luarocks.cache")
8
9 help_summary = "Refresh local cache of a remote rocks server."
10 help_arguments = "[--from=<server>]"
11 help = [[
12 The flag --from indicates which server to use.
13 If not given, the default server set in the upload_server variable
14 from the configuration file is used instead.
15 ]]
16
17 function run(...)
18 local flags = util.parse_flags(...)
19 local server, upload_server = cache.get_upload_server(flags["server"])
20 if not server then return nil, upload_server end
21 local download_url = cache.get_server_urls(server, upload_server)
22
23 local ok, err = cache.refresh_local_cache(server, download_url, cfg.upload_user, cfg.upload_password)
24 if not ok then
25 return nil, err
26 else
27 return true
28 end
29 end
30