0.1.1 • Published 10 years ago

openstack.api.js v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

API.js Build Status Coverage Status

Pure angular implementation of the Openstack API clients.

Build

Requirements

In order to develop on this lib you need to have at least NodeJS installed.

Installation

  1. npm install -g gulp bower
  2. Use npm install && bower install inside project's folder to install all the required dependencies

Tasks

Usage: gulp (calls default task) or gulp [task_name]

Available tasks are:

  • clean : deletes the dist folder
  • jshint : runs jshint over the js files
  • test : runs the unit and e2e tests
  • test:unit : runs the unit tests once
  • test:unit:watch : runs the unit tests and then watch file changes of source and test them again everytime something change
  • test:unit:ci : runs the unit tests for travis ci (integration with coveralls)

e2e tests must have the api.json file set up, see the development section

  • test:e2e : runs the e2e tests once
  • test:e2e:watch : runs the e2e tests, watch for file changes, and test them again if something is different.
  • test:e2e:debug : allow the developer to debug e2e tests, to do that, you need to open a browser on localhost:9876/debug.html (port can vary if it is already used, look at the console output).
  • build : clean, checks source files with jshint, tests, and then build in the dist folder, the files openstack.api.js and openstack.api.min.js (default task)

Options

You can also specify on which module you want to run a task, by specifing its name with the --module=module1:module2 syntax.

All modules are listed in the modules section and in the config.json file in the modules section

For example to run tests over keystone.base module you just have to run (it works for all tasks except clean) gulp test:unit --modules="keystone.base"

Development

Run cp api.json.example api.json edit the api.json file, and replace the value of the URLs by the ones of your openstack config.

Then run the gulp e2e debug task: gulp test:e2e:debug.

For debugging, all the test files are available in your browser at the following address: http://localhost:9876/debug.html. You can now place a debugger statement wherever you want in order to debug your development.

Modules

Currently, the following modules are supported:

  • keystone.base: an implementation of keystone basic functionality, it allows you to ask for a token, and to list the tenants
  • heat: a quite finished implementation of the heat client, software configuration is not supported at this point.

Workflows

All modules have tests which can contact a real openstack service. These tests can be used to see a simple workflow on how you can use those services. Checks the documentation on each module test to see a description:

See it in action

For a quick start just to see the lib running you need

  1. git clone https://github.com/OpenstackJS/API.js && cd API.js
  2. follow the requirements and installation sections
  3. be sure to have a devstack or an openstack set up to interact, if not, please look at the local.conf file in the repo, for a default devstack
  4. cp api.json.example api.json then edit the file in order to provide informations for a devstack or an openstack instance
  5. checks the requirements of each worflows in order to have working tests

    **IMPORTANT:**
    * [heat](test/e2e/heat/README.md#requirements)
  6. gulp test:e2e:debug

  7. go to http://localhost:9876/debug.html and open the debugger (ctrl + alt + j for chrome on windows/linux, cmd + alt +j for macOS) of your browser to see if everything is working fine