Skip to content

Commit

Permalink
Skip plugins which do not have webroot.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 20, 2014
1 parent b3b31f7 commit 55a5bfd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/Shell/Task/AssetsTask.php
Expand Up @@ -32,23 +32,31 @@ class AssetsTask extends Shell {
* @return void
*/
public function main() {
$this->_symlink();
$this->_process();
}

/**
* Symlink folder
* Process plugins
*
* @return void
*/
protected function _symlink() {
$this->out();
$this->out();
$this->out('Symlinking...');
$this->hr();
protected function _process() {
$plugins = Plugin::loaded();
foreach ($plugins as $plugin) {
$this->out('For plugin: ' . $plugin);
$path = Plugin::path($plugin) . 'webroot';
if (!is_dir($path)) {
$this->out();
$this->out(
sprintf('Skipping plugin %s. It does not have webroot folder.', $plugin),
2,
Shell::VERBOSE
);
continue;
}

$this->out();
$this->out('For plugin: ' . $plugin);
$this->hr();

$link = Inflector::underscore($plugin);
$dir = WWW_ROOT;
Expand All @@ -71,7 +79,6 @@ protected function _symlink() {
}
}

$path = Plugin::path($plugin) . 'webroot';
$this->out('Creating symlink: ' . $dir);
$this->out();
// @codingStandardsIgnoreStart
Expand Down
12 changes: 12 additions & 0 deletions tests/TestCase/Shell/Task/AssetsTaskTest.php
Expand Up @@ -79,4 +79,16 @@ public function testExecute() {
$folder->delete();
}

/**
* testExecute method
*
* @return void
*/
public function testForPluginWithoutWebroot() {
Plugin::load('TestPluginTwo');

$this->Task->main();
$this->assertFalse(file_exists(WWW_ROOT . 'test_plugin_two'));
}

}

0 comments on commit 55a5bfd

Please sign in to comment.