Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Naming #1

Open
piecesnbits opened this issue Feb 14, 2022 · 2 comments
Open

Naming #1

piecesnbits opened this issue Feb 14, 2022 · 2 comments

Comments

@piecesnbits
Copy link

piecesnbits commented Feb 14, 2022

it would be nice if the class and file names and namespace could be set during initialization instead of find and replace.

@7flash
Copy link

7flash commented Mar 31, 2022

@piecesnbits Try this script:

# /bin/bash

Contract=XXXXXXXXXXXXXX

sed -i "s/contractacc/$Contract/gi" ./include/class1.hpp

sed -i "s/namespace contract_name/namespace $Contract/gi" ./include/class1.hpp

sed -i "s/namespace contract_name/namespace $Contract/gi" ./src/class1.cpp

sed -i "s/namespace contract_name/namespace $Contract/gi" ./schema/Schema1.hpp

sed -i "s/contract_name::/$Contract::/gi" ./include/class1.hpp

sed -i "s/contract_name::/$Contract::/gi" ./src/class1.cpp

sed -i "s/contract_name::/$Contract::/gi" ./test/test-contract_name.cpp

sed -i "s/contract_name::/$Contract::/gi" ./ricardian/class1-ricardian.cpp

sed -i "s/PROJ contract_name/PROJ $Contract/" ./CMakeLists.txt

sed -i "s/APPEND FILENAMES \"class1\"/APPEND FILENAMES \"$Contract\"/" ./CMakeLists.txt

sed -i "s/#include \"class1.hpp\"/#include \"$Contract.hpp\"/" ./ricardian/class1-ricardian.cpp

sed -i "s/#include \"class1.hpp\"/#include \"$Contract.hpp\"/" ./src/class1.cpp

sed -i "s/#include \"class1.hpp\"/#include \"$Contract.hpp\"/" ./test/test-class1.cpp

sed -i "s/class1_contract/$Contract\_contract/g" ./src/class1.cpp

sed -i "s/class1_contract/$Contract\_contract/g" ./include/class1.hpp

sed -i "s/contract_name.wasm/$Contract.wasm/" ./test/test-gnocityworks.cpp

mv ./src/class1.cpp ./src/$Contract.cpp

mv ./include/class1.hpp ./include/$Contract.hpp

mv ./ricardian/class1-ricardian.cpp ./ricardian/$Contract-ricardian.cpp

mv ./test/test-contract_name.cpp ./test/test-$Contract.cpp

@James-Mart
Copy link
Contributor

Yeah I agree it's annoying to have to rename everything manually with find-all/replace when you start.

A script that is robust could actually be integrated into the devcontainer file and automatically called after setting up the docker image so that it all happens automatically based only on the devcontainer configuration file.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants