Skip to content

Commit

Permalink
Add loadExtendLibraries feature. (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Dec 7, 2016
1 parent 0247bd0 commit 433990f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private function copyFile($source, $destination, $override)

$filePath = dirname($destination);
if (!is_dir($filePath)) {
mkdir($filePath);
mkdir($filePath, 0777, true);
}

return copy(
Expand Down
22 changes: 22 additions & 0 deletions src/Utils/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,26 @@ public function appendCommandAliases()
);
}
}

public function loadExtendLibraries()
{
$directory = $this->getHomeDirectory() . '/.console/extend/';
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}

$autoloadFile = $directory . 'vendor/autoload.php';
if (!is_file($autoloadFile)) {
return null;
}
include_once $autoloadFile;

$extendFile = $directory . 'extends.yml';
if (!is_file($extendFile)) {
return null;
}
$builder = new YamlFileConfigurationBuilder([$extendFile]);

$this->configuration->import($builder->build());
}
}

0 comments on commit 433990f

Please sign in to comment.