Esempio n. 1
0
 /**
  * Handles the "puli plugin --remove" command.
  *
  * @param Args $args The console arguments
  *
  * @return int The status code
  */
 public function handleDelete(Args $args)
 {
     $pluginClass = $args->getArgument('class');
     if (!$this->manager->hasPluginClass($pluginClass)) {
         throw new RuntimeException(sprintf('The plugin class "%s" is not installed.', $pluginClass));
     }
     $this->manager->removePluginClass($pluginClass);
     return 0;
 }
Esempio n. 2
0
 /**
  * Handles the "upgrade" command.
  *
  * @param Args $args The console arguments
  * @param IO   $io   The I/O
  *
  * @return int The status code
  */
 public function handle(Args $args, IO $io)
 {
     $moduleFile = $this->moduleFileManager->getModuleFile();
     $originVersion = $moduleFile->getVersion();
     $targetVersion = $args->getArgument('version');
     if (version_compare($originVersion, $targetVersion, '=')) {
         $io->writeLine(sprintf('Your puli.json is already at version %s.', $targetVersion));
         return 0;
     }
     $this->moduleFileManager->migrate($targetVersion);
     $io->writeLine(sprintf('Migrated your puli.json from version %s to version %s.', $originVersion, $targetVersion));
     return 0;
 }
 private function persistServersData()
 {
     if ($this->serversData) {
         $this->rootModuleFileManager->setExtraKey(self::SERVERS_KEY, (object) $this->serversData);
     } else {
         $this->rootModuleFileManager->removeExtraKey(self::SERVERS_KEY);
     }
 }
 private function persistInstallersData()
 {
     $data = array();
     foreach ($this->rootInstallerDescriptors as $installerName => $installer) {
         $data[$installerName] = $this->installerToData($installer);
     }
     if ($data) {
         $this->rootModuleFileManager->setExtraKey(self::INSTALLERS_KEY, (object) $data);
     } else {
         $this->rootModuleFileManager->removeExtraKey(self::INSTALLERS_KEY);
     }
 }
Esempio n. 5
0
 /**
  * Handles the "config -r <key>" command.
  *
  * @param Args $args The console arguments
  *
  * @return int The status code
  */
 public function handleReset(Args $args)
 {
     $this->manager->removeConfigKey($args->getArgument('key'));
     return 0;
 }