Skip to content

Commit

Permalink
Merge pull request #6 from coursehero/less-verbose
Browse files Browse the repository at this point in the history
make rebuild command less verbose on normal settings
  • Loading branch information
mikehenrty authored May 19, 2020
2 parents 628b97f + b9bf713 commit bb48792
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/Command/RebuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,19 @@ private function doDump(AssetInterface $asset, OutputInterface $stdout)
self::$assetTargetPaths[] = $target;

if (!is_dir($dir = dirname($target))) {
$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[dir+]</info> %s',
date('H:i:s'),
$dir
));
if (OutputInterface::VERBOSITY_VERBOSE <= $stdout->getVerbosity()) {
$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[dir+]</info> %s',
date('H:i:s'),
$dir
));
}

if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException('Unable to create directory '.$dir);
}
}

$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[file+]</info> %s',
date('H:i:s'),
$target
));

if (OutputInterface::VERBOSITY_VERBOSE <= $stdout->getVerbosity()) {
if ($asset instanceof AssetCollectionInterface) {
foreach ($asset as $leaf) {
Expand All @@ -205,23 +201,29 @@ private function doDump(AssetInterface $asset, OutputInterface $stdout)
}

if (\file_exists($target)) {
$stdout->writeln(
'<info>found</info>'
);
if (OutputInterface::VERBOSITY_VERBOSE <= $stdout->getVerbosity()) {
$stdout->writeln(
'<info>found</info>'
);
}
if (!$this->force) {
continue;
}

$stdout->writeln(
'<info>force recompile</info>'
);
if (OutputInterface::VERBOSITY_VERBOSE <= $stdout->getVerbosity()) {
$stdout->writeln(
'<info>force recompile</info>'
);
}

unlink($target);
}

$stdout->writeln(
'<comment>creating</comment>'
);
$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[compiling file+]</info> %s',
date('H:i:s'),
$target
));

if (false === @file_put_contents($target, $asset->dump())) {
throw new \RuntimeException('Unable to write file '.$target);
Expand Down

0 comments on commit bb48792

Please sign in to comment.