Skip to content

clapierre/clapierre.github.io

Repository files navigation

Vellum

Build Status

Vellum is a JavaRosa XForm designer used in CommCare HQ.

Image courtesy of the ReMIND project.

Usage

Checkout the source from GitHub

Optionally, build an optimized version

$ make # artifacts will be in _build dir and also vellum.tar.gz

Then load it on a page using RequireJS, optionally with an existing jQuery instance:

<link rel="stylesheet" href="path/to/bootstrap.css"></link>
<link rel="stylesheet" href="path/to/vellum/style.css"></link>
<!-- optional, if using bundled jquery et al -->
<link rel="stylesheet" href="path/to/vellum/global-deps.css"></link>

<!-- 
Optionally reuse existing jQuery instance with Bootstrap.  
If not present, bundled versions will be loaded.  -->
<script src="jquery.js"></script>
<script src="bootstrap.js"></script>

<script src="require.js"></script>
<script>
    require.config({
        packages: [
            {
                name: 'jquery.vellum',
                location: "/path/to/vellum/src"
            }
        ]
    });

    require(["jquery.vellum"], function () {
        require(["jquery"], function ($) {
            $(function () {
                $('#some_div').vellum(VELLUM_OPTIONS);
            });
        });
    });
</script>

See here and tests/main.js for example options usage.

Vellum targets modern browsers. IE8 and earlier are not supported.

Contributing

Follow the Airbnb JavaScript Style Guide.

Install dependencies:

$ npm install

Build optimized version (test locally by changing useBuilt in tests/main.js):

$ make

Test in a browser:

$ `npm bin`/http-server -c-1
$ chromium-browser http://localhost:8080

By default, the test page will load the non-built version unless a built parameter is present in the query string.

Commands to run tests headlessly:

$ npm test
$ ./test
$ ./test --help # for advanced usage

Make dependency graph image:

$ make madge

Testing on Heroku

NOTE: this is outdated, and may not work anymore

This repo can be deployed to Heroku using heroku-buildpack-vellum, which is just a fork of heroku-buildpack-static with the build script from the standard Node.js buildpack added in order to install dependencies.

Until prune.io is available, we use Rainforest's fourchette along with a slightly modified version of their example fourchette app in order to create an isolated test environment for each Pull Request on Heroku.

The latest master is also deployed to vellum-master.herokuapp.com using drone.io. See here for a list of builds.