scossu 2 tygodni temu
rodzic
commit
cb53518fcf
2 zmienionych plików z 69 dodań i 6 usunięć
  1. 66 0
      README.md
  2. 3 6
      pkar.lua

+ 66 - 0
README.md

@@ -136,6 +136,64 @@ The entire site must be generated every time resources are created or updated.
 This is usually very fast, but on large archives it can take a while. This is
 the downside of static website: they are static.
 
+## Functionality
+
+### CLI
+
+Pocket Archive can be managed via a command line interface (CLI) when
+installed locally (e.g. via Luarocks).
+
+The `pkar` script contains several useful commands, e.g.
+
+```
+pkar init [--wipe]
+```
+
+Initialize the Pocket Archive store and database at the location indicated by
+the `$PKAR_DRES` and `$PKAR_ORES` environment variables. The `--wipe` option
+deletes all preexisting data found in those directories.
+
+```
+pkar deposit <path>
+```
+
+Deposit resources in the `<path>` folder. This folder must contain a
+laundry list named `pkar_submission.csv` with file paths relative to that
+folder.
+
+```
+pkar gen_site
+```
+
+Generate static site at `out/html`. This includes all HTML pages, derivative
+media, thumbnails, ancillary assets, and RDF representations of all resources.
+The `html` folder can be pointed to by a static HTTP server for local testing,
+or copied to a remote HTTP server. For local testing, I have been using
+`darkhttpd` which does the job in only 55Kb. *TODO serverless deployment
+option*
+
+```
+pkar gen_rdf <id> [-f, --format <format>]
+```
+
+Generate the RDF representation of one resource. Useful for debugging and
+inspecting.
+
+More detailed information can be obtain with `pkar --help`.
+
+### Environment variables
+
+The following environment variables should be set before using Pocket Archive:
+
+- `PKAR_ROOT`: Root of Pocket Archive data. It defaults to `.`.
+- `PKAR_ORES`: Directory of opaque resources (content files). It defaults to
+  `${PKAR_ROOT}/data/ores`.
+- `PKAR_DRES`: Directory of descriptive resources (metadata). It defaults to
+  `${PKAR_ROOT}/data/dres`.
+- `PKAR_CONFIG_DIR`: configuration directory. This should be a directory
+  containing the `model` directory with the content mode configuration and
+  `app.lua` with general application configuration. It defaults to `./config`.
+
 ## Status
 
 **ALPHA**. Pocket Archive is a very recent project, in fast development. Its
@@ -144,6 +202,14 @@ foundational library, Volksdata, has been developed as a spare-time project for
 
 ### Road map
 
+The first goal is to build a working prototype, with all the basic functional
+components, even if not entirely developed or only usable in a specific
+development environment, to demonstrate the overall workflows and
+functionality.
+
+The second step is to prduce a minimum viable product, which is fully
+functional and available for use by the intended audience.
+
 #### Prototype
 
 - ✓ Configuration + config parser

+ 3 - 6
pkar.lua

@@ -10,7 +10,7 @@ local sub = require "pocket_archive.submission"
 local hgen = require "pocket_archive.html_generator"
 
 
-cli.locale "en_US"
+cli.locale "en_US"  -- TODO set with multilingual support.
 
 init = cli.command {
     "Initialize a new Pocket Archive store.",
@@ -23,14 +23,11 @@ init = cli.command {
     function(args)
         if args.wipe then _ = pkar.reset_store
         else _ = pkar.store end
-
-        _ = nil
-        collectgarbage()
     end
 }
 
-submit = cli.command {
-    "Submit a package.",
+deposit = cli.command {
+    "Deposit a package.",
 
     cli.positional "path" {
         [[Path of the package root. It must be a directory containing