Skip to content

Commit

Permalink
Bring back tmp installation step
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Mar 22, 2021
1 parent 994f20a commit 0a32fe1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Tool/Command/PhiveInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ public function __construct(string $alias, string $bin, ?string $sig = null)
public function __toString(): string
{
$home = \sprintf('%s/.phive', \dirname($this->bin));
$target = \dirname($this->bin);
$tmp = \sprintf('%s/tmp/%s', $home, \md5($this->alias));

return \sprintf(
'phive --no-progress --home %s install %s %s -t %s',
'phive --no-progress --home %s install %s %s -t %s && mv %s/* %s',
$home,
$this->sig ? '--trust-gpg-keys '.$this->sig : '--force-accept-unsigned',
$this->alias,
$target
$tmp,
$tmp,
$this->bin
);
}
}
4 changes: 2 additions & 2 deletions tests/Tool/Command/PhiveInstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public function test_it_is_a_command()

public function test_it_generates_the_installation_command()
{
$this->assertMatchesRegularExpression(\sprintf('#phive --no-progress --home [^\s]*? install --trust-gpg-keys %s %s -t [^\s]++#', self::SIG, self::ALIAS, self::BIN), (string) $this->command);
$this->assertMatchesRegularExpression(\sprintf('#phive --no-progress --home [^\s]*? install --trust-gpg-keys %s %s -t [^\s]++ && mv [^\s]+? %s#', self::SIG, self::ALIAS, self::BIN), (string) $this->command);
}

public function test_it_accepts_unsigned_phar_command()
{
$command = new PhiveInstallCommand(self::ALIAS, self::BIN);
$this->assertMatchesRegularExpression(\sprintf('#phive --no-progress --home [^\s]*? install --force-accept-unsigned %s -t [^\s]++#', self::ALIAS, self::BIN), (string) $command);
$this->assertMatchesRegularExpression(\sprintf('#phive --no-progress --home [^\s]*? install --force-accept-unsigned %s -t [^\s]++ && mv [^\s]+?#', self::ALIAS, self::BIN), (string) $command);
}
}
2 changes: 1 addition & 1 deletion tests/UseCase/InstallToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function test_it_includes_phive_install_commands()
]));

$command = $this->useCase->__invoke($this->filter());
$this->assertMatchesRegularExpression('#phive --no-progress --home /tools/.phive install[^&]*?phpunit[^&]*? [^\s]++#', (string)$command);
$this->assertMatchesRegularExpression('#phive --no-progress --home /tools/.phive install[^&]*?phpunit[^&]*? [^\s]++ && mv [^\s]++ /tools/phpunit#', (string)$command);
}

public function test_it_includes_file_download_commands()
Expand Down

0 comments on commit 0a32fe1

Please sign in to comment.