This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create class index, and do test updates to a single class
- Loading branch information
Showing
3 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/composer-website/apigen-opus/_template/classindex.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
layout: default | ||
title: API Class Index | ||
section: api | ||
sidebar: sidebars/accordion-toc0.md | ||
excerpt: The Client, Admin, and Runtime components of Hyperledger Composer | ||
index-order: {{index}} | ||
--- | ||
# Index of Classes | ||
|
||
- [Common API](#common-api) | ||
- [Client API](#client-api) | ||
- [Admin API](#admin-api) | ||
- [Runtime API](#runtime-api) | ||
|
||
## Common API | ||
| Name | Description | | ||
| :---- | :----------- | | ||
{% for c in common | sort(attribute='name') %}| [{{c.name}}](common-{{c.name | lower}}) | {{c.description}} | | ||
{% endfor %} | ||
## Client API | ||
| Name | Description | | ||
| :---- | :----------- | | ||
{% for c in client | sort(attribute='name') %}|[{{c.name}}](client-{{c.name | lower}}) | {{c.description}} | | ||
{% endfor %} | ||
## Admin API | ||
| Name | Description | | ||
| :---- | :----------- | | ||
{% for c in admin | sort(attribute='name') %}| [{{c.name}}](admin-{{c.name | lower}})| {{c.description}} | | ||
{% endfor %} | ||
## Runtime API | ||
| Name | Description | | ||
| :---- | :----------- | | ||
{% for c in runtime | sort(attribute='name') %}| [{{c.name}}](runtime-{{c.name | lower}}) | {{c.description}} | | ||
{% endfor %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
|
||
let masterData = {}; | ||
|
||
// Loop through all the files in the input directory | ||
processDirectory('./jsondata/'); | ||
|
||
/** | ||
* Processes all the Javascript files within a directory. | ||
* | ||
* @param {string} path - the path to process | ||
* @private | ||
*/ | ||
function processDirectory(path) { | ||
let items = []; | ||
fs.walk(path) | ||
.on('readable', function (item) { | ||
while ((item = this.read())) { | ||
if (item.stats.isFile()) { | ||
items.push(item.path); | ||
} | ||
} | ||
}) | ||
.on('end', () => { | ||
items.sort(); | ||
items.forEach((item) => { | ||
processFile(item); | ||
}); | ||
|
||
fs.writeFileSync('allData.json',JSON.stringify(masterData),'utf8'); | ||
}); | ||
} | ||
|
||
/** | ||
* Processes a single Javascript file (.js extension) | ||
* | ||
* @param {string} file - the file to process | ||
* @private | ||
*/ | ||
function processFile(file, fileProcessor) { | ||
let filePath = path.parse(file); | ||
if (filePath.ext === '.json') { | ||
console.log('%s is a file.', file); | ||
let fileContents = fs.readFileSync(file, 'utf8'); | ||
let data = JSON.parse(fileContents); | ||
let m = data.module; | ||
|
||
if (!masterData.hasOwnProperty(m)){ | ||
masterData[m] = []; | ||
} | ||
masterData[m].push(data); | ||
} | ||
} |