forked from rddill-IBM/ZeroToBlockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added generator for composer documentation
- Loading branch information
Bob Dill
committed
Sep 1, 2017
1 parent
38bc71b
commit 11a78b8
Showing
12 changed files
with
1,088 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[1;33m' | ||
RED='\033[1;31m' | ||
GREEN='\033[1;32m' | ||
RESET='\033[0m' | ||
|
||
# indent text on echo | ||
function indent() { | ||
c='s/^/ /' | ||
case $(uname) in | ||
Darwin) sed -l "$c";; | ||
*) sed -u "$c";; | ||
esac | ||
} | ||
|
||
# Grab the current directory | ||
function getCurrent() | ||
{ | ||
showStep "getting current directory" | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
THIS_SCRIPT=`basename "$0"` | ||
showStep "Running '${THIS_SCRIPT}'" | ||
echo $DIR | ||
|
||
} | ||
|
||
# displays where we are, uses the indent function (above) to indent each line | ||
function showStep () | ||
{ | ||
echo -e "${YELLOW}=====================================================" | indent | ||
echo -e "${RESET}-----> $*" | indent | ||
echo -e "${YELLOW}=====================================================${RESET}" | indent | ||
} | ||
CHAPTER_DIR="" | ||
DIR="" | ||
REPO_DIR="" | ||
ADMIN_DIR="node_modules/composer-admin" | ||
CLIENT_DIR="node_modules/composer-client" | ||
CLI_DIR="node_modules/composer-cli" | ||
COMMON_DIR="node_modules/composer-common" | ||
HLFV1_DIR="node_modules/composer-connector-hlfv1" | ||
RUNTIME_DIR="node_modules/composer-runtime" | ||
declare -a elements=("${ADMIN_DIR}" "$CLIENT_DIR" "${COMMON_DIR}" "${HLFV1_DIR}" "${RUNTIME_DIR}") | ||
declare -a folders=('Admin' 'Client' 'Common' 'hlfv1' 'Runtime') | ||
|
||
|
||
# get current folder | ||
showStep "getting current directory path" | ||
getCurrent | ||
CHAPTER_DIR=$DIR | ||
echo "${CHAPTER_DIR}" | ||
for i in "${elements[@]}" | ||
do | ||
# switch to folder | ||
showStep "Changing to ${i}" | ||
cd "${i}" | ||
pwd | ||
# generate docs | ||
showStep "Generating Documentation" | ||
jsdoc --pedantic --recurse -c jsdoc.json | ||
cd ../../ | ||
done | ||
|
||
# get current folder -1 | ||
showStep "getting repo root folder" | ||
cd ../ | ||
pwd | ||
getCurrent | ||
REPO_DIR=$DIR | ||
|
||
# remove old folders | ||
showStep "Removing old documentation folders" | ||
cd Composer_Docs | ||
pwd | ||
for i in "${folders[@]}" | ||
do | ||
# switch to folder | ||
showStep "removing old docs in ${i}" | ||
rm -rf "${i}" | ||
mkdir "${i}" | ||
done | ||
# copy new content | ||
showStep "copying new content" | ||
pwd | ||
count=${#elements[@]} | ||
for i in `seq 1 $count` | ||
do | ||
showStep "cp -R ${CHAPTER_DIR}/${elements[$i-1]}/out/ ${folders[$i-1]}" | ||
cp -R ${CHAPTER_DIR}/${elements[$i-1]}/out/ ${folders[$i-1]} | ||
done | ||
# display message on how to access documentation | ||
showStep "Hyperledger Composer API documentation has been generated for your current version of Composer. | ||
You can access this information by navigating to the ${GREEN}Composer_Docs${RESET} folder in your repo | ||
and opening the ${GREEN}index.html${RESET} file located there in your favorite browser" |
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,95 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[1;33m' | ||
RED='\033[1;31m' | ||
GREEN='\033[1;32m' | ||
RESET='\033[0m' | ||
|
||
# indent text on echo | ||
function indent() { | ||
c='s/^/ /' | ||
case $(uname) in | ||
Darwin) sed -l "$c";; | ||
*) sed -u "$c";; | ||
esac | ||
} | ||
|
||
# Grab the current directory | ||
function getCurrent() | ||
{ | ||
showStep "getting current directory" | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
THIS_SCRIPT=`basename "$0"` | ||
showStep "Running '${THIS_SCRIPT}'" | ||
echo $DIR | ||
|
||
} | ||
|
||
# displays where we are, uses the indent function (above) to indent each line | ||
function showStep () | ||
{ | ||
echo -e "${YELLOW}=====================================================" | indent | ||
echo -e "${RESET}-----> $*" | indent | ||
echo -e "${YELLOW}=====================================================${RESET}" | indent | ||
} | ||
CHAPTER_DIR="" | ||
DIR="" | ||
REPO_DIR="" | ||
ADMIN_DIR="node_modules/composer-admin" | ||
CLIENT_DIR="node_modules/composer-client" | ||
CLI_DIR="node_modules/composer-cli" | ||
COMMON_DIR="node_modules/composer-common" | ||
HLFV1_DIR="node_modules/composer-connector-hlfv1" | ||
RUNTIME_DIR="node_modules/composer-runtime" | ||
declare -a elements=("${ADMIN_DIR}" "$CLIENT_DIR" "${COMMON_DIR}" "${HLFV1_DIR}" "${RUNTIME_DIR}") | ||
declare -a folders=('Admin' 'Client' 'Common' 'hlfv1' 'Runtime') | ||
|
||
|
||
# get current folder | ||
showStep "getting current directory path" | ||
getCurrent | ||
CHAPTER_DIR=$DIR | ||
echo "${CHAPTER_DIR}" | ||
for i in "${elements[@]}" | ||
do | ||
# switch to folder | ||
showStep "Changing to ${i}" | ||
cd "${i}" | ||
pwd | ||
# generate docs | ||
showStep "Generating Documentation" | ||
jsdoc --pedantic --recurse -c jsdoc.json | ||
cd ../../ | ||
done | ||
|
||
# get current folder -1 | ||
showStep "getting repo root folder" | ||
cd ../ | ||
pwd | ||
getCurrent | ||
REPO_DIR=$DIR | ||
|
||
# remove old folders | ||
showStep "Removing old documentation folders" | ||
cd Composer_Docs | ||
pwd | ||
for i in "${folders[@]}" | ||
do | ||
# switch to folder | ||
showStep "removing old docs in ${i}" | ||
rm -rf "${i}" | ||
mkdir "${i}" | ||
done | ||
# copy new content | ||
showStep "copying new content" | ||
pwd | ||
count=${#elements[@]} | ||
for i in `seq 1 $count` | ||
do | ||
showStep "cp -R ${CHAPTER_DIR}/${elements[$i-1]}/out/ ${folders[$i-1]}" | ||
cp -R ${CHAPTER_DIR}/${elements[$i-1]}/out/ ${folders[$i-1]} | ||
done | ||
# display message on how to access documentation | ||
showStep "Hyperledger Composer API documentation has been generated for your current version of Composer. | ||
You can access this information by navigating to the ${GREEN}Composer_Docs${RESET} folder in your repo | ||
and opening the ${GREEN}index.html${RESET} file located there in your favorite browser" |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>HyperLedger Composer Documentation</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">HyperLedger Composer Documentation</h1> | ||
|
||
<ul> | ||
<li><a href="./Admin/index.html">Composer Admin API Docs</a></li> | ||
<li><a href="./Client/index.html">Composer Client API Docs</a></li> | ||
<li><a href="./Common/index.html">Composer Common API Docs</a></li> | ||
<li><a href="./hlfv1/index.html">Composer hlfv1 API Docs</a></li> | ||
<li><a href="./Runtime/index.html">Composer Runtime API Docs</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
|
||
</body> | ||
</html> |
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,25 @@ | ||
/*global document */ | ||
(function() { | ||
var source = document.getElementsByClassName('prettyprint source linenums'); | ||
var i = 0; | ||
var lineNumber = 0; | ||
var lineId; | ||
var lines; | ||
var totalLines; | ||
var anchorHash; | ||
|
||
if (source && source[0]) { | ||
anchorHash = document.location.hash.substring(1); | ||
lines = source[0].getElementsByTagName('li'); | ||
totalLines = lines.length; | ||
|
||
for (; i < totalLines; i++) { | ||
lineNumber++; | ||
lineId = 'line' + lineNumber; | ||
lines[i].id = lineId; | ||
if (lineId === anchorHash) { | ||
lines[i].className += ' selected'; | ||
} | ||
} | ||
} | ||
})(); |
Oops, something went wrong.