changeset 348:6fd016d35ec1 0.2

improve Hosting and fix mmake
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 12 Apr 2015 08:35:23 -0600
parents 612a283b3d14
children e42ef484fba7
files core/src/luan/modules/Hosting.luan core/src/luan/modules/host/Hosting.luan core/src/luan/modules/host/delete.luan core/src/luan/modules/host/push.luan core/src/luan/modules/mmake.luan scripts/mmake.luan scripts/mmake.sh
diffstat 7 files changed, 109 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
diff -r 612a283b3d14 -r 6fd016d35ec1 core/src/luan/modules/Hosting.luan
--- a/core/src/luan/modules/Hosting.luan	Sun Apr 12 07:17:40 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
--- Hosting
-
-local Io = require "luan:Io"
-
-port = 9101
-
-function put_site(domain,password,dir)
-	local socket = "socket:" .. domain .. ":" .. port
-	local pc = Io.Uri(socket).Pickle_client()
-	local pickle = pc.pickle
-	pc.call(%>
-		local Hosting = require "luan:Hosting"
-		Hosting.do_put_site(<%=pickle(domain)%>,<%=pickle(password)%>,<%=pickle(dir)%>)
-	<%)
-	pc.close()
-end
-
-function delete_site(domain,password)
-	local socket = "socket:" .. domain .. ":" .. port
-	local pc = Io.Uri(socket).Pickle_client()
-	local pickle = pc.pickle
-	pc.call(%>
-		local Hosting = require "luan:Hosting"
-		Hosting.do_delete_site(<%=pickle(domain)%>,<%=pickle(password)%>)
-	<%)
-	pc.close()
-end
diff -r 612a283b3d14 -r 6fd016d35ec1 core/src/luan/modules/host/Hosting.luan
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/luan/modules/host/Hosting.luan	Sun Apr 12 08:35:23 2015 -0600
@@ -0,0 +1,27 @@
+-- Hosting
+
+local Io = require "luan:Io"
+
+port = 9101
+
+function push(domain,password,dir)
+	local socket = "socket:" .. domain .. ":" .. port
+	local pc = Io.Uri(socket).Pickle_client()
+	local pickle = pc.pickle
+	pc.call(%>
+		local Hosting = require "luan:host/Hosting"
+		Hosting.do_push(<%=pickle(domain)%>,<%=pickle(password)%>,<%=pickle(dir)%>)
+	<%)
+	pc.close()
+end
+
+function delete(domain,password)
+	local socket = "socket:" .. domain .. ":" .. port
+	local pc = Io.Uri(socket).Pickle_client()
+	local pickle = pc.pickle
+	pc.call(%>
+		local Hosting = require "luan:host/Hosting"
+		Hosting.do_delete(<%=pickle(domain)%>,<%=pickle(password)%>)
+	<%)
+	pc.close()
+end
diff -r 612a283b3d14 -r 6fd016d35ec1 core/src/luan/modules/host/delete.luan
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/luan/modules/host/delete.luan	Sun Apr 12 08:35:23 2015 -0600
@@ -0,0 +1,12 @@
+local Io = require "luan:Io"
+local print = Io.print
+local Hosting = require "luan:host/Hosting"
+
+if #{...} ~= 2 then
+	Io.stderr.write "usage: luan luan:host/delete domain password\n"
+	return
+end
+
+Hosting.delete(...)
+
+print "done"
diff -r 612a283b3d14 -r 6fd016d35ec1 core/src/luan/modules/host/push.luan
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/luan/modules/host/push.luan	Sun Apr 12 08:35:23 2015 -0600
@@ -0,0 +1,12 @@
+local Io = require "luan:Io"
+local print = Io.print
+local Hosting = require "luan:host/Hosting"
+
+if #{...} ~= 3 then
+	Io.stderr.write "usage: luan luan:host/push domain password dir\n"
+	return
+end
+
+Hosting.push(...)
+
+print "done"
diff -r 612a283b3d14 -r 6fd016d35ec1 core/src/luan/modules/mmake.luan
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/luan/modules/mmake.luan	Sun Apr 12 08:35:23 2015 -0600
@@ -0,0 +1,57 @@
+local Luan = require "luan:Luan"
+local ipairs = Luan.ipairs
+local Table = require "luan:Table"
+local Io = require "luan:Io"
+local print = Io.print
+local String = require "luan:String"
+local Time = require "luan:Time"
+
+
+compiler = Table.concat( { "javac -g -encoding UTF8", ... }, " " )
+
+function mmake(dir)
+	local javas = {}
+	local dirs = {}
+	for _, file in ipairs(dir.children()) do
+		local name = file.name()
+		if name.match ".java$" ~= nil then
+			javas[#javas+1] = name.sub(1,-6)
+		end
+		if file.is_directory() and mmake(file) then
+			dirs[#dirs+1] = name
+		end
+	end
+	if #javas == 0 and #dirs == 0 then
+		return false;
+	end
+	local out = dir.child("Makefile").text_writer()
+	out.write( header() )
+	for _, s in ipairs(javas) do
+		out.write( "\\\n\t\t",  s , ".class" )
+	end
+	for _, s in ipairs(dirs) do
+		out.write( "\n\tcd ", s, ";  make all" )
+	end
+	out.write "\n\nclean:\n\trm -f *.class\n"
+	for _, s in ipairs(dirs) do
+		out.write( "\tcd ", s, ";  make clean\n" )
+	end
+	out.close()
+	print(dir.to_string())
+	return true
+end
+
+
+function header()
+	return 	%>
+# Makefile created on <%=Time.format(Time.now())%> by Mmake
+
+.SUFFIXES: .java .class
+
+.java.class:
+	<%=compiler%> $<
+
+all: <%
+end
+
+mmake(Io.schemes.file ".")
diff -r 612a283b3d14 -r 6fd016d35ec1 scripts/mmake.luan
--- a/scripts/mmake.luan	Sun Apr 12 07:17:40 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-local Luan = require "luan:Luan"
-local ipairs = Luan.ipairs
-local Table = require "luan:Table"
-local Io = require "luan:Io"
-local print = Io.print
-local String = require "luan:String"
-local Time = require "luan:Time"
-
-
-compiler = Table.concat( { "javac -g -encoding UTF8", ... }, " " )
-
-function mmake(dir)
-	local javas = {}
-	local dirs = {}
-	for _, file in ipairs(dir.children()) do
-		local name = file.name()
-		if name.match ".java$" ~= nil then
-			javas[#javas+1] = name.sub(1,-6)
-		end
-		if file.is_directory() and mmake(file) then
-			dirs[#dirs+1] = name
-		end
-	end
-	if #javas == 0 and #dirs == 0 then
-		return false;
-	end
-	local out = dir.child("Makefile").text_writer()
-	out.write( header() )
-	for _, s in ipairs(javas) do
-		out.write( "\\\n\t\t",  s , ".class" )
-	end
-	for _, s in ipairs(dirs) do
-		out.write( "\n\tcd ", s, ";  make all" )
-	end
-	out.write "\n\nclean:\n\trm -f *.class\n"
-	for _, s in ipairs(dirs) do
-		out.write( "\tcd ", s, ";  make clean\n" )
-	end
-	out.close()
-	print(dir.to_string())
-	return true
-end
-
-
-function header()
-	return 	%>
-# Makefile created on <%=Time.format(Time.now())%> by Mmake
-
-.SUFFIXES: .java .class
-
-.java.class:
-	<%=compiler%> $<
-
-all: <%
-end
-
-mmake(Io.schemes.file ".")
diff -r 612a283b3d14 -r 6fd016d35ec1 scripts/mmake.sh
--- a/scripts/mmake.sh	Sun Apr 12 07:17:40 2015 -0600
+++ b/scripts/mmake.sh	Sun Apr 12 08:35:23 2015 -0600
@@ -1,1 +1,1 @@
-luan `dirname $0`/mmake.luan $*
+luan luan:mmake $*