1
0
Fork 0
The arcology is a web publishing system for org-roam written in the literate fashion in phoenix elixir and emacs lisp
 
 
 
 
 
Go to file
Ryan Rix f39f665466 swing the axe, swing the axe 2021-02-21 18:38:12 -08:00
assets rip out foundation css 2021-01-12 18:51:18 -08:00
lisp you think i'd learn!! 2021-01-25 22:55:34 -08:00
rel/plugins Integrate Distillery releases 2020-12-14 19:26:22 -08:00
.gitignore trying to use the correct buildMix' instead of buildMix 2021-01-25 23:39:57 -08:00
404.org add the 404 page and route to it 2020-11-14 16:46:39 -08:00
Makefile Integrate Distillery releases 2020-12-14 19:26:22 -08:00
README.org stub media store 2021-01-12 18:54:04 -08:00
aesthetics.org disable disable comments on web template 2021-01-25 22:42:48 -08:00
arcology.org just moving shit around 2021-01-12 18:53:42 -08:00
arcology_db.org integrate inotify-tools in a genserver to rebuild db 2020-12-17 20:21:17 -08:00
arcology_media_store.org stub media store 2021-01-12 18:54:04 -08:00
arcology_page.org fix link routing, fully resolve paths 2020-11-14 16:48:31 -08:00
arcology_roam.org plumb properties-backed backlinks and tags through to the Arcology.Page 2020-11-13 12:45:59 -08:00
arcology_sitemap.org sitemap needs a bit more time to settle 2021-01-12 19:01:11 -08:00
arcology_web.org rip out foundation css 2021-01-12 18:51:18 -08:00
default.nix swing the axe, swing the axe 2021-02-21 18:38:12 -08:00
deploying.org swing the axe, swing the axe 2021-02-21 18:38:12 -08:00
docker.nix swing the axe, swing the axe 2021-02-21 18:38:12 -08:00
inotify-tools.org just moving shit around 2021-01-12 18:53:42 -08:00
link_routers.org add text to top of sitemap, clean it all up 2020-11-14 16:48:08 -08:00
mix.exs try to get rebar3_hex installed 2021-01-26 12:03:47 -08:00
mix.lock try to get rebar3_hex installed 2021-01-26 12:03:47 -08:00
page_controller.org rip out foundation css 2021-01-12 18:51:18 -08:00
phoenix.org trying to use the correct buildMix' instead of buildMix 2021-01-25 23:39:57 -08:00
rebar-overlay.nix swing the axe, swing the axe 2021-02-21 18:38:12 -08:00
shell.nix spending a bit more time on this... closer? 2021-02-19 23:44:35 -08:00
sitemap.org add sitemap template, should rebase this 2020-11-14 16:52:00 -08:00
testing.org add ARCOLOGY_KEYs 2020-10-11 20:09:09 -07:00
usersocket.org add ARCOLOGY_KEYs 2020-10-11 20:09:09 -07:00

README.org

Arcology: An Org Roam Publishing System

The Arcology is a system for publishing my org-mode documents to the web, an important component of Ryan Rix's Complete Computing Environment. Rather than a pure static-site design, a directory full of "compiled HTML", the Arcology aims to provide just enough dynamicity to make publishing on the web simple, transparent, and powerful. Arcology uses the same database caching that Org Roam uses with some custom extensions to provide a web-view of a subset of documents in my knowledge base, and "indieweb" facilities around this like microformats, webmentions, indieauth, and some day a full ActivityPub implementation for my Journal and a "link blog" of my Archive posts.

This project is a repository of Org Mode formatted documents which describe and implement a web service written in Elixir using the Phoenix Framework. Rather than directly editing the source code, these documents are edited instead source code, justification and the links between disparate modules and data-flows expressed in text as well as code.

Table of Contents

Building

There is a Makefile to make it easier to tangle the files. You will need Emacs and Org-mode installed for this to work. Some day all of this will be in Mix tasks that can contain the whole set of dependencies.

make tangle will tangle any org document which is newer than a handle left in _build. It's important to keep your tangled documents up to date with the file system, but for development it's likely that you're sending the Elixir code to a running IEx session, there will be an org-mode documentation providing for this at some point soon.

make init will tangle, download dependencies, and compile them.

Developing in a REPL and a Babel doc

Arcology development requires a postgres database with a database called arcology_dev. run shell:mix ecto.setup (or click on that link!)

Executing this code will allow you to send the org-babel block under point to the REPL. I don't know how that handles noweb, blocks but it kinda works. Most of the time, I rely on automatically tangling and recompiling.

(use-package eval-in-repl
  :config
  (require 'eval-in-repl-ielm)
  
  ; i disable transient mark mode
  (defun eir-eval-in-iex ()
    "Provides eval-in-repl for Elixir."
    (interactive)
    ;; Define local variables
    (let* ()
      (eir-repl-start "\\*Alchemist-IEx\\*" #'alchemist-iex-run t)
      (eir-send-to-iex (buffer-substring-no-properties (point) (mark)))))

  (setq eir-repl-placement 'left)
  (setq eir-jump-after-eval nil)
  (setq eir-ielm-eval-in-current-buffer t))

(use-package org-babel-eval-in-repl
  :after ob
  :config
  (add-to-list 'ober-org-babel-type-list '("elixir" . (eval-in-repl-iex eir-eval-in-iex)))
  (evil-define-key 'normal 'org-mode-map (kbd "C-<return>") #'ober-eval-in-repl)
  (evil-define-key 'normal 'org-mode-map (kbd "M-<return>") #'ober-eval-block-in-repl))

(use-package alchemist)

Alchemist can run an IEx shell with iex -S mix phx.server">iex -S mix phx.server, and run tests with mix test.watch">mix test.watch.

Run this with Alt-Return to disable colors and see the IEx shell in action. Many "naked" code blocks can be evaluated in this fashion, but EIR doesn't support noweb blocks.

alias Arcology.{Repo,Roam,Page}
IEx.configure(colors: [enabled: false])

To trigger a tangle after org-src blocks, run this code. Opening an org-src block will do a bunch of window-modification which isn't restored properly by winner-mode, so stepping in and out of org-src blocks kind of sucks. I have C-x s bound to org-edit-src-save, and attach this function to it with the Emacs Advising Functions.

(defun arcology/tangle-on-block-save ()
  (org-babel-tangle-file org-src-source-file-name))
(advice-add 'org-edit-src-save :after #'arcology/tangle-on-block-save)

To trigger a recompile in iex after tangle, execute this block. It'll also touch the files which the Makefile checks for "up-to-date"-ness in the tangle task which'll need to be run by build scripts. This code is kind of cursed; you see, org-babel has a pre-tangle hook which isn't so useful, but current-buffer is the org-mode doc. The post-tangle hook is ran in each output file. So this cursed code runs an idle timer!

(defun arcology/idle-file-for-make-command ()
  (run-with-idle-timer 1 nil #'arcology/recompile-iex))

(defun arcology/recompile-iex ()
  (let* ((file (or org-src-source-file-name (buffer-file-name)))
         (touch-file (replace-regexp-in-string "\\([^/]+\\)\\.org$" "_build/\\1.touch" file)))
    (when (s-contains? "arcology" file)
      (message "touch %s" touch-file)
      (call-process-shell-command (format "touch %s" touch-file))
      (eir-send-to-iex "recompile"))))

(add-hook #'org-babel-pre-tangle-hook #'arcology/idle-file-for-make-command)

Footnotes