Update README for oxidation.

This commit is contained in:
Richard Newman 2016-12-16 10:31:06 -08:00
parent 73f179c887
commit 44d50c9005

129
README.md
View file

@ -1,10 +1,10 @@
# Datomish
Datomish is a persistent, embedded knowledge base. It's written in ClojureScript, and draws heavily on [DataScript](https://github.com/tonsky/datascript) and [Datomic](http://datomic.com).
Datomish is a persistent, embedded knowledge base. It draws heavily on [DataScript](https://github.com/tonsky/datascript) and [Datomic](http://datomic.com).
Datomish compiles into a single JavaScript file, and is usable both in Node (on top of `promise_sqlite`) and in Firefox (on top of `Sqlite.jsm`). It also works in pure Clojure on the JVM on top of `jdbc-sqlite`.
The first version of Datomish was written in ClojureScript, targeting both Node (on top of `promise_sqlite`) and Firefox (on top of `Sqlite.jsm`). It also works in pure Clojure on the JVM on top of `jdbc-sqlite`.
There's an example Firefox restartless add-on in the [`addon`](https://github.com/mozilla/datomish/tree/master/addon) directory; build instructions are below.
This branch is for rewriting Datomish in Rust, giving us a smaller compiled output, better performance, more type safety, better tooling, and easier deployment into Firefox and mobile platforms.
## Motivation
@ -67,8 +67,6 @@ contribute.
Datomish is currently licensed under the Apache License v2.0. See the `LICENSE` file for details.
Datomish includes some code from DataScript, kindly relicensed by Nikita Prokopov.
## SQLite dependencies
@ -76,124 +74,3 @@ Datomish uses partial indices, which are available in SQLite 3.8.0 and higher.
It also uses FTS4, which is [a compile time option](http://www.sqlite.org/fts3.html#section_2).
## Prep
You'll need [Leiningen](http://leiningen.org).
```
# If you use nvm.
nvm use 6
lein deps
npm install
# If you want a decent REPL.
brew install rlwrap
```
## Running a REPL
### Starting a ClojureScript REPL from the terminal
```
rlwrap lein run -m clojure.main repl.clj
```
### Connecting to a ClojureScript environment from Vim
You'll need `vim-fireplace`. Install using Pathogen.
First, start a Clojure REPL with an nREPL server. Then load our ClojureScript REPL and dependencies. Finally, connect to it from Vim.
```
$ lein repl
nREPL server started on port 62385 on host 127.0.0.1 - nrepl://127.0.0.1:62385
REPL-y 0.3.7, nREPL 0.2.10
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (load-file "repl.clj")
Reading analysis cache for jar:file:/Users/rnewman/.m2/repository/org/clojure/clojurescript/1.9.89/clojurescript-1.9.89.jar!/cljs/core.cljs
Compiling out/cljs/nodejs.cljs
Compiling src/datomish/sqlite.cljs
Compiling src/datomish/core.cljs
ClojureScript Node.js REPL server listening on 57134
Watch compilation log available at: out/watch.log
To quit, type: :cljs/quit
cljs.user=>
```
in Vim, in the working directory:
```
:Piggieback (cljs.repl.node/repl-env)
```
Now you can use `:Eval`, `cqc`, and friends to evaluate code. Fireplace should connect automatically, but if it doesn't:
```
:Connect nrepl://localhost:62385
```
## To run tests in ClojureScript
Run `lein doo node test once`, or `lein doo node test auto` to re-run on file changes.
## To run tests in Clojure
Run `lein test`.
## To run smoketests with the built release library in a Node environment
```
# Build.
lein cljsbuild once release-node
npm run test
```
## To build for a Firefox add-on
```
lein cljsbuild once release-browser
```
### To build and run the example Firefox add-on:
First build as above, so that `datomish.js` exists.
Then:
```
cd addon
./build.sh
cd release
./run.sh
```
## Preparing an NPM release
The intention is that the `target/release-node/` directory is roughly the shape of an npm-ready JavaScript package.
To generate a require/import-ready `target/release-node/datomish.js`, run
```
lein cljsbuild once release-node
```
To verify that importing into Node.js succeeds, run
```
npm run test
```
## To locally install for ClojureScript use
```
lein with-profile node install
```
Many thanks to ([David Nolen](https://github.com/swannodette)) and ([Nikita Prokopov](https://github.com/tonsky)) for demonstrating how to package ClojureScript for distribution via npm.