Skip to content

Commit a7e5ba9

Browse files
fix: always recreate bundle config by default #980 (#1028)
- Change default behavior to always recreate .bundle/config - Users will now always get configuration updates - Add --preserve-config option for backward compatibility - Add --help option for usage information - Fix argument processing conflicts when script is sourced by other tools - Prioritizes reliability over performance concerns - Addresses overly cautious guard that prevented config updates - Uses sir @rpsene's argument parsing approach with improved defaults Fixes #980 Ready for Review sir @ThinkOpenly sir @dhower-qc sir @christian-herber-nxp --------- Signed-off-by: Sukuna0007Abhi <[email protected]> Signed-off-by: GitHub <[email protected]>
1 parent 240221c commit a7e5ba9

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

bin/setup

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ cd $ROOT
66

77
CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag`
88

9+
# Parse command line arguments
10+
PRESERVE_CONFIG=0
11+
12+
# Only parse arguments if this script is being run directly (not sourced)
13+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
14+
for arg in "$@"; do
15+
case $arg in
16+
--preserve-config)
17+
PRESERVE_CONFIG=1
18+
shift
19+
;;
20+
--help|-h)
21+
echo "Usage: $0 [OPTIONS]"
22+
echo ""
23+
echo "Options:"
24+
echo " --preserve-config Only create .bundle/config if missing (default: always recreate)"
25+
echo " --help, -h Show this help message"
26+
exit 0
27+
;;
28+
*)
29+
echo "Unknown option: $arg"
30+
echo "Use --help for usage information"
31+
exit 1
32+
;;
33+
esac
34+
done
35+
fi
36+
937
# Supported container types:
1038
#
1139
# = devcontainer
@@ -128,7 +156,10 @@ if [ ! -d $ROOT/.home ]; then
128156
mkdir $ROOT/.home
129157
fi
130158

131-
if [ ! -f $ROOT/.bundle/config ]; then
159+
if [ $PRESERVE_CONFIG -eq 0 ] || [ ! -f $ROOT/.bundle/config ]; then
160+
if [ -f $ROOT/.bundle/config ] && [ $PRESERVE_CONFIG -eq 0 ]; then
161+
echo "Recreating bundle config..."
162+
fi
132163
OLDDIR=$PWD
133164
cd $ROOT
134165
${RUN} bundle config set --local path ${ROOT}/.home/.gems

0 commit comments

Comments
 (0)