Skip to content
Permalink
Browse files

Add empty file deletion output for bake tasks

  • Loading branch information...
bcrowe committed Sep 7, 2014
1 parent fa495a6 commit 509d0a0b23978405bee6e8f19c533d5aa12ecb0c
Showing with 16 additions and 9 deletions.
  1. +10 −6 src/Shell/Task/ModelTask.php
  2. +6 −3 src/Shell/Task/SimpleBakeTask.php
@@ -603,9 +603,11 @@ public function bakeEntity($model, array $data = []) {
$filename = $path . 'Entity' . DS . $name . '.php';
$this->out("\n" . sprintf('Baking entity class for %s...', $name), 1, Shell::QUIET);
$this->createFile($filename, $out);
$emptyFile = new File($path . 'Entity' . DS . 'empty');
if ($emptyFile->exists()) {
$emptyFile->delete();
$emptyFile = $path . 'Entity' . DS . 'empty';
$File = new File($emptyFile);
if ($File->exists()) {
$File->delete();
$this->out(sprintf('<success>Deleted</success> `%s`', $emptyFile), 1, Shell::QUIET);
}
return $out;
}
@@ -650,9 +652,11 @@ public function bakeTable($model, array $data = []) {
$filename = $path . 'Table' . DS . $name . 'Table.php';
$this->out("\n" . sprintf('Baking table class for %s...', $name), 1, Shell::QUIET);
$this->createFile($filename, $out);
$emptyFile = new File($path . 'Table' . DS . 'empty');
if ($emptyFile->exists()) {
$emptyFile->delete();
$emptyFile = $path . 'Table' . DS . 'empty';
$File = new File($emptyFile);
if ($File->exists()) {
$File->delete();
$this->out(sprintf('<success>Deleted</success> `%s`', $emptyFile), 1, Shell::QUIET);
}
return $out;
}
@@ -14,6 +14,7 @@
*/
namespace Cake\Shell\Task;
use Cake\Console\Shell;
use Cake\Shell\Task\BakeTask;
use Cake\Core\Configure;
use Cake\Core\Plugin;
@@ -97,9 +98,11 @@ public function bake($name) {
$filename = $this->getPath() . $this->fileName($name);
$this->createFile($filename, $contents);
$emptyFile = new File($this->getPath() . DS . 'empty');
if ($emptyFile->exists()) {
$emptyFile->delete();
$emptyFile = $this->getPath() . 'empty';
$File = new File($this->getPath() . 'empty');
if ($File->exists()) {
$File->delete();
$this->out(sprintf('<success>Deleted</success> `%s`', $emptyFile), 1, Shell::QUIET);
}
return $contents;
}

0 comments on commit 509d0a0

Please sign in to comment.
You can’t perform that action at this time.