-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·64 lines (55 loc) · 1.71 KB
/
build.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "No PHP version supplied"
echo "Usage: ./build.sh <php_version>"
echo "./build.sh 7.4"
echo "./build.sh 8.2"
echo "composer.lock will be updated for php > 7.4"
exit
fi
set -e
if ! command -v zip
then
echo "Zip package is not currently installed"
echo "Or use './docker/build-package.sh <php_version>'"
exit
fi
if ! command -v php$1
then
echo "PHP $1 package is not currently installed"
echo "Or use './docker/build-package.sh <php_version>'"
exit
fi
if ! command -v composer
then
echo "Composer package is not currently installed"
echo "Or use './docker/build-package.sh <php_version>'"
exit
fi
if [ "$1" = "7.4" ]
then
composer_command="install"
else
composer_command="update"
cp composer.lock composer.lock.backup
fi
if [ ! -d dist ];
then
mkdir -p dist
else
rm -rf dist/altapay-for-woocommerce.zip
fi
mkdir -p dist
rm -rf vendor build
php$1 $(command -v composer) $composer_command --no-dev -o --no-interaction
yes | php$1 vendor/bin/php-scoper add-prefix
rsync -a build/vendor/* vendor/ && rm -rf build/
php$1 $(command -v composer) remove humbug/php-scoper
php$1 $(command -v composer) remove phpstan/extension-installer phpunit/phpunit szepeviktor/phpstan-wordpress --dev
php$1 $(command -v composer) dump-autoload --working-dir ./ --classmap-authoritative
zip dist/altapay-for-woocommerce.zip -r * -x "dist/*" "tests/*" "bin/*" "terminal-config/*" "docs/*" "docker/*" wiki.md build.sh scoper.inc.php README.md CHANGELOG.md guide.md .gitignore phpunit.xml.dist phpstan.neon.dist composer.json composer.lock composer.lock.backup @
if [ -f composer.lock.backup ]; then
rm -rf composer.lock
mv composer.lock.backup composer.lock
fi