From a59c7c4a8d13b35bb9b103c6caf7c428f139e88b Mon Sep 17 00:00:00 2001 From: Netkas Date: Fri, 16 Dec 2022 01:48:16 -0500 Subject: [PATCH] Added Credential passthrough --- src/ncc/CLI/PackageManagerMenu.php | 4 ++-- src/ncc/Managers/PackageManager.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ncc/CLI/PackageManagerMenu.php b/src/ncc/CLI/PackageManagerMenu.php index 612d733..e6aa13d 100644 --- a/src/ncc/CLI/PackageManagerMenu.php +++ b/src/ncc/CLI/PackageManagerMenu.php @@ -246,7 +246,7 @@ { try { - $path = $package_manager->fetchFromSource($parsed_source->toString()); + $path = $package_manager->fetchFromSource($parsed_source->toString(), $credential); } catch (Exception $e) { @@ -364,7 +364,7 @@ { try { - $package_manager->install($path); + $package_manager->install($path, $credential); Console::out(sprintf('Package %s installed successfully', $package->Assembly->Package)); } catch(Exception $e) diff --git a/src/ncc/Managers/PackageManager.php b/src/ncc/Managers/PackageManager.php index 143c036..a62d311 100644 --- a/src/ncc/Managers/PackageManager.php +++ b/src/ncc/Managers/PackageManager.php @@ -95,7 +95,7 @@ * @throws UnsupportedRunnerException * @throws VersionNotFoundException */ - public function install(string $package_path): string + public function install(string $package_path, ?Entry $entry=null): string { if(Resolver::resolveScope() !== Scopes::System) throw new AccessDeniedException('Insufficient permission to install packages'); @@ -127,7 +127,7 @@ { foreach($package->Dependencies as $dependency) { - $this->processDependency($dependency, $package, $package_path); + $this->processDependency($dependency, $package, $package_path, $entry); } } @@ -412,12 +412,12 @@ * @return string * @throws InstallationException */ - public function installFromSource(string $source): string + public function installFromSource(string $source, ?Entry $entry): string { try { - $package = $this->fetchFromSource($source); - return $this->install($package); + $package = $this->fetchFromSource($source, $entry); + return $this->install($package, $entry); } catch(Exception $e) { @@ -444,7 +444,7 @@ * @throws UnsupportedRunnerException * @throws VersionNotFoundException */ - private function processDependency(Dependency $dependency, Package $package, string $package_path): void + private function processDependency(Dependency $dependency, Package $package, string $package_path, ?Entry $entry=null): void { Console::outVerbose('processing dependency ' . $dependency->Name . ' (' . $dependency->Version . ')'); $dependent_package = $this->getPackage($dependency->Name); @@ -481,7 +481,7 @@ case DependencySourceType::RemoteSource: Console::outDebug('installing from remote source ' . $dependency->Source); - $this->installFromSource($dependency->Source); + $this->installFromSource($dependency->Source, $entry); break; default: