public function removePackage(Package $package) { // Ensure paths are loaded $this->getPaths(); $path = $package->getPath(); if (($key = array_search($path, $this->paths)) !== false) { unset($this->paths[$key]); $this->dump(); } }
public function serializePaths(array $paths) { $globbedPaths = array_map(function ($path) { return glob($path, GLOB_MARK | GLOB_ONLYDIR); }, $paths); $allPaths = array_reduce($globbedPaths, function ($collect, $pathOrPaths) { if (is_array($pathOrPaths)) { return array_merge($collect, $pathOrPaths); } else { $collect[] = $pathOrPaths; return $collect; } }, []); $allPaths = array_filter($allPaths, function ($path) { return is_dir($path) && file_exists("{$path}/composer.json"); }); $packages = array_map(function ($path) { return Package::fromFolder(rtrim($path, '/')); }, $allPaths); $packagePaths = array_reduce($packages, function ($collect, Package $package) { $collect[$package->getComposerId()] = $package->getPath(); return $collect; }, []); return ['packages' => $packagePaths]; }
protected function execute(InputInterface $input, OutputInterface $output) { $package = Package::fromFolder($input->getArgument('path')); $this->config->addPackage($package); $output->writeln("<info>Package loaded successfully.</info>"); $output->writeln("<comment>Dumping autoloads...</comment>"); Shell::run('composer dump-autoload'); $output->writeln("<info>Autoloads successfully generated.</info>"); }
protected function fire() { $package = Package::fromFolder($this->input->getArgument('path')); $this->config->addPackage($package); $this->output->note('Package loaded successfully.'); $this->output->note('Dumping autoloads...'); Shell::run('composer dump-autoload'); $this->output->success('Autoloads successfully generated.'); }
protected function fire() { $path = $this->input->getArgument('path'); if ($this->abortDeletion($path)) { $this->output->note('Aborted.'); return; } $package = Package::fromFolder($path); $this->config->removePackage($package); $this->output->note('Removing package...'); $filesystem = new Filesystem(); $filesystem->remove($path); $this->output->success('Package successfully removed.'); }
protected function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('path'); if ($this->abortDeletion($path, $output)) { $output->writeln("<comment>Aborted.</comment>"); return; } $package = Package::fromFolder($path); $this->config->removePackage($package); $output->writeln("<comment>Removing package...</comment>"); $filesystem = new Filesystem(new Local(getcwd())); $filesystem->deleteDir($path); $output->writeln("<info>Package successfully removed.</info>"); $output->writeln("<comment>Dumping autoloads...</comment>"); Shell::run('composer dump-autoload'); $output->writeln("<info>Autoloads successfully generated.</info>"); }
/** * @param OutputInterface $output * @param Package $package * @return void */ protected function refreshAutoloads(OutputInterface $output, Package $package) { if (file_exists(getcwd() . '/' . $package->getPath() . '/composer.json')) { $output->writeln("<comment>Dumping autoloads...</comment>"); Shell::run('composer dump-autoload', $package->getPath()); $output->writeln("<info>Autoloads successfully generated.</info>"); } }
protected function fire() { $package = Package::fromFolder($this->input->getArgument('path')); $this->config->addPackage($package); $this->output->success('Package loaded successfully.'); }
/** * Create the new package. * * @return \Studio\Package */ public function create() { $this->installParts(); return Package::fromFolder($this->path); }
/** * Create the new package. * * @return \Studio\Package */ public function create() { $this->cloneRepository(); return Package::fromFolder($this->path); }