Skip to content

Commit

Permalink
Namespace docs (hyperledger-archives#3666)
Browse files Browse the repository at this point in the history
* add docs to system namespace

Signed-off-by: Matthew B White <[email protected]>

* add in the bna documentation tools

Signed-off-by: Matthew B White <[email protected]>

* updates to support both system and network docs

Signed-off-by: Matthew B White <[email protected]>

* adding in fv

Signed-off-by: Matthew B White <[email protected]>

* add intergation tests and possible new start scripts

Signed-off-by: Matthew B White <[email protected]>

* putting back a randomly lost network

Signed-off-by: Matthew B White <[email protected]>

* review comments

Signed-off-by: Matthew B White <[email protected]>
  • Loading branch information
mbwhite authored Mar 26, 2018
1 parent 5e63822 commit 0a3c8a8
Show file tree
Hide file tree
Showing 131 changed files with 11,588 additions and 25 deletions.
36 changes: 36 additions & 0 deletions packages/composer-cli/lib/cmds/generator/createDocsCommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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 docs = require('composer-documentation');

module.exports.command = 'docs [options]';
module.exports.describe = 'Create HTML Documentation from a Business Network Archive';
module.exports.builder = function (yargs){

yargs.options(
{
'archive':{alias: 'a', required: true, describe: 'Business network archive file name. Default is based on the Identifier of the BusinessNetwork', type: 'string'},
'config':{alias: 'c', required: false, default:'',describe: 'Path to the configuration file to use, default is one specificaly for BNA files'},
'outdir':{alias: 'o', required: false, default: './out', describe:'Output Location'}
}
);
yargs.usage('composer generator docs --archiveFile digitialPropertyNetwork.bna');
return yargs;
};

module.exports.handler = (argv) => {
return argv.thePromise = docs(argv);
};
1 change: 1 addition & 0 deletions packages/composer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"composer-report": "0.19.0",
"composer-wallet-filesystem": "0.19.0",
"composer-wallet-inmemory": "0.19.0",
"composer-documentation": "0.19.0",
"homedir": "0.6.0",
"js-yaml": "3.10.0",
"mkdirp": "0.5.1",
Expand Down
31 changes: 30 additions & 1 deletion packages/composer-cli/test/generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'use strict';

const createCode = require('../../lib/cmds/generator/createCodeCommand.js');
const createDocs = require('../../lib/cmds/generator/createDocsCommand.js');
const cmd = require('../../lib/cmds/generator.js');
const yargs = require('yargs');
require('chai').should();
Expand All @@ -23,13 +24,19 @@ const sinon = require('sinon');
chai.should();
chai.use(require('chai-things'));
chai.use(require('chai-as-promised'));

const mockery = require('mockery');

describe('composer generator cmd launcher unit tests', function () {

let sandbox;

beforeEach(() => {

mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false
});

sandbox = sinon.sandbox.create();
sandbox.stub(yargs, 'usage').returns(yargs);
sandbox.stub(yargs, 'conflicts').returns(yargs);
Expand All @@ -40,6 +47,7 @@ describe('composer generator cmd launcher unit tests', function () {
});

afterEach(() => {
mockery.deregisterAll();
sandbox.restore();
});

Expand All @@ -49,6 +57,7 @@ describe('composer generator cmd launcher unit tests', function () {
cmd.command.should.include('generator');
cmd.desc.should.include('generator');
});

it('should call yargs correctly', () => {
sandbox.stub(yargs, 'commandDir');
cmd.builder(yargs);
Expand All @@ -70,4 +79,24 @@ describe('composer generator cmd launcher unit tests', function () {

});

describe('createDocs yargs builder function', () => {

it('should drive the yargs builder fn correctly',()=>{
createDocs.builder(yargs);
sinon.assert.calledOnce(yargs.options);
sinon.assert.calledOnce(yargs.usage);
});

it('should drive the yargs builder fn correctly',()=>{

const mockDocsGen = sinon.stub();
mockery.registerMock('composer-documentation',mockDocsGen);

let args = [];
createDocs.handler(args);

});

});

});
2 changes: 2 additions & 0 deletions packages/composer-common/lib/system/historian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Historian
documentation coming in another pr
Loading

0 comments on commit 0a3c8a8

Please sign in to comment.