Ticket #23912: installer.patch
File installer.patch, 5.9 KB (added by , 11 years ago) |
---|
-
tools/installer/tags/0.1.0
-
tools/installer/tags/0.1.0/src/WordPress/Composer/Installer.php
Property changes on: tools/installer/tags/0.1.0 ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,3 ## +vendor +composer.lock +
1 <?php 2 3 namespace WordPress\Composer; 4 5 use Composer\Installer\LibraryInstaller; 6 use Composer\Package\PackageInterface; 7 8 class Installer extends LibraryInstaller { 9 10 const TYPE = 'wordpress-core'; 11 12 private static $_installedPaths = array(); 13 14 /** 15 * {@inheritDoc} 16 */ 17 public function getInstallPath( PackageInterface $package ) { 18 $installationDir = false; 19 $prettyName = $package->getPrettyName(); 20 if ( $this->composer->getPackage() ) { 21 $topExtra = $this->composer->getPackage()->getExtra(); 22 if ( ! empty( $topExtra['wordpress-install-dir'] ) ) { 23 $installationDir = $topExtra['wordpress-install-dir']; 24 if ( is_array( $installationDir ) ) { 25 $installationDir = empty( $installationDir[$prettyName] ) ? false : $installationDir[$prettyName]; 26 } 27 } 28 } 29 $extra = $package->getExtra(); 30 if ( ! $installationDir && ! empty( $extra['wordpress-install-dir'] ) ) { 31 $installationDir = $extra['wordpress-install-dir']; 32 } 33 if ( ! $installationDir ) { 34 $installationDir = 'wordpress'; 35 } 36 if ( 37 ! empty( self::$_installedPaths[$installationDir] ) && 38 $prettyName !== self::$_installedPaths[$installationDir] 39 ) { 40 throw new \InvalidArgumentException( 'Two packages cannot share the same directory!' ); 41 } 42 self::$_installedPaths[$installationDir] = $prettyName; 43 return $installationDir; 44 } 45 46 /** 47 * {@inheritDoc} 48 */ 49 public function supports( $packageType ) { 50 return self::TYPE === $packageType; 51 } 52 53 } -
tools/installer/tags/0.1.0/composer.json
1 { 2 "name" : "wordpress/installer", 3 "description" : "A custom installer to handle deploying WordPress with composer", 4 "type" : "composer-installer", 5 "license" : "GPL-2.0+", 6 "minimum-stability": "dev", 7 "authors" : [ 8 { 9 "name" : "WordPress Community", 10 "homepage": "http://wordpress.org/about/" 11 } 12 ], 13 "autoload" : { 14 "psr-0": { 15 "WordPress\\Composer\\": "src/" 16 } 17 }, 18 "extra" : { 19 "class": "WordPress\\Composer\\Installer" 20 }, 21 "require-dev" : { 22 "composer/composer": "1.0.*@dev" 23 } 24 } -
tools/installer/trunk
-
tools/installer/trunk/src/WordPress/Composer/Installer.php
Property changes on: tools/installer/trunk ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,3 ## +vendor +composer.lock +
1 <?php 2 3 namespace WordPress\Composer; 4 5 use Composer\Installer\LibraryInstaller; 6 use Composer\Package\PackageInterface; 7 8 class Installer extends LibraryInstaller { 9 10 const TYPE = 'wordpress-core'; 11 12 private static $_installedPaths = array(); 13 14 /** 15 * {@inheritDoc} 16 */ 17 public function getInstallPath( PackageInterface $package ) { 18 $installationDir = false; 19 $prettyName = $package->getPrettyName(); 20 if ( $this->composer->getPackage() ) { 21 $topExtra = $this->composer->getPackage()->getExtra(); 22 if ( ! empty( $topExtra['wordpress-install-dir'] ) ) { 23 $installationDir = $topExtra['wordpress-install-dir']; 24 if ( is_array( $installationDir ) ) { 25 $installationDir = empty( $installationDir[$prettyName] ) ? false : $installationDir[$prettyName]; 26 } 27 } 28 } 29 $extra = $package->getExtra(); 30 if ( ! $installationDir && ! empty( $extra['wordpress-install-dir'] ) ) { 31 $installationDir = $extra['wordpress-install-dir']; 32 } 33 if ( ! $installationDir ) { 34 $installationDir = 'wordpress'; 35 } 36 if ( 37 ! empty( self::$_installedPaths[$installationDir] ) && 38 $prettyName !== self::$_installedPaths[$installationDir] 39 ) { 40 throw new \InvalidArgumentException( 'Two packages cannot share the same directory!' ); 41 } 42 self::$_installedPaths[$installationDir] = $prettyName; 43 return $installationDir; 44 } 45 46 /** 47 * {@inheritDoc} 48 */ 49 public function supports( $packageType ) { 50 return self::TYPE === $packageType; 51 } 52 53 } -
tools/installer/trunk/composer.json
1 { 2 "name" : "wordpress/installer", 3 "description" : "A custom installer to handle deploying WordPress with composer", 4 "type" : "composer-installer", 5 "license" : "GPL-2.0+", 6 "minimum-stability": "dev", 7 "authors" : [ 8 { 9 "name" : "WordPress Community", 10 "homepage": "http://wordpress.org/about/" 11 } 12 ], 13 "autoload" : { 14 "psr-0": { 15 "WordPress\\Composer\\": "src/" 16 } 17 }, 18 "extra" : { 19 "class": "WordPress\\Composer\\Installer" 20 }, 21 "require-dev" : { 22 "composer/composer": "1.0.*@dev" 23 } 24 }