/metafacture-playground

Web application to play around with workflows using Fix and Flux

Primary LanguageClojureApache License 2.0Apache-2.0

Metafacture Playground

This is an approach to provide a web application to play around with Metafactures languages Fix and Flux inspired by the JSON-LD Playground. This project is inititially created using the leiningen re-frame template.

The current test deployment is available at http://test.lobid.org/playground/

Installation

Before starting you need to install Leiningen and a JDK (minimum Java 8).

Install Leiningen

General setup on Unix (see https://leiningen.org/ for other options):

mkdir ~/bin
wget -O ~/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod a+x ~/bin/lein

Install Metafacture

This project depends on metafacture-core and metafacture-fix. Clone and install both repositories (branch oersi).

Clone and install metafacture-core:

$ git clone --branch oersi https://github.com/metafacture/metafacture-core.git
$ cd metafacture-core

Unix:

$ ./gradlew install

Windows:

$ .\gradlew.bat install

Clone and install metafacture-fix:

$ git clone --branch oersi https://github.com/metafacture/metafacture-fix.git
$ cd metafacture-fix

Unix:

$ ./gradlew install

Windows:

$ .\gradlew.bat install

Clone the metafacture-playground project

$ git clone https://github.com/metafacture/metafacture-playground.git
$ cd metafacture-playground

Start in development mode

When using development mode you don't have to restart when changing files. They will be reloaded automatically.

lein watch

Wait a bit, perhaps 20 seconds, keeping an eye out for a sign the compile has finished, then browse to http://localhost:8280.

Start in production mode

To compile and build the frontend run:

lein release

Then start the server with:

lein run

Browse to http://localhost:3000.

Run workflows on the web server, passing data, flux, and fix:

http://localhost:3000/process?data='1'{'a': '5', 'z': 10}&flux=as-lines|decode-formeta|fix|encode-formeta(style="multiline")&fix=map(a,b) map(_else)

Run tests

clj tests

Install karma and headless chrome

npm install -g karma-cli

Point to your Chrome binary, e.g.

export CHROME_BIN='/usr/bin/chromium-browser'

And then run your tests

lein watch

And in another terminal:

karma start

clj tests

Run

lein test

Run workflows on the web server

Run workflows on the web server, passing data, flux, and fix as GET-Parameter:

http://localhost:3000/process?data='1'{'a': '5', 'z': 10}&flux=as-lines|decode-formeta|fix|encode-formeta(style="multiline")&fix=map(a,b) map(_else)