This repository was archived by the owner on Jun 11, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "name" : " hechoenlaravel/composer-plugin" ,
3+ "type" : " composer-plugin" ,
4+ "require" : {
5+ "composer-plugin-api" : " ^1.0"
6+ },
7+ "license" : " MIT" ,
8+ "autoload" : {
9+ "psr-4" : {
10+ "Hechoenlaravel\\ JarvisPlatformComposerPlugin\\ " : " src/"
11+ }
12+ },
13+ "extra" : {
14+ "class" : " Hechoenlaravel\\ JarvisPlatformComposerPlugin\\ Plugin"
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Hechoenlaravel \JarvisPlatformComposerPlugin ;
4+
5+ use Composer \Package \PackageInterface ;
6+ use Composer \Installer \LibraryInstaller ;
7+
8+ class ModuleInstaller extends LibraryInstaller
9+ {
10+ /**
11+ * {@inheritDoc}
12+ */
13+ public function getPackageBasePath (PackageInterface $ package )
14+ {
15+ $ ex = explode ('/ ' , $ package ->getPrettyName ());
16+ if (!isset ($ ex [1 ])) {
17+ throw new \InvalidArgumentException (
18+ 'Unable to install Module. '
19+ .'it Should always start their package name with '
20+ .'"vendor/jarvis-" '
21+ );
22+ }
23+ $ prefix = substr ($ ex [1 ], 0 , 6 );
24+ if ('jarvis- ' !== $ prefix )
25+ {
26+ throw new \InvalidArgumentException (
27+ 'Unable to install Module. '
28+ .'it Should always start their package name with '
29+ .'"vendor/jarvis-" '
30+ );
31+ }
32+
33+ return 'core/ ' .substr ($ ex [1 ], 6 );
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Hechoenlaravel \JarvisPlatformComposerPlugin ;
4+
5+ use Composer \Composer ;
6+ use Composer \IO \IOInterface ;
7+ use Composer \Plugin \PluginInterface ;
8+
9+ class Plugin implements PluginInterface
10+ {
11+ public function activate (Composer $ composer , IOInterface $ io )
12+ {
13+ $ installer = new ModuleInstaller ($ io , $ composer );
14+ $ composer ->getInstallationManager ()->addInstaller ($ installer );
15+ }
16+
17+ }
You can’t perform that action at this time.
0 commit comments