Skip to content

Commit

Permalink
Merge pull request consolidation#404 from consolidation-org/no-progre…
Browse files Browse the repository at this point in the history
…ss-filter

Remove 'filter' parameter from progressMessage().
  • Loading branch information
greg-1-anderson authored Aug 10, 2016
2 parents 04fee17 + 4c14b4b commit d0c5056
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
19 changes: 0 additions & 19 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,25 +639,6 @@ public function tryTmpDir()
$result = $collection
->taskWriteToFile("$tmpPath/file.txt")
->line('Example file')

// Print a progress message. The callback function is called immediately
// before the message is printed.
->progressMessage(
'The directory at {path} {verb}.',
['path' => $tmpPath, 'verb' => 'might have been created'],
function ($context) {
// It would also be legitimate to `use ($tmpDir)` and reference that.
if (is_dir($context['path'])) {
$context['verb'] = 'was created';
} else {
// Should never get here: will roll back if creation fails.
$context['verb'] = 'was NOT created';
}
return $context;
}
)

// Run the tasks that we build
->run();

if (is_dir($tmpPath)) {
Expand Down
7 changes: 3 additions & 4 deletions src/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,13 @@ public function after($name, $task, $nameOfTaskToAdd = self::UNNAMEDTASK)
/**
* @inheritdoc
*/
public function progressMessage($text, $context = [], $filter = false, $level = LogLevel::NOTICE)
public function progressMessage($text, $context = [], $level = LogLevel::NOTICE)
{
$context += ['name' => 'Progress'];
$context += TaskInfo::getTaskContext($this);
return $this->addCode(
function () use ($level, $text, $context, $filter) {
$filteredContext = $filter ? $filter($context, $this) : $context;
$this->printTaskOutput($level, $text, $filteredContext);
function () use ($level, $text, $context) {
$this->printTaskOutput($level, $text, $context);
}
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/CollectionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ public function completionCode(callable $completionCode)
return $this;
}

public function progressMessage($text, $context = [], $filter = false, $level = LogLevel::NOTICE)
public function progressMessage($text, $context = [], $level = LogLevel::NOTICE)
{
$this->getCollection()->progressMessage($text, $context, $filter, $level);
$this->getCollection()->progressMessage($text, $context, $level);
return $this;
}

Expand Down
5 changes: 1 addition & 4 deletions src/Collection/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ public function after($name, $task, $nameOfTaskToAdd = self::UNNAMEDTASK);
*
* @param string $text Message to print.
* @param array $context Extra context data for use by the logger.
* @param callable $filter A callable function used to filter $context.
* Called just before message is printed. Is passed $context and $this;
* should return the new $context.
* @param LogLevel $level The log level to print the information at. Default is NOTICE.
* @return CollectionInterface
*/
public function progressMessage($text, $context = [], $filter = false, $level = LogLevel::NOTICE);
public function progressMessage($text, $context = [], $level = LogLevel::NOTICE);
}

0 comments on commit d0c5056

Please sign in to comment.