From c9755e70946717688534e0d4bfea3b814488d03e Mon Sep 17 00:00:00 2001 From: Mischa Braam Date: Thu, 21 Mar 2024 15:45:15 +0100 Subject: [PATCH] Add shopware-cli binary --- cli/ValetPlus/Binary.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/cli/ValetPlus/Binary.php b/cli/ValetPlus/Binary.php index 9b20d615..69fcf891 100644 --- a/cli/ValetPlus/Binary.php +++ b/cli/ValetPlus/Binary.php @@ -22,6 +22,8 @@ class Binary protected const DRUSH_LAUNCHER = 'drush'; /** @var string */ protected const WP_CLI = 'wp'; + /** @var string */ + protected const SHOPWARE_CLI = 'shopware-cli'; /** * Supported binaries for the binary manager. Example: @@ -53,6 +55,10 @@ class Binary ], self::WP_CLI => [ 'brew_formula' => 'wp-cli' + ], + self::SHOPWARE_CLI => [ + 'brew_formula' => 'shopware-cli', + 'brew_tap' => 'friendsofshopware/tap' ] ]; @@ -171,7 +177,12 @@ public function installBinary($binary) // Install brew formula. if (isset(static::SUPPORTED_BINARIES[$binary]['brew_formula'])) { $formula = static::SUPPORTED_BINARIES[$binary]['brew_formula']; - $this->brew->ensureInstalled($formula); + $tap = ( + isset(static::SUPPORTED_BINARIES[$binary]['brew_tap']) ? + [static::SUPPORTED_BINARIES[$binary]['brew_tap']] : + [] + ); + $this->brew->ensureInstalled($formula, [], $tap); } } @@ -218,11 +229,23 @@ public function uninstallBinary($binary) */ protected function update($binary) { + // Update downloaded binary. if (isset(static::SUPPORTED_BINARIES[$binary]['bin_location'])) { info("Binary $binary updating..."); $binLocation = $this->getBinLocation($binary); $this->cli->run("sudo $binLocation self-update"); } + + // Update brew formula. + if (isset(static::SUPPORTED_BINARIES[$binary]['brew_formula'])) { + $formula = static::SUPPORTED_BINARIES[$binary]['brew_formula']; + $tap = ( + isset(static::SUPPORTED_BINARIES[$binary]['brew_tap']) ? + [static::SUPPORTED_BINARIES[$binary]['brew_tap']] : + [] + ); + $this->brew->installOrFail($formula, [], $tap); + } } /**