Skip to content

Commit 7c33b2f

Browse files
authored
Merge pull request #18 from tattersoftware/noscripts
Disable Composer scripts
2 parents 329af98 + e72f08d commit 7c33b2f

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/patch

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,26 @@ for BRANCH in "tatter/scratch" "tatter/patches"; do
117117
done
118118

119119
# Display environment info
120+
echo "************************************"
121+
echo "* CONFIGURATION *"
122+
echo "************************************"
123+
echo ""
120124
echo "Scripts Directory: $SCRIPTS"
121125
echo "Project Directory: $ROOT"
122126
echo "Target Version: $TARGET_VERSION"
123127
echo "Current Version: $SOURCE_VERSION"
124128
echo "Source Package: $PACKAGE"
125129
echo "Base Branch: $BASE"
126130
echo "Selected Items: $ITEMS"
131+
echo ""
127132

128133
# From here on everything is destructive (but reversible) so we want hard stops
129134
set -e
130135

136+
echo "************************************"
137+
echo "* STAGING *"
138+
echo "************************************"
139+
echo ""
131140
# Create a blank branch to work on
132141
git switch --orphan tatter/scratch
133142

@@ -137,7 +146,7 @@ git clean -fd
137146

138147
# If a current version was requested then change vendor first
139148
if [ "$CURRENT_VERSION" ]; then
140-
composer require "$PACKAGE" "$CURRENT_VERSION"
149+
composer require --no-scripts "$PACKAGE" "$CURRENT_VERSION"
141150
git restore composer.*
142151
fi
143152

@@ -153,10 +162,10 @@ git commit -m "Stage framework" > /dev/null
153162

154163
# Check for a specific requested version
155164
if [ "$TARGET_VERSION" ]; then
156-
composer require "$PACKAGE" "$TARGET_VERSION"
165+
composer require --no-scripts "$PACKAGE" "$TARGET_VERSION"
157166
# Otherwise get the latest
158167
else
159-
composer update "$PACKAGE"
168+
composer update --no-scripts "$PACKAGE"
160169
fi
161170

162171
# Wipe out the current versions and copy in the new
@@ -177,14 +186,23 @@ rm composer.*
177186
git switch -c tatter/patches "$BASE"
178187

179188
# Restore the original state of vendor/
180-
composer install > /dev/null
189+
composer install --no-scripts > /dev/null
190+
191+
echo "************************************"
192+
echo "* MERGING *"
193+
echo "************************************"
194+
echo ""
181195

182196
# Attempt the merge
183197
set +e
184198
git cherry-pick tatter/scratch
185199

186200
if [ $? -eq 0 ]; then
187-
echo "Patch successful! Changes available on branch tatter/patches."
201+
echo "************************************"
202+
echo "* SUCCESS *"
203+
echo "************************************"
204+
echo ""
205+
echo "Patch successful! Updated files are available on branch tatter/patches."
188206
git branch -D tatter/scratch
189207
exit 0
190208
fi
@@ -193,6 +211,10 @@ git status
193211

194212
# Conflict: explain and exit
195213
echo ""
214+
echo "************************************"
215+
echo "* RESOLUTION *"
216+
echo "************************************"
217+
echo ""
196218
echo "Conflicts detected during patch! Follow the git instructions for resolution."
197219
echo "Once resolution is complete your changes will be available on branch tatter/patches"
198220
echo "and you should remove the old working branch at tatter/scratch."

0 commit comments

Comments
 (0)