-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aaff151
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
composer.phar | ||
nbproject | ||
._* | ||
.~lock.* | ||
.buildpath | ||
.DS_Store | ||
.idea | ||
.project | ||
.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "koubas/grouped-library-installer", | ||
"type": "composer-installer", | ||
"authors": [ | ||
{ | ||
"name": "Jakub Husak", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-0": {"Koubas\\Composer\\Installer": "src/"} | ||
}, | ||
"extra": { | ||
"class": "Koubas\\Composer\\Installer\\GroupedLibraryInstaller" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Koubas\Composer\Installer; | ||
|
||
|
||
use Composer\Composer; | ||
use Composer\IO\IOInterface; | ||
use Composer\Installer\LibraryInstaller; | ||
use Composer\Package\PackageInterface; | ||
|
||
class GroupedLibraryInstaller extends LibraryInstaller | ||
{ | ||
public function __construct(IOInterface $io, Composer $composer, $type = 'library') | ||
{ | ||
parent::__construct($io, $composer, $type); | ||
} | ||
|
||
public function getInstallPath(PackageInterface $package) | ||
{ | ||
$pkgNameParts = explode('/', $package->getName()); | ||
$words = explode('-', end($pkgNameParts)); | ||
$dirName = ''; | ||
foreach ($words as $word) { | ||
$dirName .= ucfirst($word); | ||
} | ||
return "module/$dirName"; | ||
} | ||
|
||
public function supports($packageType) | ||
{ | ||
return 'koubas-grouped-library' === $packageType; | ||
} | ||
} |