-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from Nyholm/install-test
Added small script to test installation on with different dependencies
- Loading branch information
Showing
3 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
gethash() { | ||
if hash md5sum 2>/dev/null; then | ||
echo -n "$@" | md5sum | awk '{print $1}' | ||
else | ||
echo -n "$@" | md5 | awk '{print $1}' | ||
fi | ||
} | ||
|
||
HASH=`gethash $@` | ||
BUILD_DIR=build/`echo ${HASH::7}` | ||
|
||
echo "Using directory: ${BUILD_DIR}" | ||
# Prepare a folder | ||
#rm -rf $BUILD_DIR | ||
mkdir -p $BUILD_DIR | ||
|
||
# Init composer | ||
composer init --working-dir $BUILD_DIR --no-interaction | ||
composer req --working-dir $BUILD_DIR php-http/discovery --no-update | ||
|
||
# Define packages from arguments | ||
composer req --working-dir $BUILD_DIR $3 | ||
|
||
# Copy the current version of php-http/discovery | ||
cp -R src $BUILD_DIR/vendor/php-http/discovery | ||
cd $BUILD_DIR | ||
|
||
# Run PHP and check exit code | ||
php -r "require 'vendor/autoload.php'; ${2}" > /dev/null | ||
PHP_EXIT_CODE=$? | ||
|
||
# Print result | ||
echo "" | ||
echo "" | ||
if [ $PHP_EXIT_CODE -eq 0 ]; then | ||
echo "We found a package" | ||
else | ||
echo "We did not find anything" | ||
fi | ||
|
||
echo "" | ||
if [ "$1" = "will-find" ]; then | ||
exit $PHP_EXIT_CODE; | ||
elif [ $PHP_EXIT_CODE -ne 0 ]; then | ||
exit 0 | ||
fi | ||
|
||
echo "We did find a class but we were not supposed to" | ||
echo "" | ||
exit 1 |