Skip to content

Commit

Permalink
Merge pull request #17 from consolidation/allow-ignore-phar-check
Browse files Browse the repository at this point in the history
Add option to ignore phar running check.
  • Loading branch information
greg-1-anderson authored Feb 8, 2022
2 parents 117dcc9 + 17ff6f3 commit 48d3bfa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,26 @@ class SelfUpdateCommand extends Command

protected $applicationName;

protected $ignorePharRunningCheck;

public function __construct($applicationName = null, $currentVersion = null, $gitHubRepository = null)
{
$this->applicationName = $applicationName;
$this->currentVersion = $currentVersion;
$this->gitHubRepository = $gitHubRepository;
$this->ignorePharRunningCheck = false;

parent::__construct(self::SELF_UPDATE_COMMAND_NAME);
}

/**
* Set ignorePharRunningCheck to true.
*/
public function ignorePharRunningCheck($ignore = true)
{
$this->ignorePharRunningCheck = $ignore;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -163,7 +174,7 @@ public function getLatestReleaseFromGithub(array $options)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (empty(\Phar::running())) {
if (!$this->ignorePharRunningCheck && empty(\Phar::running())) {
throw new \Exception(self::SELF_UPDATE_COMMAND_NAME . ' only works when running the phar version of ' . $this->applicationName . '.');
}

Expand Down

0 comments on commit 48d3bfa

Please sign in to comment.