Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: recommend using pre-commit hook

There are a few things that will make managing your pico engine and writing KRL code easier. 

Managing your Pico Engine

If you need to remove your pico engine and change to a different version, follow these instructions.

  1. If you wish to remove all picos and start over, use one or more of these commands.

    Code Block
    rm -r ~/.pico-engine/db #removes all picos and cached ruleset source code
    rm -r ~/.pico-engine/rulesets #removes compiled ruleset node modules
    rm -r ~/.pico-engine #shortcut to do both of the above
  2. Remove the pico engine code.

    Code Block
    npm rm -g pico-engine
  3. Install a specific version of the pico engine code. In this example, the engine as of February 22March 13, 2017 was at version 0.5.17.

    Code Block
    npm install -g pico-engine@0.5.7

Running multiple pico engines

To run multiple pico engines on the same host, you will need to assign each instance of the engine a different port and a different folder for its database and ruleset cache. For example, while running a pico engine listening on the default port, and using the default location for its database, you could start an additional instance with a command like this one:

Code Block
PORT=8081 PICO_ENGINE_HOME=~/.pico-engine-1 pico-engine


Hosting Code

Because the rules engine reads your KRL program from the Web, it has to be available online. You can host it anywhere, but Github works especially well. See these instructions for more information about how to use Github to host KRL

Info
titleEngine Compatibility

Flushing rulesets (by use of a web hook) has not yet been implemented in the New Pico Engine

...

The pico engine compiles your KRL into a Node.js module, which it stores in a folder at ~/.pico-engine/rulesets. (Node.js is a trademark of Joyent, Inc. and is used with its permission. We are not endorsed by or affiliated with Joyent.)

Parsing KRL

You need to be able to check your ruleset for parse errors before checking it in. Debugging syntax errors on the rules engine is a messy business. 

There are two three ways to do it.

  1. You can use the "Engine Rulesets" page, hosted by the pico engine at http://localhost:8080/ruleset.html, and copy and paste your KRL ruleset into it. 
  2. You can download and run the node pico engine compiler on your own machine and run it from the command line. 
  3. You can install a pre-commit hook for git, so that your code is automatically parsed when you commit changes. If your code fails to parse, the change will not be committed.

The second method is and third methods are recommended for any serious development.

...