$ bower install --save ezsystems/ez-js-rest-client
Then you can include in your project the file
bower\_components/ez-js-rest-client/dist/CAPI-min.js (or the non minified
version). It's also possible to directly take
dist/CAPI-min.js in a clone of this repository.
The project maintenance is handled in a nodejs based environment with a help of Grunt task runner.
- Install nodejs
- Clone this repository
- From the root of the repository, install the local npm dependencies:
$ npm install
- Install the global dependencies (usually you need to be root)
# npm install -g grunt-cli yuidocjs
api directory with:
$ grunt doc
Alternatively, you can run
$ grunt livedoc
The library can be built with:
$ grunt build
This command will (re)generate the files
#### Unit tests
The unit tests can be executed with:
$ grunt test
It's also possible to generate a coverage report with:
$ grunt coverage
After this command, the report is available in
During development it may be quite handy to automatically rerun unit-tests and/or lint checks, once any project related file has changed.
Using so called
watch tasks this can easily be achieved. Currently the following
of those tasks exist:
watch:lint: On each file change execute a linting run
watch:test: Execute a unit-test run on each file change
The library can be manually tested by installing the Symfony2 bundle jsRestClientBundle, which is situated in the test/manual/ folder.
Before bundle installation run
grunt build command once. It will build all the
source files into Resources/public/js/CAPI.js file.
Then the bundle could be installed into your current ezPublish 5.x instance using following instruction:
path/to/ezpublish5/src/EzSystemsif it does not exist.
Symlink the bundle into /src/EzSystems/ (keep folder name).
Edit /app/AppKernel.php and add the following line before in the return statement of the method registerBundles:
$bundles = new EzSystems\jsRestClientBundle\jsRestClientBundle();
Import routing.yml file of the bundle into main routing file by adding the following lines at the very bottom of
jsRestClientBundle: resource: "@jsRestClientBundle/Resources/config/routing.yml"
Clear the Symfony 2 caches with app/console.
After these steps you may access
/js-rest-client-test/ path where you will find
testing html page. Most of requests can be configured a little bit before
executing them by changing input values. See details of tests implementation in