protected function getPackageBasePath(PackageInterface $package)
 {
     if (!$this->supports($package->getType())) {
         throw new \InvalidArgumentException("Package type [{$type}] is not supported");
     }
     return self::$allowedTypes[$package->getType()] . '/' . $package->getPrettyName();
 }
예제 #2
0
 /**
  * Returns the root installation path for templates.
  *
  * @param PackageInterface $package
  *
  * @return string a path relative to the root of the composer.json
  */
 protected function getRootPath(PackageInterface $package)
 {
     $rootPath = $this->vendorDir . '/raulfraile/ladybug-themes/Ladybug/';
     if ($this->composer->getPackage()->getName() === 'raulfraile/ladybug') {
         $rootPath = 'data/' . ($package->getType() === self::PACKAGE_TYPE_THEME ? 'themes' : 'plugins') . '/Ladybug/';
     }
     $rootPath .= $package->getType() === self::PACKAGE_TYPE_THEME ? 'Theme' : 'Plugin';
     return $rootPath;
 }
 /**
  * Retrieve the pattern for the given package.
  *
  * @param \Composer\Package\PackageInterface $package
  *
  * @return string
  */
 public function getPattern(PackageInterface $package)
 {
     if (isset($this->packages[$package->getName()])) {
         return $this->packages[$package->getName()];
     } elseif (isset($this->packages[$package->getPrettyName()])) {
         return $this->packages[$package->getPrettyName()];
     } elseif (isset($this->types[$package->getType()])) {
         return $this->types[$package->getType()];
     }
 }
 /**
  * Determines the install path for git hooks,
  *
  * The installation path is the standard git hooks directory documented here:
  * https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
  *
  * @param PackageInterface $package
  *
  * @return string a path relative to the root of the composer.json that is being installed.
  */
 public function getInstallPath(PackageInterface $package)
 {
     if (!$this->supports($package->getType())) {
         throw new \InvalidArgumentException('Unable to install package, git-hook packages only ' . 'support "git-hook", "library" type packages.');
     }
     // Allow to LibraryInstaller to resolve the installPath for other packages.
     if ($package->getType() !== 'git-hook') {
         return parent::getInstallPath($package);
     }
     return $this->getGitHooksPath();
 }
예제 #5
0
 /**
  * getPackageBasePath.
  *
  * @param PackageInterface $package
  *
  * @return string
  */
 protected function getPackageBasePath(PackageInterface $package)
 {
     if (isset($this->paths[$package->getType()]) && ($path = $this->paths[$package->getType()])) {
         @(list($vendor, $name) = explode('/', $package->getPrettyName()));
         $path = strtr($path, array('{vendor}' => $vendor, '{name}' => $name));
         return rtrim($path, '/');
     }
     if (($extra = $package->getExtra()) && isset($extra['courier-path'])) {
         return rtrim($extra['courier-path'], '/');
     }
     return ($this->vendorDir ? $this->vendorDir . '/' : '') . $package->getPrettyName();
 }
 /**
  * {@inheritDoc}
  */
 protected function getPackageBasePath(PackageInterface $package)
 {
     $targetPath = '.faye-app';
     if ('faye-app-integration-plugin' == $package->getType()) {
         $targetPath .= '/plugins';
     }
     if ($targetPath && !file_exists($targetPath)) {
         mkdir($targetPath, 0777, true);
     }
     if ('faye-app-integration-plugin' == $package->getType()) {
         return $targetPath . '/' . str_replace('/', '-', $package->getPrettyName());
     }
     return $targetPath;
 }
 /**
  * Returns the installation path of a package
  *
  * @param PackageInterface $package Package
  * 
  * @return string
  */
 public function getInstallPath(PackageInterface $package)
 {
     switch ($package->getType()) {
         case self::TYPE_WORDPRESS:
             return 'wp';
     }
 }
 protected function getCoreInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     $availableVars = compact('name', 'vendor', 'type');
     $extra = $package->getExtra();
     if (!empty($extra['installer-name'])) {
         $availableVars['name'] = $extra['installer-name'];
     }
     if ($this->composer->getPackage()) {
         $extra = $this->composer->getPackage()->getExtra();
         if (!empty($extra['installer-paths'])) {
             $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type);
             if ($customPath !== false) {
                 return $this->templatePath($customPath, $availableVars);
             }
         }
     }
     $path = self::DEFAULT_TARGET_PATH;
     return $this->templatePath($path, $availableVars);
 }
예제 #9
0
 /**
  * Returns the installation path of a package
  *
  * @param PackageInterface $package Package to install.
  * @return string path
  */
 public function getInstallPath(PackageInterface $package)
 {
     if ($package->getType() === $this->type) {
         return 'Packages/Applications/' . self::getPathName($package);
     }
     throw new \InvalidArgumentException('Sorry the package type of this package is not supported.');
 }
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->initGingerBackend();
     $extra = $package->getExtra();
     $uninstallPluginCommand = new Cqrs\UninstallPluginCommand(array('plugin_name' => $package->getName(), 'plugin_type' => $package->getType(), 'plugin_namespace' => $extra['plugin-namespace'], 'plugin_version' => $package->getVersion()));
     $this->getServiceManager()->get('malocher.cqrs.gate')->getBus()->invokeCommand($uninstallPluginCommand);
     parent::uninstall($repo, $package);
 }
 /**
  *
  * @param PackageInterface $package        	
  *
  * @return string a path relative to the root of the composer.json that is being installed.
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     if ($type === 'keeko-core') {
         return 'core';
     }
     return $this->getPackageDir($type) . '/' . $package->getName();
 }
예제 #12
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $name = $package->getPrettyName();
     if (strpos($name, '/') !== false) {
         list($vendor, $name) = explode('/', $name);
     }
     if ($package->getType() === 'modulargaming-module') {
         return 'modulargaming/' . $name;
     }
     if ($package->getType() === 'modulargaming-theme') {
         // Remove theme- prefix if it exists.
         if (substr($name, 0, 6) === 'theme-') {
             $name = substr($name, 6);
         }
         return 'themes/' . $name;
     }
 }
예제 #13
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $packageType = $package->getType();
     if (!isset($this->locations[$packageType])) {
         throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $packageType));
     }
     list($vendor, $name) = explode('/', strtolower($package->getName()), 2);
     $extra = $package->getExtra();
     $path = str_replace(['{$vendor}', '{$name}', '{$extra.dir}'], [$vendor, $name, $extra['dir']], $this->locations[$packageType]);
     return $this->vendorDir . '/' . $path;
 }
예제 #14
0
 /**
  * Returns the installer for a given type
  *
  * @param PackageInterface
  * @return AbstractPackageInstaller
  */
 private function getInstaller(PackageInterface $package)
 {
     switch ($package->getType()) {
         case 'keeko-app':
             return new AppInstaller();
         case 'keeko-module':
             return new ModuleInstaller();
         default:
             return new DummyInstaller();
     }
 }
예제 #15
0
 /**
  * {@inheritdoc}
  */
 protected function getPackageBasePath(PackageInterface $package)
 {
     switch ($package->getType()) {
         case self::TYPE_MOODLE_SOURCE:
             $basePath = $this->getMoodleDir();
             break;
         default:
             $basePath = parent::getPackageBasePath($package);
     }
     return $basePath;
 }
예제 #16
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     $frameworkType = $this->findFrameworkType($type);
     if ($frameworkType === false) {
         throw new \InvalidArgumentException('Sorry the package type of this package is not yet supported.');
     }
     $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
     $installer = new $class($package, $this->composer);
     return $installer->getInstallPath($package, $frameworkType);
 }
예제 #17
0
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     if (!isset($this->locations[$package->getType()])) {
         throw new \InvalidArgumentException(sprintf('package type "%s" is not supported', $type));
     }
     $base = $this->locations[$type];
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     $extra = $package->getExtra();
     if (!empty($extra['installer-name'])) {
         $name = $extra['installer-name'];
     }
     return $base . $name;
 }
예제 #18
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     $packageType = substr($type, 0, strpos($type, '-'));
     if (!isset($this->supportedTypes[$packageType])) {
         throw new \InvalidArgumentException('Sorry the package type of this package is not yet supported.');
     }
     $class = 'Composer\\Installers\\' . $this->supportedTypes[$packageType];
     $installer = new $class($package, $this->composer);
     return $installer->getInstallPath($package);
 }
예제 #19
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     $supportedType = $this->supportedType($type);
     if ($supportedType === false) {
         throw new InvalidArgumentException('Sorry the package type of this package is not supported.');
     }
     $class = 'Blesta\\Composer\\Installer\\' . $this->supportedTypes[$supportedType];
     $installer = new $class($package, $this->composer, $this->io);
     return $installer->getInstallPath($package, $supportedType);
 }
예제 #20
0
 public static function parse(PackageInterface $package)
 {
     $type = $package->getType();
     $extra = $package->getExtra();
     $map = array();
     foreach (self::$actions as $action => $classmap) {
         if (array_key_exists($action, $extra)) {
             $map[$classmap] = $extra[$action];
         }
     }
     return $map;
 }
 /**
  * @param $path
  * @param PackageInterface $package
  */
 public function removeExtension($path, PackageInterface $package)
 {
     if ($package->getType() === 'fraym-core') {
         $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Fraym', 'Fraym');
         $this->removeSymlinks($path, '', DIRECTORY_SEPARATOR . 'Bootstrap.php');
     }
     $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Extension', 'Extension');
     $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Public', 'Public');
     $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Template', 'Template');
     $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Test', 'Test');
     $this->removeSymlinks($path . DIRECTORY_SEPARATOR . 'Hook', 'Hook');
 }
예제 #22
0
 /**
  * {@inheritDoc}
  */
 public function getPackageBasePath(PackageInterface $package)
 {
     $prefix = substr($package->getPrettyName(), 0, 9);
     if ('phalcana/' !== $prefix) {
         throw new \InvalidArgumentException('Unable to install module, phalcana modules ' . 'should always start their package name with ' . '"phalcana/"');
     }
     if ($package->getType() == 'phalcana-core') {
         return 'system';
     } else {
         return 'modules/' . substr($package->getPrettyName(), 9);
     }
 }
예제 #23
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     switch ($package->getType()) {
         case self::TYPE_PLUGIN:
             $dir = 'plugins';
             break;
         case self::TYPE_THEME:
             $dir = 'themes';
             break;
     }
     return $dir . '/' . $this->getExtraName($package);
 }
예제 #24
0
 /**
  * Returns the installation path of a package
  *
  * @param  PackageInterface $package
  * @return string path to install the packgae in
  */
 public function getInstallPath(PackageInterface $package)
 {
     $flowPackageType = $this->getFlowPackageType($package->getType());
     $camelCasedType = $this->camelCaseFlowPackageType($flowPackageType);
     $flowPackageName = $this->deriveFlowPackageName($package);
     if (isset($this->packageTypeToPathMapping[$flowPackageType])) {
         $installPath = $this->packageTypeToPathMapping[$flowPackageType];
     } else {
         $installPath = $this->packageTypeToPathMapping['*'];
     }
     return $this->replacePlaceholdersInPath($installPath, compact('flowPackageType', 'camelCasedType', 'flowPackageName'));
 }
 /**
  * Retrieve replacement tokens for the given package.
  *
  * @param \Composer\Package\PackageInterface $package
  *
  * @return array
  */
 protected function getPackageReplacementTokens(PackageInterface $package)
 {
     $vars = array('{$type}' => $package->getType());
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         $pieces = explode('/', $prettyName);
         $vars['{$vendor}'] = $pieces[0];
         $vars['{$name}'] = $pieces[1];
     } else {
         $vars['{$vendor}'] = '';
         $vars['{$name}'] = $prettyName;
     }
     return $vars;
 }
예제 #26
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     if ($type !== 'zetcms-module') {
         throw new \InvalidArgumentException('Sorry the package type of this package is not yet supported.');
     }
     $prettyName = $this->package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     return 'modules/' . str_replace('/', '-', $prettyName);
 }
예제 #27
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     $extra = $this->composer->getPackage()->getExtra();
     $vars = array('type' => $type);
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== FALSE) {
         $pieces = explode('/', $prettyName);
         $vars['vendor'] = $pieces[0];
         $vars['name'] = $pieces[1];
     } else {
         $vars['vendor'] = '';
         $vars['name'] = $prettyName;
     }
     return $this->templatePath($extra['custom-installer'][$type], $vars);
 }
예제 #28
0
 function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     // get the path from the mapping or the defaults
     if (!empty($this->installInfo['path-mapping'][$type])) {
         $path = $this->installInfo['path-mapping'][$type];
     } else {
         $path = $this->installInfo['default-paths'][$type];
     }
     // only add the slug for themes and plugins
     if ($type !== 'wordpress-core') {
         list(, $slug) = explode('/', $package->getPrettyName());
         $path .= "/{$slug}";
     }
     return $path;
 }
예제 #29
0
 /**
  * Performs actions on the downloaded files after an installation or update
  *
  * @var string $type
  * @var string $downloadPath
  */
 protected function postInstallActions(PackageInterface $target, $downloadPath)
 {
     // @HACK to work around the security check in CI config files
     defined('BASEPATH') || define('BASEPATH', 1);
     switch ($target->getType()) {
         case 'codeigniter-core':
             // Move the core library extension out of the package directory and remove it
             $this->moveCoreFiles($downloadPath);
             break;
         case 'codeigniter-library':
             // Move the library files out of the package directory and remove it
             $wildcard = $this->package_subclass_prefix . "*.php";
             $path = realpath($downloadPath) . '/' . $wildcard;
             if (count(glob($path)) > 0) {
                 $this->moveCoreFiles($downloadPath, $wildcard);
             }
             break;
         case 'projek-ci-module':
         case 'codeigniter-module':
             // If the module has migrations, copy them into the application migrations directory
             $moduleMigrations = $this->getModuleMigrations($downloadPath);
             if (count($moduleMigrations) > 0) {
                 $config = $this->getMigrationConfig($downloadPath);
                 $copied = $this->copyModuleMigrations($config, $moduleMigrations);
                 if ($copied) {
                     $this->io->write('    ' . $copied . ' migrations has been copied to app' . PHP_EOL);
                 } else {
                     $this->io->write('    no migrations available' . PHP_EOL);
                 }
             }
             break;
             // case 'projek-ci-module':
             //     If the module has migrations, copy them into the application migrations directory
             //     $moduleMigrations = $this->getModuleMigrations($downloadPath, 'asset/data');
             //     $confirm = true;
             //     if ($this->io->isInteractive()) {
             //         $question = 'Do you want to install migration files for ' . $target->getPrettyName();
             //         $confirm = $this->io->askConfirmation($question);
             //     }
             //     if (count($moduleMigrations) > 0 && $confirm) {
             //         $config = $this->getMigrationConfig($downloadPath);
             //         $this->copyModuleMigrations($config, $moduleMigrations);
             //         $this->io->write('<info>Installed</info>');
             //     }
             //     break;
     }
 }
예제 #30
0
 /**
  * {@inheritDoc}
  */
 public function getInstallPath(PackageInterface $package)
 {
     $type = $package->getType();
     if (!isset($this->package_install_paths[$type])) {
         throw new \InvalidArgumentException("Package type '{$type}' is not supported at this time.");
     }
     $prettyName = $package->getPrettyName();
     if (strpos($prettyName, '/') !== false) {
         list($vendor, $name) = explode('/', $prettyName);
     } else {
         $vendor = '';
         $name = $prettyName;
     }
     $extra = $this->composer->getPackage() ? $this->composer->getPackage()->getExtra() : array();
     $appdir = !empty($extra['pff2-application-dir']) ? $extra['pff2-application-dir'] : 'app';
     $vars = array('{name}' => $name, '{vendor}' => $vendor, '{type}' => $type, '{application}' => $appdir);
     return str_replace(array_keys($vars), array_values($vars), $this->package_install_paths[$type]);
 }