comparison mod_admin_web/admin_web/get_deps.lua @ 288:9233d7ee3c09

mod_admin_web: Initial PoC commit
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 17 Dec 2010 03:34:53 +0100
parents
children
comparison
equal deleted inserted replaced
287:6144fe6161f1 288:9233d7ee3c09
1 #!/usr/bin/env lua
2
3 files = {
4 ["www_files/strophejs.tar.gz"] = "http://download.github.com/metajack-strophejs-release-1.0-0-g1581b37.tar.gz";
5 ["www_files/js/jquery-1.4.4.min.js"] = "http://code.jquery.com/jquery-1.4.4.min.js";
6 }
7
8 function fetch(url)
9 local http = require "socket.http";
10 local body, status = http.request(url);
11 if status == 200 then
12 return body;
13 end
14 return false, "HTTP status code: "..tostring(status);
15 end
16
17 for filename, url in pairs(files) do
18 file = io.open(filename, "w+");
19 data, error = fetch(url);
20 if data then
21 file:write(data);
22 else
23 print("Error: " .. error);
24 end
25 file:close();
26 end
27
28 os.execute("cd www_files && tar xzf strophejs.tar.gz");
29 os.execute("cd www_files/metajack-strophejs-3ada7f5 && make strophe.js && cp strophe.js ../js/strophe.js");
30 os.execute("rm -r www_files/strophejs.tar.gz www_files/metajack-strophejs-3ada7f5");