Mercurial Hosting > luan
comparison src/luan/modules/host/Hosting.luan @ 1088:bae2d0c2576c
change module naming convention
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 26 Dec 2016 22:29:36 -0700 |
parents | e7fb974e0c26 |
children | e8fc6712b468 |
comparison
equal
deleted
inserted
replaced
1087:4aab4dd3ac9c | 1088:bae2d0c2576c |
---|---|
10 local Rpc = require "luan:Rpc.luan" | 10 local Rpc = require "luan:Rpc.luan" |
11 local String = require "luan:String.luan" | 11 local String = require "luan:String.luan" |
12 local matches = String.matches or error() | 12 local matches = String.matches or error() |
13 | 13 |
14 | 14 |
15 local M = {} | 15 local Hosting = {} |
16 | 16 |
17 | 17 |
18 function M.push(domain,password,dir) | 18 function Hosting.push(domain,password,dir) |
19 local my_dir = Io.uri("file:"..dir) | 19 local my_dir = Io.uri("file:"..dir) |
20 my_dir.exists() or error("directory '"..dir.."' not found") | 20 my_dir.exists() or error("directory '"..dir.."' not found") |
21 my_dir.is_directory() or error("'"..dir.."' is not a directory") | 21 my_dir.is_directory() or error("'"..dir.."' is not a directory") |
22 local host = Rpc.remote(domain) | 22 local host = Rpc.remote(domain) |
23 local tree = host.get(domain,password) | 23 local tree = host.get(domain,password) |
59 process( nil, tree, my_dir ) | 59 process( nil, tree, my_dir ) |
60 | 60 |
61 host.update_handler(domain,password) | 61 host.update_handler(domain,password) |
62 end | 62 end |
63 | 63 |
64 function M.delete(domain,password) | 64 function Hosting.delete(domain,password) |
65 local host = Rpc.remote(domain) | 65 local host = Rpc.remote(domain) |
66 host.delete(domain,password) | 66 host.delete(domain,password) |
67 end | 67 end |
68 | 68 |
69 function M.exists(domain) | 69 function Hosting.exists(domain) |
70 local host = Rpc.remote(domain) | 70 local host = Rpc.remote(domain) |
71 return host.exists(domain) | 71 return host.exists(domain) |
72 end | 72 end |
73 | 73 |
74 function M.change_domain(old_domain,new_domain,password) | 74 function Hosting.change_domain(old_domain,new_domain,password) |
75 local host = Rpc.remote(new_domain) | 75 local host = Rpc.remote(new_domain) |
76 return host.change_domain(old_domain,new_domain,password) | 76 return host.change_domain(old_domain,new_domain,password) |
77 end | 77 end |
78 | 78 |
79 function M.change_password(domain,old_password,new_password) | 79 function Hosting.change_password(domain,old_password,new_password) |
80 local host = Rpc.remote(domain) | 80 local host = Rpc.remote(domain) |
81 return host.change_password(domain,old_password,new_password) | 81 return host.change_password(domain,old_password,new_password) |
82 end | 82 end |
83 | 83 |
84 function M.caller(domain) | 84 function Hosting.caller(domain) |
85 local host = Rpc.remote(domain) | 85 local host = Rpc.remote(domain) |
86 local mt = {} | 86 local mt = {} |
87 function mt.__index(_,key) | 87 function mt.__index(_,key) |
88 return function(...) | 88 return function(...) |
89 return host.call(domain,key,...) | 89 return host.call(domain,key,...) |
92 local t = {} | 92 local t = {} |
93 set_metatable(t,mt) | 93 set_metatable(t,mt) |
94 return t | 94 return t |
95 end | 95 end |
96 | 96 |
97 return M | 97 return Hosting |