diff --git a/package.json b/package.json index 3adad2e2c..9eaf3e5a4 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "request-promise": "^4.2.2", "sol-merger": "^0.1.2", "solidity-coverage": "^0.5.11", - "solidity-docgen": "^0.1.0", + "solidity-docgen": "^0.1.1", "solium": "^1.1.6", "table": "^5.2.3", "web3": "1.0.0-beta.35" diff --git a/scripts/docs.sh b/scripts/docs.sh index af7f6e395..93d19f8fd 100755 --- a/scripts/docs.sh +++ b/scripts/docs.sh @@ -12,12 +12,12 @@ CORE_ROUTE=$PWD # functions that used to create the documentation create_docs() { - # getting the all available branches + # getting the all available branches if [ "$(git branch | grep -w $latestTag)" == "" ]; then # Check whether the branch is already present or not if [ "$(git branch -r | grep "origin/$latestTag" | wc -l)" -ge 1 ]; - then + then echo "$latestTag Branch is already present on remote" exit 0 fi @@ -32,29 +32,23 @@ create_docs() { cd $WEBSITE_DIRECTORY fi - echo "Fetching solc binary" - curl -L -o solidity-ubuntu-trusty.zip https://github.com/ethereum/solidity/releases/download/v0.4.24/solidity-ubuntu-trusty.zip - unzip solidity-ubuntu-trusty.zip - CWD=$(pwd) - OLD_SOLC_PATH=$SOLC_PATH - export SOLC_PATH=$CWD/solc - echo "Generating the API documentation in branch $latestTag" # Command to generate the documentation using the solidity-docgen migrate=$(SOLC_ARGS="openzeppelin-solidity="$CORE_ROUTE"/node_modules/openzeppelin-solidity" \ solidity-docgen -x external/oraclizeAPI.sol,mocks/MockPolyOracle.sol,oracles/PolyOracle.sol $CORE_ROUTE $CORE_ROUTE/contracts $CORE_ROUTE/polymath-developer-portal/) - - export SOLC_PATH=$OLD_SOLC_PATH echo "Successfully docs are generated..." - + echo "Installing npm dependencies..." yarn install > /dev/null 2>&1 - + echo "Gererate versioning docs..." yarn run version $versionNo + git config --global user.email "contact@mudit.blog" + git config --global user.name "polydocs" + # Commit the changes echo "Commiting the new changes..." git add . @@ -67,7 +61,7 @@ solidity-docgen -x external/oraclizeAPI.sol,mocks/MockPolyOracle.sol,oracles/Pol echo "Removing the repository from the system...." cd ../../../ rm -rf polymath-developer-portal - exit 0 + exit 0 } reject_docs() { @@ -87,10 +81,13 @@ versionNo=$(echo "$latestTag" | cut -b 2-6) #print the tag echo "Latest tag is: $latestTag" +# Fetch patched solidity docgen +curl -o node_modules/solidity-docgen/lib/index.js https://raw.githubusercontent.com/maxsam4/solidity-docgen/build/lib/index.js + # clone the polymath-developer-portal if [ ! -d $DIRECTORY ]; then -git clone https://${GH_USR}:${GH_PWD}@github.com/PolymathNetwork/polymath-developer-portal.git > /dev/null 2>&1 +git clone https://${GH_USR}:${GH_PWD}@github.com/PolymathNetwork/polymath-developer-portal.git > /dev/null 2>&1 cd $DIRECTORY else cd $DIRECTORY @@ -102,9 +99,9 @@ cd website if [ ! -d $WEBSITE_DIRECTORY ]; then echo "Created: versioned_docs directory" -create_docs -else - for dir in $WEBSITE_DIRECTORY/*; +create_docs +else + for dir in $WEBSITE_DIRECTORY/*; do if [ "$(basename "$dir")" == "*" ]; then echo "There is no version specific folders" @@ -113,12 +110,12 @@ else reponame=$(echo $(basename "$dir") | cut -d '-' -f2) echo $reponame if [ "$reponame" == "$versionNo" ]; then - reject_docs + reject_docs fi - fi + fi done create_docs fi #reponame=$(echo $(basename "$dir") | cut -d '-' -f2 | cut -b 2-6) -# echo $reponame \ No newline at end of file +# echo $reponame diff --git a/yarn.lock b/yarn.lock index 869a297bc..811ba256c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5562,9 +5562,10 @@ solidity-coverage@^0.5.11: tree-kill "^1.2.0" web3 "^0.18.4" -solidity-docgen@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.1.0.tgz#f3a56ff074e8c7d832af3a3d462c3b5abf0f64cb" +solidity-docgen@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.1.1.tgz#b9cd4cc414aab371094b7db8a0a45c535bd6e875" + integrity sha512-BJiE5yqpXjpmmEKPZ/RU98i48xa4/0JRk8AJheKK6+LSckv/MduGeC2sO4MD/btBi03+NicFze3lvlPUjj2jHg== dependencies: commander "^2.14.1" lodash "^4.17.5"