Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
create class index, and do test updates to a single class
Browse files Browse the repository at this point in the history
  • Loading branch information
mbwhite committed Oct 30, 2017
1 parent 9d3b858 commit b7ef762
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/composer-admin/lib/adminconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,20 @@ class AdminConnection {
const locationName = card.getBusinessNetworkName() || card.getConnectionProfile().name;
name = card.getUserName() + '@' + locationName;
}
return this.cardStore.put(name, card).then(() => {
return name;
});
let connectionProfileData;
return this.cardStore.put(name, card)
.then(() => {
connectionProfileData = card.getConnectionProfile();
return this.connectionProfileManager.getConnectionManagerByType(connectionProfileData.type);
})
.then((connectionManager)=>{
let certificate = card.getCredentials().certificate;
let privateKey = card.getCredentials().privateKey;
return connectionManager.importIdentity(connectionProfileData.name,connectionProfileData, name.getUserName(), certificate, privateKey);
})
.then( ()=>{
return name;
});
}

/**
Expand Down
36 changes: 36 additions & 0 deletions packages/composer-website/apigen-opus/_template/classindex.njk
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 %}

70 changes: 70 additions & 0 deletions packages/composer-website/scripts/merge.js
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);
}
}

0 comments on commit b7ef762

Please sign in to comment.