Skip to content

Commit f57cfad

Browse files
committed
feat: ✨ support workspaces in features
1 parent e87053d commit f57cfad

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ source=$(dirname $(readlink -f $0))
66
# Source the common utils
77
. $source/src/common-utils/_zz_colors.sh
88

9+
alias zz_log=$source/src/common-utils/_zz_logs.sh
10+
911
# Prepare for local installation by creating a temporary directory and linking common utils
1012
find $source/src/common-utils/ -type f -name "_*.sh" -exec echo {} \; -exec chmod +x {} \; | while read file; do
1113
ln -sf $file $source/src/common-utils/$(basename $file | sed 's/^_//;s/.sh$//')
@@ -23,6 +25,8 @@ eval $(
2325
help
2426
)
2527

28+
zz_log i "Installing devcontainer/features"
29+
2630
# If 'all' argument is provided, set stubs and features to install all default features
2731
if [ -n "$all" ]; then
2832
echo "${Yellow}Add default features${End}"
@@ -88,7 +92,7 @@ if [ -n "$features" ]; then
8892
alias install-feature=$(dirname $0)/src/common-utils/_install-feature.sh
8993

9094
# Check if the script is running inside a container
91-
if [ "$CODESPACES" != "true" ] && [ "$REMOTE_CONTAINERS" != "true" ]; then
95+
if [ "$CODESPACES" != "true" ] && [ "$REMOTE_CONTAINERS" != "true" ] && [ -z "$DEV_CONTAINER_FILE_PATH"]; then
9296

9397
echo "${Red}You are not in a container${End}"
9498

src/common-utils/_configure-feature.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ export source=${source:-/usr/local/share/$feature}
2323
export tabSize=4
2424

2525
zz_log i "Configure feature <{Purple $feature}>"
26+
zz_log - "In {U $(pwd)}"
2627
zz_log - "From {U $source}"
2728

28-
# Go to the module root
29-
cd "$(git rev-parse --show-toplevel)" >/dev/null
30-
3129
# Ensure the source directory exists
3230
if [ ! -d $source ]; then
3331
zz_log e "Source directory <$source> does not exist"
@@ -116,8 +114,16 @@ for type in package composer; do
116114
done
117115
done
118116

119-
# Call all configure-xxx.sh scripts
120-
find $source -maxdepth 1 -name configure-*.sh | sort | while read file; do
121-
zz_log i "Calling {U $file}..."
122-
sh -c "$file" && zz_log s "Done!" || zz_log e "Failed!"
123-
done
117+
# if in top level directory, call configure scripts
118+
if [ "$(pwd)" = "$(git rev-parse --show-toplevel)" ]; then
119+
120+
zz_log s "Running on top level directory!"
121+
122+
# Call all configure-xxx.sh scripts
123+
find $source -maxdepth 1 -name configure-*.sh | sort | while read file; do
124+
zz_log i "Calling {U $file}..."
125+
sh -c "$file" && zz_log s "Done!" || zz_log e "Failed!"
126+
done
127+
else
128+
zz_log w "Not in top level directory, skipping configure scripts"
129+
fi

0 commit comments

Comments
 (0)