Skip to content

Commit 821c501

Browse files
committed
Fixed setup_project.sh
1 parent 0dba336 commit 821c501

2 files changed

Lines changed: 14 additions & 21 deletions

File tree

.github/workflows/test_setup_script.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,9 @@ jobs:
4444
exit 1
4545
fi
4646
47-
# Check that testproject was replaced in pyproject.toml
48-
if grep -q "testproject" pyproject.toml; then
49-
echo "Error: 'testproject' still found in pyproject.toml"
50-
exit 1
51-
fi
52-
53-
if ! grep -q "my-test-app" pyproject.toml; then
54-
echo "Error: 'my-test-app' not found in pyproject.toml"
55-
exit 1
56-
fi
57-
58-
echo "✓ All checks passed!"
59-
60-
- name: Install project with new name
61-
run: |
62-
pip install --upgrade pip
63-
pip install -e .
47+
# Check that template-python was replaced in pyproject.toml
48+
if grep -q "template-python" pyproject.toml; then
49+
echo "Error: 'template-python' still found in pyproject.toml"
6450
6551
- name: Test renamed command works
6652
run: |

setup_project.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ fi
99
APPNAME="$1"
1010
APPNAME_UNDERSCORE="${APPNAME//-/_}"
1111

12-
# 1. Find and replace "testproject" with app name
13-
grep -rl "testproject" . | while IFS= read -r file; do
14-
LC_ALL=C sed -i.bak "s/testproject/${APPNAME}/g" "$file"
12+
# 1. Find and replace "template-python" with app name
13+
grep -rl "template-python" . --exclude-dir=.git --exclude-dir=docs/build | while IFS= read -r file; do
14+
LC_ALL=C sed -i.bak "s/template-python/${APPNAME}/g" "$file"
15+
rm -f "${file}.bak"
16+
done
17+
18+
# Also replace template_python with appname_underscore
19+
grep -rl "template_python" . --exclude-dir=.git --exclude-dir=docs/build | while IFS= read -r file; do
20+
LC_ALL=C sed -i.bak "s/template_python/${APPNAME_UNDERSCORE}/g" "$file"
1521
rm -f "${file}.bak"
1622
done
1723

@@ -35,7 +41,8 @@ done
3541

3642

3743
echo "Done:"
38-
echo " Replaced 'testproject' → '${APPNAME}'"
44+
echo " Replaced 'template-python' → '${APPNAME}'"
45+
echo " Replaced 'template_python' → '${APPNAME_UNDERSCORE}'"
3946
echo " Moved src/app → src/${APPNAME_UNDERSCORE}"
4047
echo " Replaced import statements in src/**/*.py"
4148
echo "You can now remove this script with: rm setup_project.sh"

0 commit comments

Comments
 (0)