Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2013-01-29 18:25:42 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2013-01-29 18:25:42 (GMT)
commitf7b48727470f170a8af4e785cb3dcd004eefa410 (patch)
tree6c1681b9756496daff93cc54a7ef5a81544fcede
parentb0300b8b2be63d788c83a54fb4ea7ad0a12ef1e9 (diff)
Serve toolkit files
-rw-r--r--Makefile-client.am4
-rw-r--r--Makefile-server.am10
-rw-r--r--Makefile.am2
-rwxr-xr-xserver/main.js (renamed from server/sugar-http-server)11
-rw-r--r--server/sugar-http-server.in3
5 files changed, 25 insertions, 5 deletions
diff --git a/Makefile-client.am b/Makefile-client.am
index ba6ffbe..b9b0dc0 100644
--- a/Makefile-client.am
+++ b/Makefile-client.am
@@ -1,2 +1,2 @@
-jsdir = $(pkgdatadir)
-js_DATA =$(CLIENTSRCDIR)/datastore.js
+clientjsdir = $(pkgdatadir)/client
+clientjs_DATA =$(CLIENTSRCDIR)/datastore.js
diff --git a/Makefile-server.am b/Makefile-server.am
index 86e4bed..2dbcb2e 100644
--- a/Makefile-server.am
+++ b/Makefile-server.am
@@ -1 +1,9 @@
-bin_SCRIPTS = $(SERVERSRCDIR)/sugar-http-server
+bin_SCRIPTS = sugar-http-server
+
+sugar-http-server: $(SERVERSRCDIR)/sugar-http-server.in
+ @sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|" $< > $@
+
+serverjsdir = $(pkgdatadir)/server
+serverjs_DATA = $(SERVERSRCDIR)/main.js
+
+CLEANFILES += $(bin_SCRIPTS)
diff --git a/Makefile.am b/Makefile.am
index 1211778..93b606d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
CLIENTSRCDIR=$(top_srcdir)/client
SERVERSRCDIR=$(top_srcdir)/server
+CLEANFILES =
+
include $(top_srcdir)/Makefile-client.am
include $(top_srcdir)/Makefile-server.am
diff --git a/server/sugar-http-server b/server/main.js
index 788f55b..0a4daef 100755
--- a/server/sugar-http-server
+++ b/server/main.js
@@ -26,15 +26,22 @@ var bundlePathMsg = Object.create(dbus.DBusMessage, {
}
});
+var toolkitPath = process.env["SUGAR_TOOLKIT_HTML_PATH"]
+var toolkitStaticServer = new static.Server(toolkitPath);
+
http.createServer(function(request, response) {
request.addListener('end', function () {
parsed = url.parse(request.url);
splittedPath = parsed.pathname.split("/")
+ filePath = splittedPath.slice(2).join("/")
+
+ if (splittedPath[1] == "toolkit") {
+ toolkitStaticServer.serveFile(filePath, 200, {}, request, response);
+ return;
+ }
bundlePathMsg.on("methodResponse", function(path) {
var fileServer = new static.Server(path);
-
- filePath = splittedPath.slice(2).join("/")
fileServer.serveFile(filePath, 200, {}, request, response);
});
diff --git a/server/sugar-http-server.in b/server/sugar-http-server.in
new file mode 100644
index 0000000..e195e5b
--- /dev/null
+++ b/server/sugar-http-server.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+export SUGAR_TOOLKIT_HTML_PATH=@pkgdatadir@/client
+node @pkgdatadir@/server/main.js