Skip to content

Commit 2eb19ee

Browse files
committed
[FEATURE] ✨ Replace shortcut tasks with less verbose tasks
Shortcut tasks are verbose by default, replace it with a longer, but less verbose command. Refs #14
1 parent 639bf79 commit 2eb19ee

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/RoboFile.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function merge(array $options = [
9090
}
9191

9292
// Set working directory
93-
$workingDirectory = $options['working-directory'] ?? $this->_tmpDir();
93+
$workingDirectory = $options['working-directory'] ?? $this->getTemporaryDirectory();
9494
$this->say('Switch to working directory ' . $workingDirectory);
9595
chdir($workingDirectory);
9696

@@ -162,7 +162,9 @@ public function create(array $options = [
162162
return;
163163
}
164164

165-
$this->_copyDir(__DIR__ . '/../patches/template/', $patchDirectory);
165+
$this->taskCopyDir(__DIR__ . '/../patches/template/', $patchDirectory)
166+
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_DEBUG)
167+
->run();
166168

167169
$this->say('Patch directory created');
168170
$this->say('- Edit patch.php & commit-message.txt in ' . $patchDirectory);
@@ -183,7 +185,7 @@ protected function runPatch(array $options)
183185
{
184186
// Set working directory
185187
$patchSourceDirectory = ($options['patch-source-directory'] ?? getcwd() . '/patches/') . '/';
186-
$workingDirectory = $options['working-directory'] ?? $this->_tmpDir();
188+
$workingDirectory = $options['working-directory'] ?? $this->getTemporaryDirectory();
187189
$repositoryName = basename($options['repository-url']);
188190

189191
$this->say('Switch to working directory ' . $workingDirectory);
@@ -263,4 +265,17 @@ protected function runPatch(array $options)
263265

264266
return true;
265267
}
268+
269+
/**
270+
* Create a temporary directory
271+
*
272+
* @return string Directory path
273+
*/
274+
protected function getTemporaryDirectory()
275+
{
276+
$result = $this->taskTmpDir('tmp_patchbot')
277+
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_DEBUG)
278+
->run();
279+
return $result['path'] ?? '';
280+
}
266281
}

0 commit comments

Comments
 (0)