Skip to content

Commit

Permalink
Add shopware-cli binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mischabraam committed Mar 21, 2024
1 parent 8db24e2 commit c9755e7
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion cli/ValetPlus/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -53,6 +55,10 @@ class Binary
],
self::WP_CLI => [
'brew_formula' => 'wp-cli'
],
self::SHOPWARE_CLI => [
'brew_formula' => 'shopware-cli',
'brew_tap' => 'friendsofshopware/tap'
]
];

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit c9755e7

Please sign in to comment.