From 890df8689fe9b47c2ac0dc2ed525f09ea48ec9e9 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 2 Mar 2020 00:42:01 -0800 Subject: [PATCH] chore: improve ARDUINO_IDE.sh script (#223) --- extras/ARDUINO_IDE.sh | 390 +++++++++++++++++++++--------------------- 1 file changed, 191 insertions(+), 199 deletions(-) diff --git a/extras/ARDUINO_IDE.sh b/extras/ARDUINO_IDE.sh index 1ae27a54..de10ec47 100755 --- a/extras/ARDUINO_IDE.sh +++ b/extras/ARDUINO_IDE.sh @@ -28,221 +28,213 @@ if [ "$1" == "--auto" ]; then fi # Directories -EXTRAS_DIR=$(dirname $0) -PROJECT_ROOT=${EXTRAS_DIR}/../ -INCLUDE_DIR=${EXTRAS_DIR}/../src/include -INCLUDE_CPP_CRYPTO_DIR=${INCLUDE_DIR}/cpp-crypto -SRC_DIR=${EXTRAS_DIR}/../src +EXTRAS_DIR=$(dirname "$0") +PROJECT_ROOT="${EXTRAS_DIR}"/../ +SRC_DIR="${EXTRAS_DIR}"/../src +INCLUDE_DIR="${EXTRAS_DIR}"/../src/include +INCLUDE_CPP_CRYPTO_DIR="${INCLUDE_DIR}"/cpp-crypto -EXTRAS_BACKUP_DIR=${EXTRAS_DIR}/BACKUP +EXTRAS_BACKUP_DIR="${EXTRAS_DIR}"/BACKUP -SRC_LIB_DIR=${SRC_DIR}/lib -EXTRAS_LIB_DIR=${EXTRAS_BACKUP_DIR}/lib +SRC_LIB_DIR="${SRC_DIR}"/lib +EXTRAS_LIB_DIR="${EXTRAS_BACKUP_DIR}"/lib -SRC_COMMON_DIR=${SRC_DIR}/common -INCLUDE_COMMON_DIR=${INCLUDE_CPP_CRYPTO_DIR}/common +SRC_COMMON_DIR="${SRC_DIR}"/common +INCLUDE_COMMON_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/common -SRC_CRYPTO_DIR=${SRC_DIR}/crypto -INCLUDE_CRYPTO_DIR=${INCLUDE_CPP_CRYPTO_DIR}/crypto +SRC_CRYPTO_DIR="${SRC_DIR}"/crypto +INCLUDE_CRYPTO_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/crypto -SRC_IDENTITIES_DIR=${SRC_DIR}/identities -INCLUDE_IDENTITIES_DIR=${INCLUDE_CPP_CRYPTO_DIR}/identities +SRC_IDENTITIES_DIR="${SRC_DIR}"/identities +INCLUDE_IDENTITIES_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/identities -SRC_INTERFACES_DIR=${SRC_DIR}/interfaces -INCLUDE_INTERFACES_DIR=${INCLUDE_CPP_CRYPTO_DIR}/interfaces +SRC_INTERFACES_DIR="${SRC_DIR}"/interfaces +INCLUDE_INTERFACES_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/interfaces -INCLUDE_NETWORKS_DIR=${INCLUDE_CPP_CRYPTO_DIR}/networks -SRC_NETWORKS_DIR=${SRC_DIR}/networks +INCLUDE_NETWORKS_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/networks +SRC_NETWORKS_DIR="${SRC_DIR}"/networks -INCLUDE_TRANSACTIONS_DIR=${INCLUDE_CPP_CRYPTO_DIR}/transactions -SRC_TRANSACTIONS_DIR=${SRC_DIR}/transactions +INCLUDE_TRANSACTIONS_DIR="${INCLUDE_CPP_CRYPTO_DIR}"/transactions +SRC_TRANSACTIONS_DIR="${SRC_DIR}"/transactions -INCLUDE_TRANSACTIONS_BUILDERS_DIR=${INCLUDE_TRANSACTIONS_DIR}/builders -SRC_TRANSACTIONS_BUILDERS_DIR=${SRC_TRANSACTIONS_DIR}/builders +INCLUDE_TRANSACTIONS_BUILDERS_DIR="${INCLUDE_TRANSACTIONS_DIR}"/builders +SRC_TRANSACTIONS_BUILDERS_DIR="${SRC_TRANSACTIONS_DIR}"/builders if [[ $AUTO == '0' ]]; then - -# Interface -echo -e "\n\nšŸ‘‹ Welcome Aboard šŸš¢\n\n" -sleep 1 - -if [[ -d ${INCLUDE_DIR} ]]; then - echo -e "šŸ¤– This script extends compatibility to the Arduino IDE šŸ¤–\n" + # Interface + printf '\n\n%s\n\n' "šŸ‘‹ Welcome Aboard šŸš¢" sleep 1 - echo -e "šŸ’Ŗ All header files will be moved to their 'src' folders šŸ’Ŗ\n" - sleep 1 -else - echo -e "šŸ¤– Looks like this library was already converted to support the Arduino IDE šŸ¤–\n" - sleep 1 - echo -e "šŸ’Ŗ All header files will be moved back to the 'include' folder šŸ’Ŗ\n" - sleep 1 -fi -echo -e "\nšŸ›‘ These changes are permanent, any unsaved changes will be lost šŸ›‘\n" -sleep 2 - -# Prompts for continuation -read -p "āš ļø Are you sure you want to continue? (Y/n):" -n 1 -r -echo -if [[ ${REPLY} =~ ^[Nn]$ ]]; then - echo -e "\n\nšŸ‘Œ Exiting script...\nNo Changes were made šŸ‘\n\n"; - exit 0; -else - echo -e "\n\nšŸ‘Œ Let's go!\n"; -fi - -fi # /if [[ ${AUTO} ]]; then - -if [[ -d ${INCLUDE_DIR} ]]; then + if [[ -d "${INCLUDE_DIR}" ]]; then + printf '%s\n' "šŸ¤– This script extends compatibility to the Arduino IDE šŸ¤–" + sleep 1 + printf '%s\n' "šŸ’Ŗ All header files will be moved to their 'src' folders šŸ’Ŗ" + sleep 1 + else + printf '%s\n' "šŸ¤– Looks like this library was already converted to support the Arduino IDE šŸ¤–" + sleep 1 + printf '%s\n' "šŸ’Ŗ All header files will be moved back to the 'include' folder šŸ’Ŗ" + sleep 1 + fi + + printf '%s\n\n' "šŸ›‘ These changes are permanent, any unsaved changes will be lost šŸ›‘" + sleep 2 + + # Prompts for continuation + read -p "Are you sure you want to continue? (Y/n):" -n 1 -r + printf '\n' + if [[ "${REPLY}" =~ ^[Nn]$ ]]; then + printf '\n%s\n\n%s\n\n' "šŸ‘Œ Exiting script..." "No Changes were made šŸ‘" + exit 0 + else + printf '\n%s\n\n' "šŸ‘Œ Let's go!" + fi + +fi # /if [[ "${AUTO}" ]]; then + +if [[ -d "${INCLUDE_DIR}" ]]; then # This will run if headers are in the 'include' directory tree. - echo -e "****************************************\n" - echo -e "Moving 'arkCrypto.h' to 'src' directory.\n" - mv ${INCLUDE_CPP_CRYPTO_DIR}/arkCrypto.h ${SRC_DIR} - - echo -e "Moving 'common' headers.\n" - mv ${INCLUDE_COMMON_DIR}/configuration.hpp ${SRC_COMMON_DIR} - mv ${INCLUDE_COMMON_DIR}/fee_policy.hpp ${SRC_COMMON_DIR} - mv ${INCLUDE_COMMON_DIR}/network.hpp ${SRC_COMMON_DIR} - - echo -e "Moving 'crypto' headers.\n" - mv ${INCLUDE_CRYPTO_DIR}/message.hpp ${SRC_CRYPTO_DIR} - mv ${INCLUDE_CRYPTO_DIR}/slot.hpp ${SRC_CRYPTO_DIR} - - echo -e "Moving 'identites' headers.\n" - mv ${INCLUDE_IDENTITIES_DIR}/address.hpp ${SRC_IDENTITIES_DIR} - mv ${INCLUDE_IDENTITIES_DIR}/keys.hpp ${SRC_IDENTITIES_DIR} - mv ${INCLUDE_IDENTITIES_DIR}/privatekey.hpp ${SRC_IDENTITIES_DIR} - mv ${INCLUDE_IDENTITIES_DIR}/publickey.hpp ${SRC_IDENTITIES_DIR} - mv ${INCLUDE_IDENTITIES_DIR}/wif.hpp ${SRC_IDENTITIES_DIR} - - echo -e "Moving 'interfaces' headers.\n" - mkdir ${SRC_INTERFACES_DIR} - mv ${INCLUDE_INTERFACES_DIR}/constants.h ${SRC_INTERFACES_DIR} - mv ${INCLUDE_INTERFACES_DIR}/identities.hpp ${SRC_INTERFACES_DIR} - - echo -e "Moving 'networks' headers.\n" - mkdir ${SRC_NETWORKS_DIR} - mv ${INCLUDE_NETWORKS_DIR}/devnet.hpp ${SRC_NETWORKS_DIR} - mv ${INCLUDE_NETWORKS_DIR}/mainnet.hpp ${SRC_NETWORKS_DIR} - mv ${INCLUDE_NETWORKS_DIR}/testnet.hpp ${SRC_NETWORKS_DIR} - - echo -e "Moving 'transactions' headers.\n" - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/builder.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/transfer.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/second_signature.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/delegate_registration.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/vote.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/ipfs.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/multi_payment.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/delegate_resignation.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/htlc_lock.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/htlc_claim.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_BUILDERS_DIR}/htlc_refund.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_DIR}/transaction_data.hpp ${SRC_TRANSACTIONS_DIR} - mv ${INCLUDE_TRANSACTIONS_DIR}/transaction.hpp ${SRC_TRANSACTIONS_DIR} - - echo -e "Backing up, moving, and removing dependencies from the 'src/lib' directory.\n" - mkdir ${EXTRAS_BACKUP_DIR} - mkdir ${EXTRAS_LIB_DIR} - mv ${SRC_LIB_DIR}/date ${EXTRAS_LIB_DIR} - mv ${SRC_LIB_DIR}/bcl ${SRC_DIR} - mv ${SRC_LIB_DIR}/rfc6979 ${SRC_DIR} - - echo -e "Moving Docs to the './extras' directory.\n" - mv ${PROJECT_ROOT}/docs ${EXTRAS_DIR} - - echo -e "Removing old directories šŸ—‘\n" - rm -rf ${INCLUDE_DIR} - rm -rf ${SRC_LIB_DIR} - - echo -e "****************************************\n" - - echo -e "\nAll Done!\nšŸ‘šŸ‘šŸ‘šŸ‘šŸ‘\n" - echo -e "\nYou can now use Cpp-Crypto with the Arduino IDE šŸ‘\n\n" + printf '%s\n' "****************************************" + + printf '%s\n' "Creating destination directories." + mkdir "${SRC_INTERFACES_DIR}" + mkdir "${SRC_NETWORKS_DIR}" + mkdir "${EXTRAS_BACKUP_DIR}" + mkdir "${EXTRAS_LIB_DIR}" + + printf '%s\n' "Moving 'arkCrypto.h' to 'src' directory." + mv "${INCLUDE_CPP_CRYPTO_DIR}"/arkCrypto.h "${SRC_DIR}" + + printf '%s\n' "Moving 'common' headers." + mv "${INCLUDE_COMMON_DIR}"/configuration.hpp "${SRC_COMMON_DIR}" + mv "${INCLUDE_COMMON_DIR}"/fee_policy.hpp "${SRC_COMMON_DIR}" + mv "${INCLUDE_COMMON_DIR}"/network.hpp "${SRC_COMMON_DIR}" + + printf '%s\n' "Moving 'crypto' headers." + mv "${INCLUDE_CRYPTO_DIR}"/message.hpp "${SRC_CRYPTO_DIR}" + mv "${INCLUDE_CRYPTO_DIR}"/slot.hpp "${SRC_CRYPTO_DIR}" + + printf '%s\n' "Moving 'identites' headers." + mv "${INCLUDE_IDENTITIES_DIR}"/address.hpp "${SRC_IDENTITIES_DIR}" + mv "${INCLUDE_IDENTITIES_DIR}"/keys.hpp "${SRC_IDENTITIES_DIR}" + mv "${INCLUDE_IDENTITIES_DIR}"/privatekey.hpp "${SRC_IDENTITIES_DIR}" + mv "${INCLUDE_IDENTITIES_DIR}"/publickey.hpp "${SRC_IDENTITIES_DIR}" + mv "${INCLUDE_IDENTITIES_DIR}"/wif.hpp "${SRC_IDENTITIES_DIR}" + + printf '%s\n' "Moving 'interfaces' headers." + mv "${INCLUDE_INTERFACES_DIR}"/constants.h "${SRC_INTERFACES_DIR}" + mv "${INCLUDE_INTERFACES_DIR}"/identities.hpp "${SRC_INTERFACES_DIR}" + + printf '%s\n' "Moving 'networks' headers." + mv "${INCLUDE_NETWORKS_DIR}"/devnet.hpp "${SRC_NETWORKS_DIR}" + mv "${INCLUDE_NETWORKS_DIR}"/mainnet.hpp "${SRC_NETWORKS_DIR}" + mv "${INCLUDE_NETWORKS_DIR}"/testnet.hpp "${SRC_NETWORKS_DIR}" + + printf '%s\n' "Moving 'transactions' headers." + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/builder.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/transfer.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/second_signature.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/delegate_registration.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/vote.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/ipfs.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/multi_payment.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/delegate_resignation.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/htlc_lock.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/htlc_claim.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}"/htlc_refund.hpp "${SRC_TRANSACTIONS_BUILDERS_DIR}" + mv "${INCLUDE_TRANSACTIONS_DIR}"/transaction_data.hpp "${SRC_TRANSACTIONS_DIR}" + mv "${INCLUDE_TRANSACTIONS_DIR}"/transaction.hpp "${SRC_TRANSACTIONS_DIR}" + + printf '%s\n' "Backing up, moving, and removing dependencies from the 'src/lib' directory." + mv "${SRC_LIB_DIR}"/date "${EXTRAS_LIB_DIR}" + mv "${SRC_LIB_DIR}"/rfc6979 "${SRC_DIR}" + + printf '%s\n' "Moving Docs to the './extras' directory." + mv "${PROJECT_ROOT}"/docs "${EXTRAS_DIR}" + + printf '%s\n' "Removing old directories šŸ—‘" + rm -rf "${INCLUDE_DIR}" + rm -rf "${SRC_LIB_DIR}" + + printf '%s\n' "****************************************" + + printf '\n%s\n%s\n' "All Done!" "šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘" + printf '\n%s\n\n' "You can now use Cpp-Crypto with the Arduino IDE šŸ‘" exit 0 - else # This will run if headers are already in the 'src' directory tree. - echo -e "****************************************\n" - - echo -e "Creating the 'include' directory tree šŸ—‚\n" - mkdir ${INCLUDE_DIR} - mkdir ${INCLUDE_CPP_CRYPTO_DIR} - mkdir ${INCLUDE_COMMON_DIR} - mkdir ${INCLUDE_CRYPTO_DIR} - mkdir ${INCLUDE_DEFAULTS_DIR} - mkdir ${INCLUDE_IDENTITIES_DIR} - mkdir ${INCLUDE_INTERFACES_DIR} - mkdir ${INCLUDE_NETWORKS_DIR} - mkdir ${INCLUDE_TRANSACTIONS_DIR} - mkdir ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - - echo -e "Moving 'arkCrypto.h' back to the 'include/cpp-crypto/' directory.\n" - mv ${SRC_DIR}/arkCrypto.h ${INCLUDE_CPP_CRYPTO_DIR} - - echo -e "Moving 'common' headers.\n" - mv ${SRC_COMMON_DIR}/configuration.hpp ${INCLUDE_COMMON_DIR} - mv ${SRC_COMMON_DIR}/fee_policy.hpp ${INCLUDE_COMMON_DIR} - mv ${SRC_COMMON_DIR}/network.hpp ${INCLUDE_COMMON_DIR} - - echo -e "Moving 'crypto' headers.\n" - mv ${SRC_CRYPTO_DIR}/message.hpp ${INCLUDE_CRYPTO_DIR} - mv ${SRC_CRYPTO_DIR}/slot.hpp ${INCLUDE_CRYPTO_DIR} - - echo -e "Moving 'defaults' headers.\n" - mv ${SRC_DEFAULTS_DIR}/static_fees.hpp ${INCLUDE_DEFAULTS_DIR} - mv ${SRC_DEFAULTS_DIR}/transaction_types.hpp ${INCLUDE_DEFAULTS_DIR} - rm -rf ${SRC_DEFAULTS_DIR} - - echo -e "Moving 'identities' headers.\n" - mv ${SRC_IDENTITIES_DIR}/address.hpp ${INCLUDE_IDENTITIES_DIR} - mv ${SRC_IDENTITIES_DIR}/keys.hpp ${INCLUDE_IDENTITIES_DIR} - mv ${SRC_IDENTITIES_DIR}/privatekey.hpp ${INCLUDE_IDENTITIES_DIR} - mv ${SRC_IDENTITIES_DIR}/publickey.hpp ${INCLUDE_IDENTITIES_DIR} - mv ${SRC_IDENTITIES_DIR}/wif.hpp ${INCLUDE_IDENTITIES_DIR} - - echo -e "Moving 'interfaces' headers.\n" - mv ${SRC_INTERFACES_DIR}/constants.h ${INCLUDE_INTERFACES_DIR} - mv ${SRC_INTERFACES_DIR}/identities.hpp ${INCLUDE_INTERFACES_DIR} - rm -rf ${SRC_INTERFACES_DIR} - - echo -e "Moving 'networks' headers.\n" - mv ${SRC_NETWORKS_DIR}/devnet.hpp ${INCLUDE_NETWORKS_DIR} - mv ${SRC_NETWORKS_DIR}/mainnet.hpp ${INCLUDE_NETWORKS_DIR} - mv ${SRC_NETWORKS_DIR}/testnet.hpp ${INCLUDE_NETWORKS_DIR} - rm -rf ${SRC_NETWORKS_DIR} - - echo -e "Moving 'transactions' headers.\n" - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/builder.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/transfer.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/second_signature.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/delegate_registration.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/vote.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/ipfs.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/multi_payment.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/delegate_resignation.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/htlc_lock.hpp ${INCLUDE_TRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/htlc_claim.hpp ${SRC_TINCLUDE_TRANSACTIONS_BUILDERS_DIRRANSACTIONS_BUILDERS_DIR} - mv ${SRC_TRANSACTIONS_BUILDERS_DIR}/htlc_refund.hpp ${SRC_TRANSACTIONS_BUILDERS_DIR} - mv ${INCLUDE_TRANSACTIONS_DIR}/transaction_data.hpp ${SRC_TRANSACTIONS_DIR} - mv ${INCLUDE_TRANSACTIONS_DIR}/transaction.hpp ${SRC_TRANSACTIONS_DIR} - - echo -e "Restoring the 'lib' directory.\n" - mkdir ${SRC_LIB_DIR} - mv ${EXTRAS_LIB_DIR}/date ${SRC_LIB_DIR} - mv ${SRC_DIR}/bcl ${SRC_LIB_DIR} - mv ${SRC_DIR}/rfc6979 ${SRC_LIB_DIR} - - echo -e "Moving Docs back to the project root directory.\n" - mv ${EXTRAS_DIR}/docs ${PROJECT_ROOT} - - echo -e "Removing old directories šŸ—‘\n" - rm -rf ${EXTRAS_BACKUP_DIR} - - echo -e "****************************************\n" - - echo -e "\nAll Done!\nšŸ‘šŸ‘šŸ‘šŸ‘šŸ‘\n" - echo -e "\nArduino IDE compatibility has been reverted šŸ‘\n\n" + printf '%s\n' "****************************************" + + printf '%s\n' "Creating the 'include' directory tree šŸ—‚" + mkdir "${INCLUDE_DIR}" + mkdir "${INCLUDE_CPP_CRYPTO_DIR}" + mkdir "${INCLUDE_COMMON_DIR}" + mkdir "${INCLUDE_CRYPTO_DIR}" + mkdir "${INCLUDE_IDENTITIES_DIR}" + mkdir "${INCLUDE_INTERFACES_DIR}" + mkdir "${INCLUDE_NETWORKS_DIR}" + mkdir "${INCLUDE_TRANSACTIONS_DIR}" + mkdir "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + + printf '%s\n' "Moving 'arkCrypto.h' back to the 'include/cpp-crypto/' directory." + mv "${SRC_DIR}"/arkCrypto.h "${INCLUDE_CPP_CRYPTO_DIR}" + + printf '%s\n' "Moving 'common' headers." + mv "${SRC_COMMON_DIR}"/configuration.hpp "${INCLUDE_COMMON_DIR}" + mv "${SRC_COMMON_DIR}"/fee_policy.hpp "${INCLUDE_COMMON_DIR}" + mv "${SRC_COMMON_DIR}"/network.hpp "${INCLUDE_COMMON_DIR}" + + printf '%s\n' "Moving 'crypto' headers." + mv "${SRC_CRYPTO_DIR}"/message.hpp "${INCLUDE_CRYPTO_DIR}" + mv "${SRC_CRYPTO_DIR}"/slot.hpp "${INCLUDE_CRYPTO_DIR}" + + printf '%s\n' "Moving 'identities' headers." + mv "${SRC_IDENTITIES_DIR}"/address.hpp "${INCLUDE_IDENTITIES_DIR}" + mv "${SRC_IDENTITIES_DIR}"/keys.hpp "${INCLUDE_IDENTITIES_DIR}" + mv "${SRC_IDENTITIES_DIR}"/privatekey.hpp "${INCLUDE_IDENTITIES_DIR}" + mv "${SRC_IDENTITIES_DIR}"/publickey.hpp "${INCLUDE_IDENTITIES_DIR}" + mv "${SRC_IDENTITIES_DIR}"/wif.hpp "${INCLUDE_IDENTITIES_DIR}" + + printf '%s\n' "Moving 'interfaces' headers." + mv "${SRC_INTERFACES_DIR}"/constants.h "${INCLUDE_INTERFACES_DIR}" + mv "${SRC_INTERFACES_DIR}"/identities.hpp "${INCLUDE_INTERFACES_DIR}" + + printf '%s\n' "Moving 'networks' headers." + mv "${SRC_NETWORKS_DIR}"/devnet.hpp "${INCLUDE_NETWORKS_DIR}" + mv "${SRC_NETWORKS_DIR}"/mainnet.hpp "${INCLUDE_NETWORKS_DIR}" + mv "${SRC_NETWORKS_DIR}"/testnet.hpp "${INCLUDE_NETWORKS_DIR}" + + printf '%s\n' "Moving 'transactions' headers." + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/builder.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/transfer.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/second_signature.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/delegate_registration.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/vote.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/ipfs.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/multi_payment.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/delegate_resignation.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/htlc_lock.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/htlc_claim.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_BUILDERS_DIR}"/htlc_refund.hpp "${INCLUDE_TRANSACTIONS_BUILDERS_DIR}" + mv "${SRC_TRANSACTIONS_DIR}"/transaction_data.hpp "${INCLUDE_TRANSACTIONS_DIR}" + mv "${SRC_TRANSACTIONS_DIR}"/transaction.hpp "${INCLUDE_TRANSACTIONS_DIR}" + + printf '%s\n' "Restoring the 'lib' directory." + mkdir "${SRC_LIB_DIR}" + mv "${EXTRAS_LIB_DIR}"/date "${SRC_LIB_DIR}" + mv "${SRC_DIR}"/rfc6979 "${SRC_LIB_DIR}" + + printf '%s\n' "Moving Docs back to the project root directory." + mv "${EXTRAS_DIR}"/docs "${PROJECT_ROOT}" + + printf '%s\n' "Removing old directories šŸ—‘" + rm -rf "${EXTRAS_BACKUP_DIR}" + rm -rf "${SRC_INTERFACES_DIR}" + rm -rf "${SRC_NETWORKS_DIR}" + + printf '%s\n' "****************************************" + + printf '\n%s\n%s\n' "All Done!" "šŸ‘ šŸ‘ šŸ‘ šŸ‘ šŸ‘" + printf '\n%s\n\n' "Arduino IDE compatibility has been reverted šŸ‘" exit 0 - fi