File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /vendor /
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " detain/myadmin_composer_plugin" ,
3+ "description" : " A composer plugin to handle the various types of 3rd party software we deal with in MyAdmin" ,
4+ "type" : " composer-plugin" ,
5+ "license" : " GPL" ,
6+ "authors" : [
7+ {
8+ "name" : " Joe Huss" ,
9+ "email" : " detain@interserver.net"
10+ }
11+ ],
12+ " autoload" ": {
13+ "psr-0" : {"detain\\ " : " include/" }
14+ },
15+ "require" : {
16+ "composer-plugin-api" : " ^1.0"
17+ },
18+ "extra" : {
19+ "class" : " detain\\ Composer\\ TemplateInstallerPlugin" "
20+ },
21+ "minimum-stability" : " dev"
22+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace detain \Composer ;
4+
5+ use Composer \Package \PackageInterface ;
6+ use Composer \Installer \LibraryInstaller ;
7+
8+ class TemplateInstaller extends LibraryInstaller
9+ {
10+ /**
11+ * {@inheritDoc}
12+ */
13+ public function getInstallPath (PackageInterface $ package )
14+ {
15+ $ prefix = substr ($ package ->getPrettyName (), 0 , 23 );
16+ if ('myadmin/template- ' !== $ prefix ) {
17+ throw new \InvalidArgumentException (
18+ 'Unable to install template, myadmin templates '
19+ .'should always start their package name with '
20+ .'"myadmin/template-" '
21+ );
22+ }
23+
24+ return 'data/templates/ ' .substr ($ package ->getPrettyName (), 23 );
25+ }
26+
27+ /**
28+ * {@inheritDoc}
29+ */
30+ public function supports ($ packageType )
31+ {
32+ return 'myadmin-template ' === $ packageType ;
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace detain \Composer ;
4+
5+ use Composer \Composer ;
6+ use Composer \IO \IOInterface ;
7+ use Composer \Plugin \PluginInterface ;
8+
9+ class TemplateInstallerPlugin implements PluginInterface
10+ {
11+ public function activate (Composer $ composer , IOInterface $ io )
12+ {
13+ $ installer = new TemplateInstaller ($ io , $ composer );
14+ $ composer ->getInstallationManager ()->addInstaller ($ installer );
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments