70 $this->io = isset(
$io) ?
$io :
new NullIO();
72 $this->installationManager = $this->composer->getInstallationManager();
78 public function init()
81 $this->config = $this->composer->getConfig();
82 if (isset($this->config)) {
83 if ($this->config->has(
'component-dir')) {
84 $this->componentDir = $this->config->get(
'component-dir');
89 $allPackages =
array();
91 $locker = $this->composer->getLocker();
92 if ($locker !== null && $locker->isLocked()) {
93 $lockData = $locker->getLockData();
94 $allPackages = $lockData[
'packages'];
97 $dev = isset($lockData[
'packages-dev']) ? $lockData[
'packages-dev'] :
array();
98 foreach ($dev as $package) {
99 $allPackages[] = $package;
106 $rootPackage = $this->composer->getPackage();
107 $rootExtras = $rootPackage ? $rootPackage->getExtra() :
array();
108 $customComponents = isset($rootExtras[
'component']) ? $rootExtras[
'component'] :
array();
109 foreach ($allPackages as $package) {
110 $name = $package[
'name'];
111 if (isset($customComponents[$name]) && is_array($customComponents[$name])) {
112 $package[
'extra'] =
array(
'component' => $customComponents[$name]);
113 $this->packages[] = $package;
116 $extra = isset($package[
'extra']) ? $package[
'extra'] :
array();
117 if (isset($extra[
'component']) && is_array($extra[
'component'])) {
118 $this->packages[] = $package;
124 $root = $this->composer->getPackage();
126 $dumper =
new ArrayDumper();
127 $package = $dumper->dump($root);
128 $package[
'is-root'] =
true;
129 $this->packages[] = $package;
157 if (strpos($prettyName,
'/') !==
false) {
158 list($vendor, $name) = explode(
'/', $prettyName);
166 $component = isset($extra[
'component']) ? $extra[
'component'] :
array();
167 if (isset($component[
'name'])) {
168 $name = $component[
'name'];
189 return $this->componentDir = $dir;
202 if (isset($package[
'is-root']) && $package[
'is-root'] ===
true) {
205 if (!file_exists(
$path.DIRECTORY_SEPARATOR.
'composer.json')) {
206 for ($temp = __DIR__; strlen($temp) > 3; $temp = dirname($temp)) {
207 if (file_exists($temp.DIRECTORY_SEPARATOR.
'composer.json')) {
216 if (!isset($package[
'version'])) {
217 $package[
'version'] =
'1.0.0';
220 $completePackage =
$loader->load($package);
222 return $this->installationManager->getInstallPath($completePackage);
setComponentDir($dir)
Sets the component directory.
__construct(Composer $composer=null, IOInterface $io=null)
{Create a new Process.The Composer object to act on. Input/Output object to act on.}
init()
Initialize the process before its run.
getComponentDir()
Retrieves the component directory.
getComponentName($prettyName, array $extra=array())
Retrieves the component name for the component.
getVendorDir(array $package)
Retrieves the given package's vendor directory, where it's installed.
Create styles array
The data for the language used.
process()
{Called when running through the process.boolean True or false depending on whether the process was s...
Provides basic file system operations.