clartaq / cwiki

A personal wiki written in Clojure/Script
Other
3 stars 0 forks source link

CWiki

CWiki is a simple personal wiki application. You use your browser to view and edit the content. It runs on your local machine. You can link to external sites on the internet, but the content you create stays on your computer.

Note

CWiki was moved from BitBucket using Mercurial to Github using git on 5 February, 2020. As a result, all history on tracked issues before that time was lost.

Warning

CWiki is alpha-quality software. It does useful things, but many planned features are not present. (The program will usually tell you so if you try to do something that it cannot accomplish yet. Or it might just crash.) Probably full of bugs too. See the "Issues" page in the project repository.

Features

Running the Program

Prerequisites

Java 17 (OpenJDK/Temurin 17) for development and testing. It should compile and run under version 8, but this is not tested.

Run a Prebuilt Jar

NOTE: This section is out of date. Since switching to git and GitHub, there are no longer prebuilt jars in the repository. (They were handled separately on BitBucket.) I'm leaving this section here to remind me to fix that soon.

The easiest way to try things out is to download a prebuilt jar file from the repository. This will only work with CWiki version 0.0.11 or later.

  1. Copy the jar to whatever directory you would like. I use ~/cwiki.
  2. In a terminal, change to the directory where the jar is located: cd ~/cwiki.
  3. Start the program by running the jar: java -jar cwiki.jar.

The first time the program starts up in a particular location, it will take a little time to build the initial database of pages and indices. Then it will start your default browser. Log in the first time as "admin" with the password "admin."

The seed database has pages describing how to use CWiki and other stuff. Explore.

Running in a Development Environment

If you have a copy of the repository, you can run from the source code as described next.

From the REPL

You will need the Leiningen build tool, version 1.7.0 or above, installed. From a terminal in the project directory, start a Leiningen REPL. Leiningen will take care of downloading all the dependencies for you. The REPL will begin in the cwiki.repl namespace, which has some functions to start and stop the app quickly.

To start the program, use:

cwiki.repl=> (start)

To stop the program, use:

cwiki.repl=> (stop)

I ​run this way in IntelliJ using Cursive to start a REPL.

Note on Using the Cursive REPL: After a lein clean or other operation that deletes the target files, the Cursive REPL will attempt to re-compile the wiki-attributes.clj file. You will need to build the extension manually first. Use something like lein cljsbuild once min from the command line. Then you should be able to run the Cursive REPL. (The cljsbuild task incudes a prep task that builds the extension correctly.) Things will proceed as normal.

Attempting to run from the lein repl command seems to work just fine.

From a Terminal

From a terminal in the project directory, type

lein cljsbuild once min && lein run

to run, possibly with compilation first.

Use

lein start-prod

to clean, recompile, and run the minimized (production) build.

Creating and Running a Standalone Program

To create a stand-alone program, execute lein uberjar.

After the build process finishes, you can run the program from the command line with

java -jar target/cwiki.jar

Running the First Time

When running for the very first time, there will be a pause of several seconds as the database containing the initial wiki content is created. The program will start a local web server and start up your default web browser to display the initial content of the wiki.

Since the program has never run before, you will be asked to sign in as the "admin" user. Just follow the instructions on the screen.

Running Tests

Clojure

To run tests on the Clojure code, open a terminal in the project directory and enter:

lein test

ClojureScript

You can run tests on the ClojureScript code by opening a terminal and typing:

clj -M:fig:test

(I switched to using the Clojure command line interface (CLI) and deps (guide) along with Figwheel Main because of the painful mess that is ClojureScript testing with Leiningen. It is no fault of the Leiningen tool. It's just that the stack of tools is constantly changing and losing support or moving on to next "shiny new thing". There is much less setup this way and it just works.

Yes, it's pretty weird to use both figwheel "classic" and Figwheel Main in the same project.)

License

This software is licensed under the BSD Simplified 2-Clause License. See the LICENSE.txt file.

Copyright © 2017-2022 David D. Clark