duong on Nostr: Ok, let's say I wanna test this script, without installing docker-compose: $ cat ...
Ok, let's say I wanna test this script, without installing docker-compose:
$ cat manage.sh
#!/bin/sh
RUNNING_IDS=$(docker-compose ps -q)
if [ -z "$RUNNING_IDS" ]; then
echo "docker-compose is not running."
exit 1
fi
docker-compose exec -e LOG_LEVEL=${LOG_LEVEL:-INFO} backend python3 manage.py "$@"
I can use the PATH trick:
$ printf '#!/bin/sh' > docker-compose && chmod +x docker-compose && PATH=.:$PATH ./manage.sh
docker-compose is not running.
Here I create a docker-compose file (that is just an empty shell script), and called the script that I wanted to test with the current directory added to the PATH.
Published at
2023-07-28 00:25:45Event JSON
{
"id": "44934dff97462fbf0b058d4edd3228517a85bee5b054edda4d6224788f18fff7",
"pubkey": "69f16d34caa0890f32e1970e119a2f96de18914ab0ba5bca6c87ab724568b5f8",
"created_at": 1690503945,
"kind": 1,
"tags": [
[
"p",
"44dc1c2db9c3fbd7bee9257eceb52be3cf8c40baf7b63f46e56b58a131c74f0b",
"",
"Enki"
],
[
"e",
"e8f1aa3a132ba85e583937663233580bbe8689d7b786f6deab9fb1d0ca4b2e2b",
"",
"root"
],
[
"e",
"d2c68bc7f3d8e147c458599cb12f0c6709bc4ce5438ea7490c12afc99c3d0952",
""
],
[
"e",
"3101618f7ed4d570019ac33d27a0389badd72cf6b34041ab5fae6841dcc28c84",
"wss://nostr.wine",
"reply"
],
[
"client",
"coracle"
]
],
"content": "Ok, let's say I wanna test this script, without installing docker-compose:\n\n$ cat manage.sh \n#!/bin/sh\nRUNNING_IDS=$(docker-compose ps -q)\nif [ -z \"$RUNNING_IDS\" ]; then\n echo \"docker-compose is not running.\"\n exit 1\nfi\ndocker-compose exec -e LOG_LEVEL=${LOG_LEVEL:-INFO} backend python3 manage.py \"$@\"\n\nI can use the PATH trick:\n\n$ printf '#!/bin/sh' \u003e docker-compose \u0026\u0026 chmod +x docker-compose \u0026\u0026 PATH=.:$PATH ./manage.sh\ndocker-compose is not running.\n\nHere I create a docker-compose file (that is just an empty shell script), and called the script that I wanted to test with the current directory added to the PATH.",
"sig": "8a1315a4795ab03421a93a7f66b943a2e551e76d651741b2b5412e08bf3058755c9b73c0da8d1402fde780e1860530bf2159b1ae4107d4c7ee5f182a4beda194"
}