Mercurial Hosting > luan
changeset 693:ca169567ce07
module URIs must now include ".luan"
line wrap: on
line diff
diff -r 7bd97d642f37 -r ca169567ce07 blog/serve.sh --- a/blog/serve.sh Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/serve.sh Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -luan luan:http/serve file:src 2>&1 | tee err +luan luan:http/serve.luan file:src 2>&1 | tee err
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/edit.luan --- a/blog/src/edit.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/edit.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error -local String = require "luan:String" +local String = require "luan:String.luan" local to_number = String.to_number or error() -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Post = require "site:/lib/Post" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/index.html.luan --- a/blog/src/index.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/index.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() -local Time = require "luan:Time" -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Post = require "site:/lib/Post" +local Time = require "luan:Time.luan" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/lib/Db.luan --- a/blog/src/lib/Db.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/lib/Db.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require "site:/lib/Db_mod".new_db() +return require "site:/lib/Db_mod.luan".new_db()
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/lib/Db_mod.luan --- a/blog/src/lib/Db_mod.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/lib/Db_mod.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ -local Lucene = require "luan:lucene/Lucene" -local Io = require "luan:Io" +local Lucene = require "luan:lucene/Lucene.luan" +local Io = require "luan:Io.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/lib/Post.luan --- a/blog/src/lib/Post.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/lib/Post.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,12 +1,12 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local assert_string = Luan.assert_string or error() -local Time = require "luan:Time" +local Time = require "luan:Time.luan" local now = Time.now or error() -local String = require "luan:String" +local String = require "luan:String.luan" local trim = String.trim or error() -local Db = require "site:/lib/Db" +local Db = require "site:/lib/Db.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/lib/test.luan --- a/blog/src/lib/test.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/lib/test.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,24 +1,24 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local to_string = Luan.to_string or error() -local Http = require "luan:http/Http" -local Http_test = require "luan:http/Http_test" +local Http = require "luan:http/Http.luan" +local Http_test = require "luan:http/Http_test.luan" local init = Http_test.init or error() local get_page = Http_test.get_page or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print or error() -local String = require "luan:String" +local String = require "luan:String.luan" local matches = String.matches or error() Http.uncache_site() -local Db_mod = require "site:/lib/Db_mod" +local Db_mod = require "site:/lib/Db_mod.luan" Db_mod.lucene_dir = "site:/private/local/lucene_test" -local Db = require "site:/lib/Db" +local Db = require "site:/lib/Db.luan" Db.delete_all() -local Post = require "site:/lib/Post" +local Post = require "site:/lib/Post.luan" local page print 'go'
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/new.luan --- a/blog/src/new.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/new.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,8 +1,8 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Post = require "site:/lib/Post" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Post = require "site:/lib/Post.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/private/tools/backup.luan --- a/blog/src/private/tools/backup.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/private/tools/backup.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Db = require "site:/lib/Db" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Db = require "site:/lib/Db.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/private/tools/lucene.luan --- a/blog/src/private/tools/lucene.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/private/tools/lucene.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,4 +1,4 @@ -local Web_search = require "luan:lucene/Web_search" -local Db = require "site:/lib/Db" +local Web_search = require "luan:lucene/Web_search.luan" +local Db = require "site:/lib/Db.luan" return Web_search.of(Db)
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/private/tools/run.luan --- a/blog/src/private/tools/run.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/private/tools/run.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require "luan:http/run" +return require "luan:http/run.luan"
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/private/tools/shell.luan --- a/blog/src/private/tools/shell.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/private/tools/shell.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require "luan:http/shell" +return require "luan:http/shell.luan"
diff -r 7bd97d642f37 -r ca169567ce07 blog/src/private/tools/test.luan --- a/blog/src/private/tools/test.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/src/private/tools/test.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,9 +1,9 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local do_file = Luan.do_file local try = Luan.try -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print -local Http = require "luan:http/Http" +local Http = require "luan:http/Http.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 blog/test.sh --- a/blog/test.sh Mon Apr 18 20:40:21 2016 -0600 +++ b/blog/test.sh Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -luan luan:http/test file:src site:/lib/test 2>&1 | tee err +luan luan:http/test.luan file:src site:/lib/test.luan 2>&1 | tee err
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/Luan.java --- a/core/src/luan/Luan.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/Luan.java Tue Apr 19 15:54:11 2016 -0600 @@ -8,7 +8,7 @@ public static void main(String[] args) throws LuanException { LuanState luan = new LuanState(); - LuanFunction standalone = (LuanFunction)BasicLuan.load_file(luan,"classpath:luan/cmd_line.luan",null); + LuanFunction standalone = (LuanFunction)BasicLuan.load_file(luan,"classpath:luan/cmd_line.luan"); standalone.call(luan,args); }
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/LuanException.java --- a/core/src/luan/LuanException.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/LuanException.java Tue Apr 19 15:54:11 2016 -0600 @@ -70,6 +70,7 @@ public String getFullMessage() { return getLuanStackTraceString(); +// return getLuanStackTraceString()+"\n"+getJavaStackTraceString(); /* StringBuilder buf = new StringBuilder();
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/cmd_line.luan --- a/core/src/luan/cmd_line.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/cmd_line.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local load_file = Luan.load_file or error() local try = Luan.try or error() -local Table = require "luan:Table" -local Io = require "luan:Io" +local Table = require "luan:Table.luan" +local Io = require "luan:Io.luan" local print = Io.print or error() @@ -20,7 +20,7 @@ end try { function() - local main_file = load_file(file,true) + local main_file = load_file(file) print( main_file( Table.unpack(Luan.arg) ) ) end; catch = function(e)
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/impl/LuanParser.java --- a/core/src/luan/impl/LuanParser.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/impl/LuanParser.java Tue Apr 19 15:54:11 2016 -0600 @@ -377,7 +377,7 @@ if( exprs == null ) return null; Stmts stmt = new Stmts(); - stmt.add( "Luan.checkFunction(luan.index(PackageLuan.require(luan,\"luan:Io\"),\"template_write\")).call(luan," ); + stmt.add( "Luan.checkFunction(luan.index(PackageLuan.require(luan,\"luan:Io.luan\"),\"template_write\")).call(luan," ); stmt.addAll( exprs.array() ); stmt.add( "); " ); return stmt;
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/BasicLuan.java --- a/core/src/luan/modules/BasicLuan.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/BasicLuan.java Tue Apr 19 15:54:11 2016 -0600 @@ -32,10 +32,13 @@ return LuanCompiler.compile(sourceName,text,env,allowExpr); } - public static LuanFunction load_file(LuanState luan,String fileName,Boolean addExtension) throws LuanException { - if( fileName == null ) + public static LuanFunction load_file(LuanState luan,String fileName) throws LuanException { + if( fileName == null ) { fileName = "stdin:"; - String src = PackageLuan.read(luan,fileName,addExtension); + } else if( fileName.indexOf(':') == -1 ) { + fileName = "file:" + fileName; + } + String src = PackageLuan.read(luan,fileName); if( src == null ) throw new LuanException("file '"+fileName+"' not found" ); return load(luan,src,fileName,null,false);
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Html.luan --- a/core/src/luan/modules/Html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -2,12 +2,12 @@ local HtmlLuan = require "java:luan.modules.HtmlLuan" local HtmlParser = require "java:luan.modules.parsers.Html" local URLEncoder = require "java:java.net.URLEncoder" -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local pairs = Luan.pairs or error() local type = Luan.type or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local output_of = Io.output_of or error()
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Io.luan --- a/core/src/luan/modules/Io.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Io.luan Tue Apr 19 15:54:11 2016 -0600 @@ -13,7 +13,7 @@ M.stderr = IoLuan.textWriter(System.err) -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local to_string = Luan.to_string or error() local type = Luan.type or error() @@ -22,9 +22,9 @@ local pairs = Luan.pairs or error() local values = Luan.values or error() local load = Luan.load or error() -local Table = require "luan:Table" +local Table = require "luan:Table.luan" local unpack = Table.unpack or error() -local String = require "luan:String" +local String = require "luan:String.luan" local encode = String.encode or error() local matches = String.matches or error()
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/IoLuan.java --- a/core/src/luan/modules/IoLuan.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/IoLuan.java Tue Apr 19 15:54:11 2016 -0600 @@ -521,18 +521,14 @@ return new LuanString(s).table(); } - public static LuanTable file(LuanState luan,String name,Boolean addExtension) throws LuanException { - if( addExtension != null && addExtension ) - name += ".luan"; + public static LuanTable file(LuanState luan,String name) throws LuanException { File file = new File(name); return new LuanFile(file).table(); } - public static LuanTable classpath(LuanState luan,String name,Boolean addExtension) throws LuanException { + public static LuanTable classpath(LuanState luan,String name) throws LuanException { if( name.contains("//") ) return null; - if( addExtension != null && addExtension ) - name += ".luan"; String path = name; check(luan,"classpath:"+path); URL url; @@ -561,26 +557,24 @@ return null; } - private static LuanTable url(String url,Boolean addExtension) throws IOException { - if( addExtension != null && addExtension ) - url += ".luan"; + private static LuanTable url(String url) throws IOException { return new LuanUrl(new URL(url)).table(); } - public static LuanTable http(String path,Boolean addExtension) throws IOException { - return url("http:"+path,addExtension); + public static LuanTable http(String path) throws IOException { + return url("http:"+path); } - public static LuanTable https(String path,Boolean addExtension) throws IOException { - return url("https:"+path,addExtension); + public static LuanTable https(String path) throws IOException { + return url("https:"+path); } - public static LuanTable luan(LuanState luan,String path,Boolean addExtension) throws LuanException { - return classpath( luan, "luan/modules/" + path, addExtension ); + public static LuanTable luan(LuanState luan,String path) throws LuanException { + return classpath( luan, "luan/modules/" + path ); } public static LuanTable stdin(LuanState luan) throws LuanException { - LuanTable io = (LuanTable)PackageLuan.require(luan,"luan:Io"); + LuanTable io = (LuanTable)PackageLuan.require(luan,"luan:Io.luan"); return (LuanTable)io.get(luan,"stdin"); } @@ -589,12 +583,12 @@ try { schemes.rawPut( "null", new LuanJavaFunction(IoLuan.class.getMethod("null_"),null) ); add( schemes, "string", String.class ); - add( schemes, "file", LuanState.class, String.class, Boolean.class ); - add( schemes, "classpath", LuanState.class, String.class, Boolean.class ); + add( schemes, "file", LuanState.class, String.class ); + add( schemes, "classpath", LuanState.class, String.class ); add( schemes, "socket", String.class ); - add( schemes, "http", String.class, Boolean.class ); - add( schemes, "https", String.class, Boolean.class ); - add( schemes, "luan", LuanState.class, String.class, Boolean.class ); + add( schemes, "http", String.class ); + add( schemes, "https", String.class ); + add( schemes, "luan", LuanState.class, String.class ); add( schemes, "stdin", LuanState.class ); } catch(NoSuchMethodException e) { throw new RuntimeException(e); @@ -603,7 +597,7 @@ } private static LuanTable schemes(LuanState luan) throws LuanException { - LuanTable t = (LuanTable)PackageLuan.loaded(luan).rawGet("luan:Io"); + LuanTable t = (LuanTable)PackageLuan.loaded(luan).rawGet("luan:Io.luan"); if( t == null ) return newSchemes(); t = (LuanTable)t.get(luan,"schemes"); @@ -612,7 +606,7 @@ return t; } - public static LuanTable uri(LuanState luan,String name,Boolean addExtension) throws LuanException { + public static LuanTable uri(LuanState luan,String name) throws LuanException { int i = name.indexOf(':'); if( i == -1 ) throw new LuanException( "invalid Io.uri name '"+name+"', missing scheme" ); @@ -622,7 +616,7 @@ LuanFunction opener = (LuanFunction)schemes.get(luan,scheme); if( opener == null ) throw new LuanException( "invalid scheme '"+scheme+"' in '"+name+"'" ); - return (LuanTable)Luan.first(opener.call(luan,new Object[]{location,addExtension})); + return (LuanTable)Luan.first(opener.call(luan,new Object[]{location})); } public static final class LuanSocket extends LuanIO {
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Luan.luan --- a/core/src/luan/modules/Luan.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Luan.luan Tue Apr 19 15:54:11 2016 -0600 @@ -29,8 +29,8 @@ M.type = BasicLuan.type M.values = BasicLuan.values -function M.do_file(uri,add_extension) - return M.load_file(uri,add_extension)() +function M.do_file(uri) + return M.load_file(uri)() end M.VERSION = M.do_file "classpath:luan/version.luan"
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/PackageLuan.java --- a/core/src/luan/modules/PackageLuan.java Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/PackageLuan.java Tue Apr 19 15:54:11 2016 -0600 @@ -45,7 +45,7 @@ if( modName.startsWith("java:") ) { mod = JavaLuan.load(luan,modName.substring(5)); } else { - String src = read(luan,modName,true); + String src = read(luan,modName); if( src == null ) return null; LuanFunction loader = BasicLuan.load(luan,src,modName,null,false); @@ -64,8 +64,8 @@ return mod; } - static String read(LuanState luan,String uri,Boolean addExtension) throws LuanException { - LuanTable t = IoLuan.uri(luan,uri,addExtension); + static String read(LuanState luan,String uri) throws LuanException { + LuanTable t = IoLuan.uri(luan,uri); if( t == null ) return null; LuanFunction existsFn = (LuanFunction)t.get(luan,"exists");
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Rpc.luan --- a/core/src/luan/modules/Rpc.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Rpc.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ java() local RpcLuan = require "java:luan.modules.RpcLuan" -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local set_metatable = Luan.set_metatable or error() -local Io = require "luan:Io" -local Thread = require "luan:Thread" +local Io = require "luan:Io.luan" +local Thread = require "luan:Thread.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Table.luan --- a/core/src/luan/modules/Table.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Table.luan Tue Apr 19 15:54:11 2016 -0600 @@ -14,7 +14,7 @@ M.unpack = TableLuan.unpack -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local pairs = Luan.pairs function M.is_empty(t)
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Time.luan --- a/core/src/luan/modules/Time.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Time.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -- incomplete, will add as needed java() -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() -local Table = require "luan:Table" +local Table = require "luan:Table.luan" local System = require "java:java.lang.System" local Calendar = require "java:java.util.Calendar" local Date = require "java:java.util.Date"
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/Which_mod.luan --- a/core/src/luan/modules/Which_mod.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/Which_mod.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,12 +1,12 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local pairs = Luan.pairs or error() local type = Luan.type or error() -local String = require "luan:String" +local String = require "luan:String.luan" local literal = String.literal or error() local matches = String.matches or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print or error()
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/host/Hosting.luan --- a/core/src/luan/modules/host/Hosting.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/host/Hosting.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,13 +1,13 @@ -- Hosting -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local pairs = Luan.pairs or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print or error() -local Rpc = require "luan:Rpc" -local String = require "luan:String" +local Rpc = require "luan:Rpc.luan" +local String = require "luan:String.luan" local matches = String.matches or error()
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/host/delete.luan --- a/core/src/luan/modules/host/delete.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/host/delete.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print -local Hosting = require "luan:host/Hosting" +local Hosting = require "luan:host/Hosting.luan" if #{...} ~= 2 then Io.stderr.write "usage: luan luan:host/delete domain password\n"
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/host/push.luan --- a/core/src/luan/modules/host/push.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/host/push.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print -local Hosting = require "luan:host/Hosting" +local Hosting = require "luan:host/Hosting.luan" if #{...} ~= 3 then Io.stderr.write "usage: luan luan:host/push domain password dir\n"
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/luan_to_java.luan --- a/core/src/luan/modules/luan_to_java.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/luan_to_java.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ java() local LuanCompiler = require "java:luan.impl.LuanCompiler" -local Io = require "luan:Io" +local Io = require "luan:Io.luan" Io.stdout.write( LuanCompiler.toJava( "stdin", Io.stdin.read_text() ) )
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/mmake.luan --- a/core/src/luan/modules/mmake.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/mmake.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local ipairs = Luan.ipairs -local Table = require "luan:Table" -local Io = require "luan:Io" +local Table = require "luan:Table.luan" +local Io = require "luan:Io.luan" local print = Io.print -local String = require "luan:String" -local Time = require "luan:Time" +local String = require "luan:String.luan" +local Time = require "luan:Time.luan" local compiler = Table.concat( { "javac -g -encoding UTF8", ... }, " " )
diff -r 7bd97d642f37 -r ca169567ce07 core/src/luan/modules/which.luan --- a/core/src/luan/modules/which.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/core/src/luan/modules/which.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,7 +1,7 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local values = Luan.values or error() -local Which_mod = require "luan:Which_mod" +local Which_mod = require "luan:Which_mod.luan" local which = Which_mod.which or error() for name in values(...) do
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/Dump_mod.luan --- a/http/src/luan/modules/http/Dump_mod.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/Dump_mod.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,8 +1,8 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local pairs = Luan.pairs local ipairs = Luan.ipairs -local Io = require "luan:Io" -local Http = require "luan:http/Http" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" java() local HttpServicer = require "java:luan.modules.http.HttpServicer"
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/Http.luan --- a/http/src/luan/modules/http/Http.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/Http.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,16 +1,16 @@ java() -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local pairs = Luan.pairs or error() local set_metatable = Luan.set_metatable or error() -local Io = require "luan:Io" -local Html = require "luan:Html" +local Io = require "luan:Io.luan" +local Html = require "luan:Html.luan" local url_encode = Html.url_encode or error() -local Table = require "luan:Table" +local Table = require "luan:Table.luan" local clear = Table.clear or error() -local Package = require "luan:Package" -local String = require "luan:String" +local Package = require "luan:Package.luan" +local String = require "luan:String.luan" local matches = String.matches or error() local HttpServicer = require "java:luan.modules.http.HttpServicer" local IoLuan = require "java:luan.modules.IoLuan"
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/HttpServicer.java --- a/http/src/luan/modules/http/HttpServicer.java Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/HttpServicer.java Tue Apr 19 15:54:11 2016 -0600 @@ -46,7 +46,7 @@ { LuanFunction fn; synchronized(luan) { - LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:http/Http"); + LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:http/Http.luan"); LuanTable per_session_pages = (LuanTable)module.rawGet("per_session_pages"); Object mod = PackageLuan.load(luan,modName); if( mod==null ) @@ -71,7 +71,7 @@ } } - LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:http/Http"); + LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:http/Http.luan"); // request LuanFunction newRequestFn = (LuanFunction)module.rawGet("new_request");
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/Http_test.luan --- a/http/src/luan/modules/http/Http_test.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/Http_test.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local set_metatable = Luan.set_metatable or error() -local Io = require "luan:Io" -local String = require "luan:String" +local Io = require "luan:Io.luan" +local String = require "luan:String.luan" local matches = String.matches or error() -local Http = require "luan:http/Http" +local Http = require "luan:http/Http.luan" local M = {} @@ -17,7 +17,7 @@ path = path .. M.welcome_file end local old_out = Io.stdout - local mod = require("site:"..path) + local mod = require("site:"..path..".luan") mod() M.text_writer.close() Io.stdout = old_out
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/LuanHandler.java --- a/http/src/luan/modules/http/LuanHandler.java Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/LuanHandler.java Tue Apr 19 15:54:11 2016 -0600 @@ -31,7 +31,7 @@ if( target.endsWith("/") ) target += welcomeFile; try { - if( !HttpServicer.service(luan,request,response,"site:"+target) ) + if( !HttpServicer.service(luan,request,response,"site:"+target+".luan") ) return; } catch(LuanException e) { String err = e.getFullMessage();
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/Server.luan --- a/http/src/luan/modules/http/Server.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/Server.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,10 +1,10 @@ -local String = require "luan:String" +local String = require "luan:String.luan" local gsub = String.gsub local matches = String.matches -local Io = require "luan:Io" -local Package = require "luan:Package" -local Http = require "luan:http/Http" -require "luan:logging/init" -- initialize logging +local Io = require "luan:Io.luan" +local Package = require "luan:Package.luan" +local Http = require "luan:http/Http.luan" +require "luan:logging/init.luan" -- initialize logging java() local Server = require "java:org.eclipse.jetty.server.Server" @@ -76,8 +76,8 @@ function M.init(dir) dir = gsub(dir,"/$","") -- remove trailing '/' if any Http.dir = dir - function Io.schemes.site(path,add_extension) - return Io.uri( dir..path, add_extension ) + function Io.schemes.site(path) + return Io.uri( dir..path ) end M.authentication_handler.setPassword(M.private_password) local base = dir
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/Shell_mod.luan --- a/http/src/luan/modules/http/Shell_mod.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/Shell_mod.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,11 +1,11 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local load = Luan.load or error() local try = Luan.try or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print or error() -local Http = require "luan:http/Http" +local Http = require "luan:http/Http.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/dump.luan --- a/http/src/luan/modules/http/dump.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/dump.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require("luan:http/Dump_mod").respond +return require("luan:http/Dump_mod.luan").respond
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/run.luan --- a/http/src/luan/modules/http/run.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/run.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,12 +1,12 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local load = Luan.load or error() local try = Luan.try or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local print = Io.print or error() -local String = require "luan:String" +local String = require "luan:String.luan" local gmatch = String.gmatch or error() -local Http = require "luan:http/Http" +local Http = require "luan:http/Http.luan" local function lines(s)
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/serve.luan --- a/http/src/luan/modules/http/serve.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/serve.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ -local Io = require "luan:Io" -local Server = require "luan:http/Server" +local Io = require "luan:Io.luan" +local Server = require "luan:http/Server.luan" if #{...} ~= 1 then Io.stderr.write "usage: luan luan:http/serve dir-URI\n"
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/shell.luan --- a/http/src/luan/modules/http/shell.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/shell.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require("luan:http/Shell_mod").respond +return require("luan:http/Shell_mod.luan").respond
diff -r 7bd97d642f37 -r ca169567ce07 http/src/luan/modules/http/test.luan --- a/http/src/luan/modules/http/test.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/http/src/luan/modules/http/test.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Luan = require "luan:Luan" -local Io = require "luan:Io" -local Server = require "luan:http/Server" +local Luan = require "luan:Luan.luan" +local Io = require "luan:Io.luan" +local Server = require "luan:http/Server.luan" if #{...} ~= 2 then Io.stderr.write "usage: luan luan:http/serve dir-URI test-URI\n" @@ -9,4 +9,4 @@ local dir, test = ... Server.init(dir) -Luan.do_file(test,true) +Luan.do_file(test)
diff -r 7bd97d642f37 -r ca169567ce07 logging/src/luan/modules/logging/init.luan --- a/logging/src/luan/modules/logging/init.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/logging/src/luan/modules/logging/init.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,2 +1,2 @@ -require "luan:logging/Logging".init() +require "luan:logging/Logging.luan".init() return true
diff -r 7bd97d642f37 -r ca169567ce07 lucene/src/luan/modules/lucene/Ab_testing.luan --- a/lucene/src/luan/modules/lucene/Ab_testing.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/lucene/src/luan/modules/lucene/Ab_testing.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,16 +1,16 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local pairs = Luan.pairs local ipairs = Luan.ipairs local error = Luan.error local range = Luan.range -local Math = require "luan:Math" -local Table = require "luan:Table" -local String = require "luan:String" +local Math = require "luan:Math.luan" +local Table = require "luan:Table.luan" +local String = require "luan:String.luan" local gsub = String.gsub -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Logging = require "luan:logging/Logging" -local Lucene = require "luan:lucene/Lucene" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Logging = require "luan:logging/Logging.luan" +local Lucene = require "luan:lucene/Lucene.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 lucene/src/luan/modules/lucene/Lucene.luan --- a/lucene/src/luan/modules/lucene/Lucene.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/lucene/src/luan/modules/lucene/Lucene.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,9 +1,9 @@ java() -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local type = Luan.type or error() -local Html = require "luan:Html" +local Html = require "luan:Html.luan" local LuceneIndex = require "java:luan.modules.lucene.LuceneIndex" local NumberFieldParser = require "java:sane.lucene.queryparser.NumberFieldParser" local StringFieldParser = require "java:sane.lucene.queryparser.StringFieldParser"
diff -r 7bd97d642f37 -r ca169567ce07 lucene/src/luan/modules/lucene/Versioning.luan --- a/lucene/src/luan/modules/lucene/Versioning.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/lucene/src/luan/modules/lucene/Versioning.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,18 +1,18 @@ -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local pairs = Luan.pairs or error() -local Number = require "luan:Number" +local Number = require "luan:Number.luan" local integer = Number.integer or error() local long = Number.long or error() -local String = require "luan:String" +local String = require "luan:String.luan" local matches = String.matches or error() local sub = String.sub or error() local string_to_number = String.to_number or error() -local Table = require "luan:Table" +local Table = require "luan:Table.luan" local copy = Table.copy or error() -local Lucene = require "luan:lucene/Lucene" -require "luan:logging/init" -local Logging = require "luan:logging/Logging" +local Lucene = require "luan:lucene/Lucene.luan" +require "luan:logging/init.luan" +local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "lucene versioning"
diff -r 7bd97d642f37 -r ca169567ce07 lucene/src/luan/modules/lucene/Web_search.luan --- a/lucene/src/luan/modules/lucene/Web_search.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/lucene/src/luan/modules/lucene/Web_search.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,15 +1,15 @@ - local Luan = require "luan:Luan" + local Luan = require "luan:Luan.luan" local error = Luan.error local pairs = Luan.pairs or error() local ipairs = Luan.ipairs or error() local range = Luan.range or error() local to_string = Luan.to_string or error() -local Io = require "luan:Io" +local Io = require "luan:Io.luan" local repr = Io.repr or error() -local Http = require "luan:http/Http" -local String = require "luan:String" +local Http = require "luan:http/Http.luan" +local String = require "luan:String.luan" local string_to_number = String.to_number or error() -local Html = require "luan:Html" +local Html = require "luan:Html.luan" local M = {}
diff -r 7bd97d642f37 -r ca169567ce07 mail/src/luan/modules/mail/Mail.luan --- a/mail/src/luan/modules/mail/Mail.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/mail/src/luan/modules/mail/Mail.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ java() -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local assert_table = Luan.assert_table local System = require "java:java.lang.System" local SmtpCon = require "java:luan.modules.mail.SmtpCon"
diff -r 7bd97d642f37 -r ca169567ce07 scripts/mmake.sh --- a/scripts/mmake.sh Mon Apr 18 20:40:21 2016 -0600 +++ b/scripts/mmake.sh Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -luan luan:mmake $* +luan luan:mmake.luan $*
diff -r 7bd97d642f37 -r ca169567ce07 scripts/test.luan --- a/scripts/test.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/scripts/test.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,21 +1,21 @@ -local Binary = require "luan:Binary" -local Html = require "luan:Html" -local Io = require "luan:Io" -local Luan = require "luan:Luan" -local Math = require "luan:Math" -local Package = require "luan:Package" -local String = require "luan:String" -local Table = require "luan:Table" -local Thread = require "luan:Thread" -local Time = require "luan:Time" -local Hosting = require "luan:host/Hosting" -local Http = require "luan:http/Http" -local Http_test = require "luan:http/Http_test" -local Server = require "luan:http/Server" -local Lucene = require "luan:lucene/Lucene" -local Versioning = require "luan:lucene/Versioning" -local Mail = require "luan:mail/Mail" -local Stripe = require "luan:stripe/Stripe" +local Binary = require "luan:Binary.luan" +local Html = require "luan:Html.luan" +local Io = require "luan:Io.luan" +local Luan = require "luan:Luan.luan" +local Math = require "luan:Math.luan" +local Package = require "luan:Package.luan" +local String = require "luan:String.luan" +local Table = require "luan:Table.luan" +local Thread = require "luan:Thread.luan" +local Time = require "luan:Time.luan" +local Hosting = require "luan:host/Hosting.luan" +local Http = require "luan:http/Http.luan" +local Http_test = require "luan:http/Http_test.luan" +local Server = require "luan:http/Server.luan" +local Lucene = require "luan:lucene/Lucene.luan" +local Versioning = require "luan:lucene/Versioning.luan" +local Mail = require "luan:mail/Mail.luan" +local Stripe = require "luan:stripe/Stripe.luan" local error = Luan.error local range = Luan.range or error() @@ -23,21 +23,21 @@ local find = String.find or error() local init = Http_test.init or error() local get_page = Http_test.get_page or error() -local Ab_testing = require "luan:lucene/Ab_testing" +local Ab_testing = require "luan:lucene/Ab_testing.luan" local function print(...) Io.print_to(Io.stderr,...) end -function Io.schemes.site(path,add_extension) - return Io.uri( "luan:http"..path, add_extension ) +function Io.schemes.site(path) + return Io.uri( "luan:http"..path ) end local page init() -Http.request.parameter.code = "require('luan:Io').print 'hi'" +Http.request.parameter.code = "require('luan:Io.luan').print 'hi'" page = get_page "/run" trim(page) == "hi" or error "failed" @@ -76,7 +76,7 @@ init() ab_testing.web_page{"All","null"}() -local Web_search = require "luan:lucene/Web_search" +local Web_search = require "luan:lucene/Web_search.luan" local web_search = Web_search.of(db) init() @@ -91,8 +91,8 @@ -- website -function Io.schemes.site(path,add_extension) - return Io.uri( "file:../website/src"..path, add_extension ) +function Io.schemes.site(path) + return Io.uri( "file:../website/src"..path ) end init(); get_page "/"
diff -r 7bd97d642f37 -r ca169567ce07 stripe/src/luan/modules/stripe/Stripe.luan --- a/stripe/src/luan/modules/stripe/Stripe.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/stripe/src/luan/modules/stripe/Stripe.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,8 +1,8 @@ java() -local Luan = require "luan:Luan" +local Luan = require "luan:Luan.luan" local error = Luan.error local assert_integer = Luan.assert_integer -local Table = require "luan:Table" +local Table = require "luan:Table.luan" local Stripe = require "java:com.stripe.Stripe" local Customer = require "java:com.stripe.model.Customer" local Charge = require "java:com.stripe.model.Charge"
diff -r 7bd97d642f37 -r ca169567ce07 website/serve.sh --- a/website/serve.sh Mon Apr 18 20:40:21 2016 -0600 +++ b/website/serve.sh Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -luan luan:http/serve file:src 2>&1 | tee err +luan luan:http/serve.luan file:src 2>&1 | tee err
diff -r 7bd97d642f37 -r ca169567ce07 website/src/diff.html.luan --- a/website/src/diff.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/diff.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Shared = require "site:/Shared" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/Shared.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/docs.html.luan --- a/website/src/docs.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/docs.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Shared = require "site:/Shared" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/Shared.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/examples/hi.luan --- a/website/src/examples/hi.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/examples/hi.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/examples/hi2.luan --- a/website/src/examples/hi2.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/examples/hi2.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" local function form()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/examples/shell.luan --- a/website/src/examples/shell.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/examples/shell.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,1 +1,1 @@ -return require "luan:http/shell" +return require "luan:http/shell.luan"
diff -r 7bd97d642f37 -r ca169567ce07 website/src/examples/upload-and-email.luan --- a/website/src/examples/upload-and-email.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/examples/upload-and-email.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Mail = require "luan:mail/Mail" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Mail = require "luan:mail/Mail.luan" local send = Mail.Sender{
diff -r 7bd97d642f37 -r ca169567ce07 website/src/index.html.luan --- a/website/src/index.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/index.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,5 +1,5 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/manual.html.luan --- a/website/src/manual.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/manual.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,8 +1,8 @@ -local Luan = require "luan:Luan" -local Io = require "luan:Io" -local Html = require "luan:Html" -local Http = require "luan:http/Http" -local Shared = require "site:/Shared" +local Luan = require "luan:Luan.luan" +local Io = require "luan:Io.luan" +local Html = require "luan:Html.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/Shared.luan" return function() @@ -1095,7 +1095,7 @@ <pre><%=Html.encode[[ local name = "Bob" - require("luan:Io").stdout.write( %> + require("luan:Io.luan").stdout.write( %> Hello <%= name %>! Bye <%= name %>. <% ) @@ -1770,7 +1770,7 @@ Example use: <pre> - local Table = require "luan:Table" + local Table = require "luan:Table.luan" </pre> <p> @@ -1789,7 +1789,7 @@ Include this library by: <pre> - local Luan = require "luan:Luan" + local Luan = require "luan:Luan.luan" </pre> <p> @@ -1955,7 +1955,7 @@ If the <code>allow_expression</code> parameter is <code>true</code> then the entire text can be nothing more than an expression in which case the chunk returns the value of this expression. -<h4 heading><a name="Luan.load_file" href="#Luan.load_file"><code>Luan.load_file (file_uri [, add_extension])</code></a></h4> +<h4 heading><a name="Luan.load_file" href="#Luan.load_file"><code>Luan.load_file ([file_uri])</code></a></h4> <p> Similar to <a href="#Luan.load"><code>load</code></a>, @@ -1967,9 +1967,9 @@ Could be defined as: <pre> - function Luan.load_file(file_uri,add_extension) + function Luan.load_file(file_uri) file_uri = file_uri or "stdin:" - local f = Io.uri(file_uri,add_extension) + local f = Io.uri(file_uri) f.exists() or <a href="#Luan.error">Luan.error</a>("file '"..file_uri.."' not found") return <a href="#Luan.load">Luan.load</a>( f.read_text(), file_uri ) end @@ -2231,7 +2231,7 @@ Include this library by: <pre> - local Package = require "luan:Package" + local Package = require "luan:Package.luan" </pre> <p> @@ -2253,7 +2253,7 @@ To load a new value, <code>Package.load</code> first checks if <code>mod_uri</code> starts with "<b>java:</b>". If yes, then this is a Java class which is loaded by special Java code. <p> -If <code>mod_uri</code> is not a Java class, then <code>Package.load</code> tries to read the text of the file referred to by <code>mod_uri</code> (using <code>add_extension</code>=true). If the file doesn't exist, then <code>Package.load</code> returns <b>nil</b>. If the file exists, then its content is compiled into a chunk calling <a href="#Luan.load"><code>Luan.load</code></a> and passing in an empty table as the <code>env</code> value. This chunk is run passing in <code>mod_uri</code> as an argument. If the chunk returns a value other than <b>nil</b>, then that value is the value of this module. Otherwise the <code>env</code> that was passed in is the value of this module. +If <code>mod_uri</code> is not a Java class, then <code>Package.load</code> tries to read the text of the file referred to by <code>mod_uri</code>. If the file doesn't exist, then <code>Package.load</code> returns <b>nil</b>. If the file exists, then its content is compiled into a chunk calling <a href="#Luan.load"><code>Luan.load</code></a> and passing in an empty table as the <code>env</code> value. This chunk is run passing in <code>mod_uri</code> as an argument. If the chunk returns a value other than <b>nil</b>, then that value is the value of this module. Otherwise the <code>env</code> that was passed in is the value of this module. <p> If a new value for the module successful loaded, then it is stored in <code>Package.loaded[mod_uri]</code>. The value is returned. @@ -2288,7 +2288,7 @@ Include this library by: <pre> - local String = require "luan:String" + local String = require "luan:String.luan" </pre> <p> @@ -2634,7 +2634,7 @@ Include this library by: <pre> - local Binary = require "luan:Binary" + local Binary = require "luan:Binary.luan" </pre> @@ -2671,7 +2671,7 @@ Include this library by: <pre> - local Table = require "luan:Table" + local Table = require "luan:Table.luan" </pre> <p> @@ -2784,7 +2784,7 @@ Include this library by: <pre> - local Number = require "luan:Number" + local Number = require "luan:Number.luan" </pre> @@ -2825,7 +2825,7 @@ Include this library by: <pre> - local Math = require "luan:Math" + local Math = require "luan:Math.luan" </pre> <p>
diff -r 7bd97d642f37 -r ca169567ce07 website/src/pil.html.luan --- a/website/src/pil.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/pil.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,6 +1,6 @@ -local Io = require "luan:Io" -local Http = require "luan:http/Http" -local Shared = require "site:/Shared" +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/Shared.luan" return function()
diff -r 7bd97d642f37 -r ca169567ce07 website/src/tutorial.html.luan --- a/website/src/tutorial.html.luan Mon Apr 18 20:40:21 2016 -0600 +++ b/website/src/tutorial.html.luan Tue Apr 19 15:54:11 2016 -0600 @@ -1,7 +1,7 @@ -local Io = require "luan:Io" -local Html = require "luan:Html" -local Http = require "luan:http/Http" -local Shared = require "site:/Shared" +local Io = require "luan:Io.luan" +local Html = require "luan:Html.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/Shared.luan" return function() @@ -43,22 +43,22 @@ <p>This should print <b>Hello Bob</b>. Now let's try a more conventional approach:</p> <pre> - local Io = require "luan:Io" + local Io = require "luan:Io.luan" local print = Io.print print("Hello World") </pre> -<p>In Luan, a function call with one string argument doesn't require parenthesis, so <b>print("Hello World")</b> is the same as <b>print "Hello World"</b> and <b>require "luan:Io"</b> is the same as <b>require("luan:Io")</b>. Both <b>require</b> and <b>print</b> are functions.</p> +<p>In Luan, a function call with one string argument doesn't require parenthesis, so <b>print("Hello World")</b> is the same as <b>print "Hello World"</b> and <b>require "luan:Io.luan"</b> is the same as <b>require("luan:Io.luan")</b>. Both <b>require</b> and <b>print</b> are functions.</p> -<p>The <b>require</b> function takes a <a href="http://en.wikipedia.org/wiki/Uniform_resource_identifier">URI</a> as an argument. Examples of URIs are "<b>luan:Io</b>" and "<b>file:hello</b>". <b>require</b> is used to import a module, which is returned from the <b>require</b> function call. In the case above, we assign the module to the local variable <b>Io</b>. The function <b>print</b> is a member of this module. We could have done <b>Io.print("Hello World")</b> but instead we chose to assign <b>print</b> to a local variable and use that to call the function.</p> +<p>The <b>require</b> function takes a <a href="http://en.wikipedia.org/wiki/Uniform_resource_identifier">URI</a> as an argument. Examples of URIs are "<b>luan:Io.luan</b>" and "<b>file:hello.luan</b>". <b>require</b> is used to import a module, which is returned from the <b>require</b> function call. In the case above, we assign the module to the local variable <b>Io</b>. The function <b>print</b> is a member of this module. We could have done <b>Io.print("Hello World")</b> but instead we chose to assign <b>print</b> to a local variable and use that to call the function.</p> <p>Luan starts with only two defined functions: <b>require</b> and <b>java</b>. You will use <b>require</b> to import whatever you need. This is a little more work, but makes it clear in each file where each function comes from.</p> <p>Let's a make fancier version:</p> <pre> - local Io = require "luan:Io" + local Io = require "luan:Io.luan" local print = Io.print local function hello(name) @@ -73,8 +73,8 @@ <p>Now let's make a web page. First we need a directory for our website. So create a directory <b>site</b>. In this directory, create a file <b>hi.luan</b> containing: <pre><%=Html.encode[[ - local Io = require "luan:Io" - local Http = require "luan:http/Http" + local Io = require "luan:Io.luan" + local Http = require "luan:http/Http.luan" return function() Io.stdout = Http.response.text_writer() @@ -88,7 +88,7 @@ end ]]%></pre> -<p>Now go back to the parent directory and do <b>luan luan:http/serve file:site</b>. This will run the Luan web server on port 8080. Try going to <a href="http://localhost:8080/">http://localhost:8080/</a>. You should see the directory. If you click on <b>hi.luan</b> you will see the source. But if you remove the <b>.luan</b> and just go to <a href="http://localhost:8080/hi">http://localhost:8080/hi</a> then you will run the program which will generate the web page.</p> +<p>Now go back to the parent directory and do <b>luan luan:http/serve.luan file:site</b>. This will run the Luan web server on port 8080. Try going to <a href="http://localhost:8080/">http://localhost:8080/</a>. You should see the directory. If you click on <b>hi.luan</b> you will see the source. But if you remove the <b>.luan</b> and just go to <a href="http://localhost:8080/hi">http://localhost:8080/hi</a> then you will run the program which will generate the web page.</p> <p>The Luan webserver expects the file to return a function and calls it to generate the page. Code of the form <b><%=Html.encode[[%>...<%]]%></b> writes its output to <b>Io.stdout</b> which by default is the standard output of the command line. So in the returned function one usually starts by setting <b>Io.stdout</b> to a <code>text_writer</code> which writes its output to the HTTP response (to the web browser).</p> @@ -97,10 +97,10 @@ <p>So now you have built your website and you want to publish it to the web. If you have your own domain, create a CNAME record for it pointing to <b>s1.luanhost.com</b>. If you don't have a domain, just use a domain like <b>bob.s1.luanhost.com</b> (anything of the form <b>*.s1.luanhost.com</b>). Assuming your directory is <b>site</b> and you will use the password <b>secret</b>, do the following from the command line: <pre> - luan luan:host/push bob.s1.luanhost.com secret site + luan luan:host/push.luan bob.s1.luanhost.com secret site </pre> -<p>The form is <b>luan luan:host/push domain password directory</b>. If you change your site, just run this again and your site will be updated. To delete your site, do <b>luan luan:host/delete domain password</b>.</p> +<p>The form is <b>luan luan:host/push.luan domain password directory</b>. If you change your site, just run this again and your site will be updated. To delete your site, do <b>luan luan:host/delete.luan domain password</b>.</p> <p>Hopefully this short tutorial gave you an idea of how to use Luan to make a website.</p>