Change plugins download directory

[MAILPOET-3482]
This commit is contained in:
Rostislav Wolny
2021-04-16 17:08:16 +02:00
committed by Veljko V
parent 03f25fdf64
commit 44f1269916
4 changed files with 8 additions and 4 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ TODO
/vendor-prefixed-backup /vendor-prefixed-backup
tests/_output/* tests/_output/*
tests/_support/_generated/* tests/_support/_generated/*
tests/plugins
node_modules node_modules
.env .env
npm-debug.log npm-debug.log

View File

@ -903,12 +903,12 @@ class RoboFile extends \Robo\Tasks {
exit(0); // Exit with 0 since it is a valid state for some environments exit(0); // Exit with 0 since it is a valid state for some environments
} }
$this->createGithubClient('woocommerce/woocommerce-subscriptions') $this->createGithubClient('woocommerce/woocommerce-subscriptions')
->downloadReleaseZip('woocommerce-subscriptions.zip', __DIR__ . '/tools/vendor/', $tag); ->downloadReleaseZip('woocommerce-subscriptions.zip', __DIR__ . '/tests/plugins/', $tag);
} }
public function downloadWooCommerceZip($tag = null) { public function downloadWooCommerceZip($tag = null) {
$this->createGithubClient('woocommerce/woocommerce') $this->createGithubClient('woocommerce/woocommerce')
->downloadReleaseZip('woocommerce.zip', __DIR__ . '/tools/vendor/', $tag); ->downloadReleaseZip('woocommerce.zip', __DIR__ . '/tests/plugins/', $tag);
} }
public function generateData($generatorName = null) { public function generateData($generatorName = null) {

View File

@ -37,6 +37,9 @@ class GithubClient {
if (!$assetDownloadUrl) { if (!$assetDownloadUrl) {
throw new \Exception("Release zip for $tag not found"); throw new \Exception("Release zip for $tag not found");
} }
if (!is_dir($downloadDir)) {
mkdir($downloadDir, 0777, true);
}
$this->httpClient->get($assetDownloadUrl, ['sink' => $downloadDir . $zip, 'headers' => ['Accept' => 'application/octet-stream']]); $this->httpClient->get($assetDownloadUrl, ['sink' => $downloadDir . $zip, 'headers' => ['Accept' => 'application/octet-stream']]);
} }

View File

@ -54,7 +54,7 @@ fi
# Install WooCommerce # Install WooCommerce
if [[ ! -d "/wp-core/wp-content/plugins/woocommerce" ]]; then if [[ ! -d "/wp-core/wp-content/plugins/woocommerce" ]]; then
cd /wp-core/wp-content/plugins cd /wp-core/wp-content/plugins
WOOCOMMERCE_CORE_ZIP="/wp-core/wp-content/plugins/mailpoet/tools/vendor/woocommerce.zip" WOOCOMMERCE_CORE_ZIP="/wp-core/wp-content/plugins/mailpoet/tests/plugins/woocommerce.zip"
if [ ! -f "$WOOCOMMERCE_CORE_ZIP" ]; then if [ ! -f "$WOOCOMMERCE_CORE_ZIP" ]; then
echo "WooCommerce plugin zip not found. Downloading WooCommerce plugin latest zip" echo "WooCommerce plugin zip not found. Downloading WooCommerce plugin latest zip"
cd /project cd /project
@ -68,7 +68,7 @@ fi
# Install WooCommerce Subscriptions # Install WooCommerce Subscriptions
if [[ ! -d "/wp-core/wp-content/plugins/woocommerce-subscriptions" ]]; then if [[ ! -d "/wp-core/wp-content/plugins/woocommerce-subscriptions" ]]; then
WOOCOMMERCE_SUBS_ZIP="/wp-core/wp-content/plugins/mailpoet/tools/vendor/woocommerce-subscriptions.zip" WOOCOMMERCE_SUBS_ZIP="/wp-core/wp-content/plugins/mailpoet/tests/plugins/woocommerce-subscriptions.zip"
if [ ! -f "$WOOCOMMERCE_SUBS_ZIP" ]; then if [ ! -f "$WOOCOMMERCE_SUBS_ZIP" ]; then
echo "WooCommerce Subscriptions plugin zip not found. Downloading WooCommerce Subscription plugin latest zip" echo "WooCommerce Subscriptions plugin zip not found. Downloading WooCommerce Subscription plugin latest zip"
cd /project cd /project