Quellcode durchsuchen

Adjust paths for non-dev installation.

scossu vor 1 Woche
Ursprung
Commit
6a1300f02e
9 geänderte Dateien mit 76 neuen und 54 gelöschten Zeilen
  1. 12 4
      README.md
  2. 11 3
      config/app.lua
  3. 40 34
      doc/roadmap.md
  4. 1 0
      pocket_archive-scm-1.rockspec
  5. 4 5
      src/core.lua
  6. 4 5
      src/generator.lua
  7. 2 1
      src/model.lua
  8. 1 1
      src/util/pkar.lua
  9. 1 1
      templates/index.html

+ 12 - 4
README.md

@@ -201,12 +201,13 @@ In order for this approach to work, the laundry list **must** be uploaded after
 all the other submission files have been successfully uploaded.
 
 The watched folder is local to the Pocket Archive operating system. However, it
-is possible to run an FTP server or even an S3 server via e.g., MinIO on that
-folder, thus providing remote access and permission management.
+is possible to run an FTP server on the same folder, thus providing remote
+access and permission management.
 
 ### Environment variables
 
-The following environment variables should be set before using Pocket Archive:
+The following environment variables are available to modify the application
+behavior:
 
 - `PKAR_ROOT`: Root of Pocket Archive data. It defaults to `.`.
 - `PKAR_ORES`: Directory of opaque resources (content files). It defaults to
@@ -215,7 +216,14 @@ The following environment variables should be set before using Pocket Archive:
   `${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`.
+  `app.lua` with general application configuration. It defaults to the `config`
+  directory installed by Luarocks.
+
+## Compatibility
+
+Linux only. The submission watchdog relies on `inotify` which is not portable.
+Adopters not using the watchdog or willing to re-implement it may have success
+with other POSIX environments, but these have not been tested.
 
 ## Status
 

+ 11 - 3
config/app.lua

@@ -2,7 +2,15 @@
 
 local plpath = require "pl.path"
 
-local ROOT = os.getenv("PKAR_ROOT") or ""
+local ROOT = os.getenv("PKAR_ROOT")
+if not ROOT then
+    print(
+        "PKAR_ROOT environment variable is not set.\n" ..
+        "Data will be written to a TEMPORARY location that " ..
+        "may NOT SURVIVE a reboot!"
+    )
+    ROOT = "/tmp/pocket_archive"
+end
 
 return {
     id = {
@@ -32,9 +40,9 @@ return {
     },
     fs = {
         -- Base path to write opaque resources.
-        ores_path = os.getenv("PKAR_ORES") or plpath.join(ROOT, "data/ores"),
+        ores_path = os.getenv("PKAR_ORES") or plpath.join(ROOT, "data", "ores"),
         -- Base path of LSUP store for descriptive resources (RDF).
-        dres_path = os.getenv("PKAR_DRES") or plpath.join(ROOT, "data/dres"),
+        dres_path = os.getenv("PKAR_DRES") or plpath.join(ROOT, "data", "dres"),
 
         -- How many bytes to read when handling files. Adjust to memory
         -- availability.

+ 40 - 34
doc/roadmap.md

@@ -8,46 +8,51 @@ functionality.
 The second step is to produce a basic application, which is fully
 functional and available for use by the intended audience.
 
-## Prototype (alpha)
+Beyond the basic application, new features and bug fixes will be driven by
+usage and opportunities for expanding adoption in relevant areas.
 
 ❏ = pending; ⚒ = in progress; ⎊ = blocked; ✓ = complete; ✖︎ = not implemented.
 
-- ✓ Configuration + config parser
-  - ✓ Application
-  - ✓ Content model
-    - ✓ Validation rules
-- ✓ Submission module
-  - ✓ SIP building
-  - ✓ Metadata from LL
-  - ✓ Brick structures
-  - ✓ Structure inference
-- ✓ HTML generator
-  - ✓ Index
-  - ✓ Resource
-  - ✓ Static assets
-- ✓ Non-HTML generators
-  - ✓ RDF (turtle)
-  - ✓ Transformers
-  - ✓ JS search engine index
-- ✓ CLI
-  - ✓ Init archive
-  - ✓ Deposit
-  - ✓ Generate site
-  - ✓ Generate LL (single resource)
-  - ✓ Generate RDF (single resource)
-- ✓ Front end
-  - ✓ JS search engine
-  - ✓ Add collections to index page
-  - ✓ Basic styling
-      - ✓ Default type icons
-- ✓ QA
-  - ✓ ~50 resource data set
+## Prototype (design -> alpha) — DONE
 
-## Basic application (beta -> v1.0)
+- Configuration + config parser
+  - Application
+  - Content model
+    - Validation rules
+- Submission module
+  - SIP building
+  - Metadata from LL
+  - Brick structures
+  - Structure inference
+- HTML generator
+  - Index
+  - Resource
+  - Static assets
+- Non-HTML generators
+  - RDF (turtle)
+  - Transformers
+  - JS search engine index
+- CLI
+  - Init archive
+  - Deposit
+  - Generate site
+  - Generate LL (single resource)
+  - Generate RDF (single resource)
+- Front end
+  - JS search engine
+  - Add collections to index page
+  - Basic styling
+      - Default type icons
+- QA
+  - ~50 resource data set
+
+## Basic application (alpha -> beta -> v1.0) — IN PROGRESS
 
 - ✖︎ Management UI & API
   - ✖︎ Deposit via single tar or zip file submission
 - ⚒ Deposit via local hot folder
+  - ✓ Watch local folder and trigger deposit
+  - ❏ Option to regenerate site after deposit
   - ❏ Option to clean up sources & LL on success
 - ⚒ Proper collection handling
   - ✓ Dedicated template
@@ -59,6 +64,7 @@ functional and available for use by the intended audience.
   - ❏ Relatioships inference
   - ❏ Markdown support for individual fields
 - ❏ Generator
+  - ❏ Generate site for one collection only
   - ❏ htmlgen option for local file or webserver URL generation
   - ❏ Generate LL (multi)
   - ❏ Generate RDF (multi)
@@ -77,9 +83,9 @@ functional and available for use by the intended audience.
   - ❏ Site generation guide
   - ❏ Content modeling guide (including proxy concepts)
 
-## Post-basic
+## Post-release
 
-- Deposit via remote hot folder
+- ✖︎ Deposit via remote hot folder (addressed by separate FTP server)
   - FTP
   - S3
 - Incremental build

+ 1 - 0
pocket_archive-scm-1.rockspec

@@ -24,6 +24,7 @@ dependencies = {
    "datafile",
    "etlua",
    "ftcsv",
+   "libmagic",
    "lua-cjson",
    "lua-vips",
    "luaposix",

+ 4 - 5
src/core.lua

@@ -1,3 +1,4 @@
+local datafile = require "datafile"
 local dir = require "pl.dir"
 local path = require "pl.path"
 local store = require "volksdata.store"
@@ -13,10 +14,10 @@ local PROTECTED = {
 }
 
 
-local fpath = debug.getinfo(1, "S").source:sub(2)
-local root_path = path.dirname(path.dirname(fpath))
 local config_path = os.getenv("PKAR_CONFIG_DIR") or
-        path.join(root_path, "/config")
+        path.dirname(datafile.path("config/app.lua"))
+
+print ("Using config at:", config_path)
 
 local config = dofile(path.join(config_path, "app.lua"))
 local store_id = "file://" .. (os.getenv("PKAR_BASE") or config.fs.dres_path)
@@ -27,11 +28,9 @@ for pfx, ns in pairs(config.namespace) do nsm.add(pfx, ns) end
 
 local M = {
     -- Project root path.
-    root = root_path,
     config_path = config_path,
     config = config,
 
-    default_title = "Pocket Archive",
     store_id = store_id,
 
     --Logger config.

+ 4 - 5
src/generator.lua

@@ -210,7 +210,7 @@ local function generate_coll(s, mconf)
 
     out_html = templates.coll.data({
         --webroot = M.webroot,
-        site_title = pkar.config.site.title or pkar.default_title,
+        site_title = pkar.config.site.title,
         title = title.data,
         description = description.data,
         body = body,
@@ -343,7 +343,7 @@ local function generate_dres(s, mconf)
 
     out_html = templates.dres.data({
         --webroot = M.webroot,
-        site_title = pkar.config.site.title or pkar.default_title,
+        site_title = pkar.config.site.title,
         title = title or s.data,
         head_tpl = templates.head.data,
         header_tpl = templates.header.data,
@@ -453,7 +453,7 @@ local function generate_ores(s, mconf)
 
     out_html = templates.ores.data({
         --webroot = M.webroot,
-        site_title = pkar.config.site.title or pkar.default_title,
+        site_title = pkar.config.site.title,
         fname = path.basename(techmd.source_path[1]),
         head_tpl = templates.head.data,
         header_tpl = templates.header.data,
@@ -678,8 +678,7 @@ M.generate_homepage = function()
 
     out_html = templates.idx.data({
         webroot = M.webroot,
-        title = pkar.config.site.title or pkar.default_title,
-        site_title = pkar.config.site.title or pkar.default_title,
+        site_title = pkar.config.site.title,
         head_tpl = templates.head.data,
         header_tpl = templates.header.data,
         nsm = nsm,

+ 2 - 1
src/model.lua

@@ -5,6 +5,7 @@ local term = require "volksdata.term"
 local nsm = require "volksdata.namespace"
 
 local pkar = require "pocket_archive"
+local logger = pkar.logger
 
 local dbg = require "debugger"
 
@@ -47,7 +48,7 @@ local function parse_model(mod_id)
     local hierarchy = {}
 
     local function traverse(mod_id)
-        print("traversing:", mod_id)
+        logger:debug("traversing: " .. mod_id)
         local model = dofile(path.join(
                 MODEL_PATH, "typedef", mod_id .. ".lua"))
         -- Merge separate generator config

+ 1 - 1
src/util/pkar.lua

@@ -34,7 +34,7 @@ list = cli.command {
     "List all resource IDs.",
 
     function()
-        for _, s in pairs(repo.gr:unique_terms(triple.POS_S)) do
+        for s in repo.gr:unique_terms(triple.POS_S):iter() do
             print(nsm.denormalize_uri(s.data))
         end
     end,

+ 1 - 1
templates/index.html

@@ -12,7 +12,7 @@
     <body>
         <%- header_tpl({site_title = site_title}) %>
         <main>
-            <h1 class="title"><%= title %></h1>
+            <h1 class="title"><%= site_title %></h1>
             <section id="search">
                 <h2>Search</h2>
                 <form action="/" method="GET">