-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathupdate_candid.sh
executable file
·57 lines (48 loc) · 1.17 KB
/
update_candid.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Usage:
# cd examples
# ../update_candid
# cd motoko_examples
# ../update_candid ../..
# set path to kybra package. Default to ../../ (for when run from example dir)
KYBRA_PATH="../../"
upgrade_candid()
{
# deactivate current virtual environment if running
deactivate 2>/dev/null
# start a new virtual environment
~/.pyenv/versions/3.10.7/bin/python -m venv venv
# activate new virtual environment
source venv/bin/activate
# install kybra package
# pip install $KYBRA_PATH
pip install $KYBRA_PATH # TODO change this as appropriate
# start dfx replica in background
# dfx start --host 127.0.0.1:8000 --clean &
# sleep 7
dfx canister create --all
dfx build
deactivate 2>/dev/null
# killall dfx
}
upgrade_all()
{
for dir in */; do
# You can use this part to skip directories
# first_char=${dir:0:1}
# if [[ "$first_char" < "m" ]]; then
# echo "Skipping directory: $dir"
# continue
# fi
echo "Looking at directory: $dir"
# check if dfx.json file exists in directory
if [ -f "$dir/dfx.json" ]; then
echo "Processing directory: $dir"
cd $dir
upgrade_candid
# sleep 5
cd ..
fi
done
}
upgrade_all