aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-11-01 12:47:09 +0000
committers-ol <s-ol@users.noreply.github.com>2019-11-01 12:47:09 +0000
commit053e607a49989b2d4491c20ff14c839b7161d713 (patch)
tree2397569c518c2de29f6de73d589bb80e84616821 /build
parentbrowsing, adding, removing fileders in inspector (diff)
downloadmmm-053e607a49989b2d4491c20ff14c839b7161d713.tar.gz
mmm-053e607a49989b2d4491c20ff14c839b7161d713.zip
add proper order handling, fsck for stores.fs
Diffstat (limited to 'build')
-rw-r--r--build/fsck.moon37
1 files changed, 37 insertions, 0 deletions
diff --git a/build/fsck.moon b/build/fsck.moon
new file mode 100644
index 0000000..df882a9
--- /dev/null
+++ b/build/fsck.moon
@@ -0,0 +1,37 @@
+add = (tmpl) ->
+ package.path ..= ";#{tmpl}.lua"
+ package.moonpath ..= ";#{tmpl}.moon"
+
+add '?'
+add '?.server'
+add '?/init'
+add '?/init.server'
+
+require 'mmm'
+
+import get_store from require 'mmm.mmmfs.stores'
+
+-- usage:
+-- moon server.moon [FLAGS] [STORE] [host] [port]
+-- * FLAGS - any of the following:
+-- --[no-]rw - enable/disable POST?PUT/DELETE operations (default: on if local)
+-- --[no-]unsafe - enable/disable server-side code execution when writable is on (default: on if local or --no-rw)
+-- * STORE - see mmm/mmmfs/stores/init.moon:get_store
+-- * host - interface to bind to (default localhost, set to 0.0.0.0 for public hosting)
+-- * port - port to serve from, default 8000
+
+flags = {}
+arguments = for a in *arg
+ if flag = a\match '^%-%-no%-(.*)$'
+ flags[flag] = false
+ continue
+ elseif flag = a\match '^%-%-(.*)$'
+ flags[flag] = true
+ continue
+ else
+ a
+
+{ store, host, port } = arguments
+
+store = get_store store, verbose: true
+store\fsck!