It is possible to set an "install-dir" option for a package now
This let's you completely customize the path needed for your custom package. So you can specify paths directly on top level and are not forced to install your packages under the vendor/ directory. Example: { "name": "my-project", "version": "1.0.0", "repositories": { "MyRepo": { "package": { "name": "mypackage", "version": "1.0", "install-dir": "lib/src/mypackage" "source": { "url": "https://github.com/awesomepackages/mypackage.git", "type": "git", "reference": "some-tag" } } } }, "require": { "mypackage" : "1.0" } }pull/115/head
parent
1d5a03eedc
commit
36dd725a88
|
@ -123,6 +123,11 @@ class LibraryInstaller implements InstallerInterface
|
|||
*/
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
{
|
||||
$installDir = $package->getInstallDir();
|
||||
if (isset($installDir))
|
||||
{
|
||||
return $installDir;
|
||||
}
|
||||
$targetDir = $package->getTargetDir();
|
||||
return ($this->directory ? $this->directory.'/' : '') . $package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ abstract class BasePackage implements PackageInterface
|
|||
protected $prettyName;
|
||||
protected $repository;
|
||||
protected $id;
|
||||
protected $installDir;
|
||||
|
||||
/**
|
||||
* All descendants' constructors should call this parent constructor
|
||||
|
@ -92,6 +93,16 @@ abstract class BasePackage implements PackageInterface
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function setInstallDir($dir)
|
||||
{
|
||||
$this->installDir = $dir;
|
||||
}
|
||||
|
||||
public function getInstallDir()
|
||||
{
|
||||
return $this->installDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the package matches the given constraint directly or through
|
||||
* provided or replaced packages
|
||||
|
|
|
@ -53,6 +53,10 @@ class ArrayLoader
|
|||
$package->setTargetDir($config['target-dir']);
|
||||
}
|
||||
|
||||
if (isset($config['install-dir'])) {
|
||||
$package->setInstallDir($config['install-dir']);
|
||||
}
|
||||
|
||||
if (isset($config['repositories'])) {
|
||||
$repositories = array();
|
||||
foreach ($config['repositories'] as $repoName => $repo) {
|
||||
|
|
Loading…
Reference in New Issue