changeset 506:342964519194

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 May 2015 12:15:44 -0600
parents 7bc63886d4f2
children 40e18d335da9
files http/src/luan/modules/http/HttpTest.luan http/src/luan/modules/http/Http_test.luan http/src/luan/modules/http/ShellMod.luan http/src/luan/modules/http/Shell_mod.luan http/src/luan/modules/http/shell.luan scripts/test.luan
diffstat 6 files changed, 125 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/http/src/luan/modules/http/HttpTest.luan	Thu May 21 01:45:49 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-local Io = require "luan:Io"
-local Http = require "luan:http/Http"
-
-local M = {}
-
-M.welcome_file = "index.html"
-M.cookies = {}
-
-function M.get_page(path)
-	if M.welcome_file ~= nil and path.matches ".*/" then
-		path = path .. M.welcome_file
-	end
-	local old_out = Io.stdout
-	local mod = require("site:"..path)
-	mod()
-	M.text_writer.close()
-	Io.stdout = old_out
-	return M.result.read_text()
-end
-
-function M.init()
-	Http.request = Http.new_request{}
-	Http.request.cookies = M.cookies
-
-	Http.response = Http.new_response{
-
-		text_writer = function()
-			M.result = Io.uri "string:"
-			M.text_writer = M.result.text_writer()
-			return M.text_writer
-		end;
-
-		set_cookie = function(name,value)
-			M.cookies[name] = value
-		end;
-
-		remove_cookie = function(name)
-			M.cookies[name] = nil
-		end;
-
-		send_redirect = function(url)
-			Http.response.redirect = url
-		end;
-
-	}
-
-end
-
-return M
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/http/src/luan/modules/http/Http_test.luan	Thu May 21 12:15:44 2015 -0600
@@ -0,0 +1,49 @@
+local Io = require "luan:Io"
+local Http = require "luan:http/Http"
+
+local M = {}
+
+M.welcome_file = "index.html"
+M.cookies = {}
+
+function M.get_page(path)
+	if M.welcome_file ~= nil and path.matches ".*/" then
+		path = path .. M.welcome_file
+	end
+	local old_out = Io.stdout
+	local mod = require("site:"..path)
+	mod()
+	M.text_writer.close()
+	Io.stdout = old_out
+	return M.result.read_text()
+end
+
+function M.init()
+	Http.request = Http.new_request{}
+	Http.request.cookies = M.cookies
+
+	Http.response = Http.new_response{
+
+		text_writer = function()
+			M.result = Io.uri "string:"
+			M.text_writer = M.result.text_writer()
+			return M.text_writer
+		end;
+
+		set_cookie = function(name,value)
+			M.cookies[name] = value
+		end;
+
+		remove_cookie = function(name)
+			M.cookies[name] = nil
+		end;
+
+		send_redirect = function(url)
+			Http.response.redirect = url
+		end;
+
+	}
+
+end
+
+return M
--- a/http/src/luan/modules/http/ShellMod.luan	Thu May 21 01:45:49 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-local Luan = require "luan:Luan"
-local ipairs = Luan.ipairs
-local load = Luan.load
-local try = Luan.try
-local Io = require "luan:Io"
-local print = Io.print
-local Debug = require "luan:Debug"
-local Http = require "luan:http/Http"
-local Html = require "luan:Html"
-
-local M = {}
-
-local history = {}
-M.env = {}
-
-function M.respond()
-	if Http.request.parameter.clear ~= nil then
-		history = {}
-	else
-		local cmd = Http.request.parameter.cmd
-		if cmd ~= nil then
-			Io.stdout = {}
-			function Io.stdout.write(...)
-				for v in Luan.values(...) do
-					history[#history+1] = v
-				end
-			end
-			print( "% "..cmd )
-			try {
-				function()
-					local line = load(cmd,"<web_shell>",M.env,true)
-					Debug.print_if_something( line() )
-				end;
-				catch = function(e)
-					Io.print_to(Io.stderr,e)
-					print(e)
-				end;
-			}
-		end
-	end
-
-	Io.stdout = Http.response.text_writer()
-%>
-<html>
-	<head>
-		<% Html.simply_html_head() %>
-		<title>Luan Shell</title>
-	</head>
-	<body>
-		<div container>
-			<h3>Luan Shell</h3>
-			<p>This is a command shell.  Enter commands below.</p>
-			<pre><%
-			for _,v in ipairs(history) do
-				Io.stdout.write(v)
-			end
-			%></pre>
-			<form name='form0' method='post'>
-				% <input name='cmd' size="80" autofocus>
-				<input type="submit" value="run" textcolor="white" bgcolor="#337ab7">
-				<input type="submit" name="clear" value="clear" textcolor="white" bgcolor="#337ab7">
-			</form>
-		</div>
-		<% Html.simply_html_body_bottom() %>
-	</body>
-</html>
-<%
-end
-
-Http.per_session(M.respond)
-
-return M
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/http/src/luan/modules/http/Shell_mod.luan	Thu May 21 12:15:44 2015 -0600
@@ -0,0 +1,72 @@
+local Luan = require "luan:Luan"
+local ipairs = Luan.ipairs
+local load = Luan.load
+local try = Luan.try
+local Io = require "luan:Io"
+local print = Io.print
+local Debug = require "luan:Debug"
+local Http = require "luan:http/Http"
+local Html = require "luan:Html"
+
+local M = {}
+
+local history = {}
+M.env = {}
+
+function M.respond()
+	if Http.request.parameter.clear ~= nil then
+		history = {}
+	else
+		local cmd = Http.request.parameter.cmd
+		if cmd ~= nil then
+			Io.stdout = {}
+			function Io.stdout.write(...)
+				for v in Luan.values(...) do
+					history[#history+1] = v
+				end
+			end
+			print( "% "..cmd )
+			try {
+				function()
+					local line = load(cmd,"<web_shell>",M.env,true)
+					Debug.print_if_something( line() )
+				end;
+				catch = function(e)
+					Io.print_to(Io.stderr,e)
+					print(e)
+				end;
+			}
+		end
+	end
+
+	Io.stdout = Http.response.text_writer()
+%>
+<html>
+	<head>
+		<% Html.simply_html_head() %>
+		<title>Luan Shell</title>
+	</head>
+	<body>
+		<div container>
+			<h3>Luan Shell</h3>
+			<p>This is a command shell.  Enter commands below.</p>
+			<pre><%
+			for _,v in ipairs(history) do
+				Io.stdout.write(v)
+			end
+			%></pre>
+			<form name='form0' method='post'>
+				% <input name='cmd' size="80" autofocus>
+				<input type="submit" value="run" textcolor="white" bgcolor="#337ab7">
+				<input type="submit" name="clear" value="clear" textcolor="white" bgcolor="#337ab7">
+			</form>
+		</div>
+		<% Html.simply_html_body_bottom() %>
+	</body>
+</html>
+<%
+end
+
+Http.per_session(M.respond)
+
+return M
--- a/http/src/luan/modules/http/shell.luan	Thu May 21 01:45:49 2015 -0600
+++ b/http/src/luan/modules/http/shell.luan	Thu May 21 12:15:44 2015 -0600
@@ -1,1 +1,1 @@
-return require("luan:http/ShellMod").respond
+return require("luan:http/Shell_mod").respond
--- a/scripts/test.luan	Thu May 21 01:45:49 2015 -0600
+++ b/scripts/test.luan	Thu May 21 12:15:44 2015 -0600
@@ -11,7 +11,7 @@
 local Time = require "luan:Time"
 local Hosting = require "luan:host/Hosting"
 local Http = require "luan:http/Http"
-local HttpTest = require "luan:http/HttpTest"
+local Http_test = require "luan:http/Http_test"
 local Server = require "luan:http/Server"
 local Lucene = require "luan:lucene/Lucene"
 local Mail = require "luan:mail/Mail"
@@ -19,8 +19,8 @@
 
 local error = Luan.error
 local range = Luan.range
-local init = HttpTest.init
-local get_page = HttpTest.get_page
+local init = Http_test.init
+local get_page = Http_test.get_page
 local Ab_testing = require "luan:lucene/Ab_testing"