Skip to content
Snippets Groups Projects
Commit e5f1cc72 authored by Ambrus Simon's avatar Ambrus Simon Committed by GitHub
Browse files

Merge pull request #840 from scitran/update-api-console

Update api console
parents eafbd611 ff964984
No related branches found
No related tags found
No related merge requests found
Showing
with 39 additions and 572 deletions
### Updating api-console
1. Run a node container with the core root-dir bind-mounted:
`$ docker run -itv $(pwd):/core -w /core node bash`
2. Install [api-console](https://github.com/mulesoft/api-console)'s recommended [cli build tool](https://github.com/mulesoft/api-console/blob/master/docs/build-tools.md):
`$ npm install -g api-console-cli`
3. Generate "standalone" console into `./docs`:
`$ api-console build https://raw.githubusercontent.com/scitran/core/master/raml/api.raml --output ./docs`
Notes:
* This can take a couple minutes
* The `./docs` folder is recreated in the container
- Owned by root - use `sudo chown -R $USER:$USER docs` on the host
- Intermediate build artifacts can be removed: `$ rm -rf docs/bower_components docs/src`
- This readme gets wiped - use `git checkout docs/README.md`
4. Enable branch selection via search & replace in `docs/index.html`:
```javascript
document.querySelector("raml-js-parser").loadApi("https://raw.githubusercontent.com/scitran/core/master/raml/api.raml")
```
```javascript
var url=new URL(location.href);var branch=url.searchParams.get("branch")||"master";document.querySelector("raml-js-parser").loadApi("https://raw.githubusercontent.com/scitran/core/"+branch+"/raml/api.raml")
```
5. Test it out:
1. `$ cd docs && python2 -m SimpleHTTPServer`
2. Visit http://localhost:8000
This diff is collapsed.
<!doctype html>
<html>
<head>
<script type='text/javascript'>
function getVariable(string, variable) {
var vars = string.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
return undefined;
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
return getVariable(query, variable);
}
var result = {
token: getQueryVariable('oauth_token'),
verifier: getQueryVariable('oauth_verifier')
};
window.opener.RAML.authorizationSuccess(result);
window.close();
</script>
</head>
<body>
</body>
</html>
<!doctype html>
<html>
<head>
<script type='text/javascript'>
window.opener.oauth2Callback(window.location.href);
window.close();
</script>
</head>
<body>
</body>
</html>
docs/api/api-console/favicon.ico

6.37 KiB

File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment