Skip to content
Permalink
Browse files

Remove empty files after bake

  • Loading branch information...
bcrowe committed Sep 7, 2014
1 parent 14f1319 commit fa495a6fece4ab858a198c715170c66c8bc6c36e
Showing with 15 additions and 0 deletions.
  1. +9 −0 src/Shell/Task/ModelTask.php
  2. +6 −0 src/Shell/Task/SimpleBakeTask.php
@@ -17,6 +17,7 @@
use Cake\Console\Shell;
use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
use Cake\Filesystem\File;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use Cake\Utility\Inflector;
@@ -602,6 +603,10 @@ 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();
}
return $out;
}
@@ -645,6 +650,10 @@ 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();
}
return $out;
}
@@ -16,6 +16,8 @@
use Cake\Shell\Task\BakeTask;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Filesystem\File;
use Cake\Utility\Inflector;
/**
@@ -95,6 +97,10 @@ 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();
}
return $contents;
}

0 comments on commit fa495a6

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