diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_admin_web/admin_web/get_deps.lua	Fri Dec 17 03:34:53 2010 +0100
@@ -0,0 +1,30 @@
+#!/usr/bin/env lua
+
+files = {
+	["www_files/strophejs.tar.gz"] = "http://download.github.com/metajack-strophejs-release-1.0-0-g1581b37.tar.gz";
+	["www_files/js/jquery-1.4.4.min.js"] = "http://code.jquery.com/jquery-1.4.4.min.js";
+}
+
+function fetch(url)
+	local http = require "socket.http";
+	local body, status = http.request(url);
+	if status == 200 then
+		return body;
+	end
+	return false, "HTTP status code: "..tostring(status);
+end
+
+for filename, url in pairs(files) do
+	file = io.open(filename, "w+");
+	data, error = fetch(url);
+	if data then
+		file:write(data);
+	else
+		print("Error: " .. error);
+	end
+	file:close();
+end
+
+os.execute("cd www_files && tar xzf strophejs.tar.gz");
+os.execute("cd www_files/metajack-strophejs-3ada7f5 && make strophe.js && cp strophe.js ../js/strophe.js");
+os.execute("rm -r www_files/strophejs.tar.gz www_files/metajack-strophejs-3ada7f5");