Skip to content

Commit

Permalink
Adding _pluginPath to Shell.
Browse files Browse the repository at this point in the history
provides one method to find plugins in shells.
  • Loading branch information
markstory committed Jun 6, 2009
1 parent 928ec36 commit d312cd3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cake/console/libs/shell.php
Expand Up @@ -611,5 +611,21 @@ function _singularHumanName($name) {
function _pluralHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
}
/**
* Find the correct path for a plugin. Scans $pluginPaths for the plugin you want.
*
* @param string $pluginName Name of the plugin you want ie. DebugKit
* @return string $path path to the correct plugin.
**/
function _pluginPath($pluginName) {
$pluginPaths = Configure::read('pluginPaths');
$pluginDirName = Inflector::underscore($pluginName);
foreach ($pluginPaths as $path) {
if (is_dir($path . $pluginDirName)) {
return $path . $pluginDirName . DS ;
}
}
return $pluginPaths[0] . $pluginDirName . DS;
}
}
?>

0 comments on commit d312cd3

Please sign in to comment.