Skip to content

Commit

Permalink
updated full tutorial to hyperledger-composer v0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Dill committed Dec 5, 2017
1 parent 9348f30 commit b628b78
Show file tree
Hide file tree
Showing 406 changed files with 32,763 additions and 27,024 deletions.
50 changes: 50 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
env:
es6: true
node: true
mocha: true
jquery: true
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 6
sourceType:
- script
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-unused-vars:
- error
- args: none
no-console: off
no-case-declarations: off
curly: error
eqeqeq: error
no-throw-literal: error
strict: error
no-var: error
dot-notation: error
no-tabs: error
no-trailing-spaces: error
no-use-before-define: error
no-useless-call: error
no-with: error
operator-linebreak: error
require-jsdoc:
- error
- require:
ClassDeclaration: true
MethodDefinition: true
FunctionDeclaration: true
valid-jsdoc:
- error
- requireReturn: false
yoda: error
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.js text
*.css text
*.html text
*.json text
*.sh text

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ jspm_packages

# OSX files
.DS_Store
# env.json
Chapter00
package-lock.json
*.key
*.ppt
*.pptx

composer-logs
*.bna
# Logs
Expand Down
6 changes: 5 additions & 1 deletion Chapter03/createArchive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ echo -e "Network Name is: ${GREEN} $NETWORK_NAME ${RESET}" | indent

showStep "creating archive"
cd ./network
composer archive create --sourceType dir --sourceName . -a ./dist/$NETWORK_NAME.bna
composer archive create --sourceType dir --sourceName . -a ./dist/$NETWORK_NAME.bna
#
# new create command from tutorial is following:
# composer archive create -t dir -n .
#
69 changes: 69 additions & 0 deletions Chapter03/create_composer_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

. ../common_OSX.sh

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
showStep "Chapter dir is: ${CHAPTER_DIR}"
for i in "${elements[@]}"
do
# switch to folder
showStep "Changing to ${i}"
cd "${i}"
pwd
# generate docs
showStep "Generating Documentation"
if [ ! -e "jsdoc.json" ]; then
cp jsdoc.conf jsdoc.json
fi
jsdoc --pedantic --recurse -c jsdoc.json
cd ../../
done

# get current folder -1
showStep "getting repo root folder"
cd ../
pwd
getCurrent
REPO_DIR=$DIR
showStep "repo dir is: ${REPO_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 from node_modules in ${CHAPTER_DIR} to Composer_Docs in ${pwd}"
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"
36 changes: 31 additions & 5 deletions Chapter03/deployNetwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,38 @@ showStep "deploying network"
# cd network/dist
# composer network deploy -a $NETWORK_NAME.bna -p hlfv1 -i PeerAdmin -s randomString
#
# what the documentation implies is required
# what the v0.14 documentation implies is required
# cd network/dist
# composer network deploy -a $NETWORK_NAME.bna -p hlfv1 -A admin -S adminpw -i PeerAdmin -s randomString
#
# what really works
composer identity request -p hlfv1 -i admin -s adminpw
composer identity import -p hlfv1 -u admin -c ~/.identityCredentials/admin-pub.pem -k ~/.identityCredentials/admin-priv.pem
# what really works for v0.14
# composer identity request -p hlfv1 -i admin -s adminpw
# composer identity import -p hlfv1 -u admin -c ~/.identityCredentials/admin-pub.pem -k ~/.identityCredentials/admin-priv.pem
# cd network/dist
# composer network deploy -a $NETWORK_NAME.bna -p hlfv1 -A admin -S adminpw -i PeerAdmin -s randomString
#
# documentation for v0.15
#
cd network/dist
composer network deploy -a $NETWORK_NAME.bna -p hlfv1 -A admin -S adminpw -i PeerAdmin -s randomString
showStep "installing PeerAdmin card"
composer runtime install --card PeerAdmin@hlfv1 --businessNetworkName $NETWORK_NAME
showStep "starting network"
# change in documentation
# composer network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile $NETWORK_NAME.bna --file networkadmin.card
# corrected to:
composer network start -c PeerAdmin@hlfv1 -A admin -S adminpw -a $NETWORK_NAME.bna --file networkadmin.card
showStep "importing networkadmin card"
if composer card list -n admin@$NETWORK_NAME > /dev/null; then
composer card delete -n admin@$NETWORK_NAME
fi
composer card import --file networkadmin.card
showStep "pinging admin@$NETWORK_NAME card"
composer network ping --card admin@$NETWORK_NAME
#
# creating card for test program
# composer card create -p controller/restapi/features/composer/creds/connection.json -u defaultProfile -c controller/restapi/features/composer/creds/[email protected] -k controller/restapi/features/composer/creds/114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457_sk -r PeerAdmin -r ChannelAdmin
# composer card import --file [email protected]
# showStep "pinging defaultProfile@hlfv1 card"
# composer network ping --card defaultProfile@hlfv1
#

Binary file modified Chapter03/favicon.ico
Binary file not shown.
10 changes: 5 additions & 5 deletions Chapter03/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"browserfs": "^1.2.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"composer-admin": "^0.14.0",
"composer-cli": "^0.14.0",
"composer-client": "^0.14.0",
"composer-connector-embedded": "^0.14.0",
"composer-cucumber-steps": "^0.14.0",
"composer-admin": "^0.16.0",
"composer-cli": "^0.16.0",
"composer-client": "^0.16.0",
"composer-connector-embedded": "^0.16.0",
"composer-cucumber-steps": "^0.16.0",
"cucumber": "^2.2.0",
"eslint": "^3.6.1",
"istanbul": "^0.4.5",
Expand Down
Loading

0 comments on commit b628b78

Please sign in to comment.