Skip to content

Commit

Permalink
CS fix and add text styles
Browse files Browse the repository at this point in the history
  • Loading branch information
padraic committed Jun 19, 2017
1 parent 2616041 commit 4bf01d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/Console/Command/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private function updateToStableBuild()
private function getStableUpdater(): Updater
{
$this->updater->setStrategy(Updater::STRATEGY_GITHUB);

return $this->getGithubReleasesUpdater($updater);
}

Expand Down Expand Up @@ -208,13 +209,15 @@ private function printVersion(Updater $updater)

/**
* @param Updater $updater
*
* @return Updater
*/
private function getGithubReleasesUpdater(Updater $updater): Updater
{
$this->updater->getStrategy()->setPackageName(self::PACKAGIST_PACKAGE_NAME);
$this->updater->getStrategy()->setPharName(self::REMOTE_FILENAME);
$this->updater->getStrategy()->setCurrentLocalVersion($this->version);

return $updater;
}

Expand Down
21 changes: 11 additions & 10 deletions src/Logger/UpdateConsoleLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
namespace Humbug\PhpScoper\Logger;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
Expand Down Expand Up @@ -50,11 +48,11 @@ public function updateSuccess(string $newVersion, string $oldVersion)
{
$this->io->writeln('PHP-Scoper has been updated.');
$this->io->writeln(sprintf(
'Current version is: %s.',
'Current version is: <comment>%s</comment>.',
$newVersion
));
$this->io->writeln(sprintf(
'Previous version was: %s.',
'Previous version was: <comment>%s</comment>.',
$oldVersion
));
}
Expand All @@ -63,14 +61,17 @@ public function updateNotNeeded(string $oldVersion)
{
$this->io->writeln('PHP-Scoper is currently up to date.');
$this->io->writeln(sprintf(
'Current version is: %s.',
'Current version is: <comment>%s</comment>.',
$oldVersion
));
}

public function error(\Exception $e)
{
$this->io->writeln(sprintf('Error: %s', $e->getMessage()));
$this->io->writeln(
'<error>Unexpected error. If updating, your original phar is untouched.</error>'
);
$this->io->writeln(sprintf('<error>%s</error>', $e->getMessage()));
}

public function rollbackSuccess()
Expand All @@ -86,27 +87,27 @@ public function rollbackFail()
public function printLocalVersion(string $version)
{
$this->io->writeln(sprintf(
'Your current local version is: %s',
'Your current local version is: <comment>%s</comment>',
$version
));
}

public function printRemoteVersion(string $stability, string $version)
{
$this->io->writeln(sprintf(
'The current %s build available remotely is: %s',
'The current <comment>%s</comment> build available remotely is: <comment>%s</comment>',
$stability,
$version
));
}

public function noNewRemoteVersions(string $stability)
{
$this->io->writeln(sprintf('There are no new %s builds available.', $stability));
$this->io->writeln(sprintf('There are no new <comment>%s</comment> builds available.', $stability));
}

public function currentVersionInstalled(string $stability)
{
$this->io->writeln(sprintf('You have the current %s build installed.', $stability));
$this->io->writeln(sprintf('You have the current <comment>%s</comment> build installed.', $stability));
}
}

0 comments on commit 4bf01d7

Please sign in to comment.