private string Restore(string name, string version, string nugetSourceUrl, string destinationNupkgDirectory) { destinationNupkgDirectory = _fileSystem.GetCurrentDirectoryIfEmpty(destinationNupkgDirectory); return(_workingDirectoriesProvider.CreateTempDirectory(tempDirectory => { string nugetRestoreProjPath = Path.Combine(tempDirectory, NugetRestoreProjName); CreateNugetRestoreProj(nugetRestoreProjPath, name, version); string result = RestorePackage(nugetRestoreProjPath, nugetSourceUrl, destinationNupkgDirectory) .Replace(nugetRestoreProjPath, $"\"{destinationNupkgDirectory}\""); return result; })); }
public void Install(string packageName, string version, string nugetSourceUrl) { _workingDirectoriesProvider.CreateTempDirectory(restoreTempDirectory => { _nugetManager.RestoreToDirectory(packageName, version, nugetSourceUrl, restoreTempDirectory, true); _workingDirectoriesProvider.CreateTempDirectory(zipTempDirectory => { var restoreTempDirectoryInfo = new DirectoryInfo(restoreTempDirectory); string packagePath = Path.Combine(zipTempDirectory, _packageArchiver.GetPackedGroupPackagesFileName(restoreTempDirectoryInfo.Name)); _packageArchiver.ZipPackages(restoreTempDirectory, packagePath, true); _packageInstaller.Install(packagePath); }); }); }
private string Restore(NugetPackageFullName nugetPackageFullName, string nugetSourceUrl, string destinationDirectory) { destinationDirectory = _fileSystem.GetCurrentDirectoryIfEmpty(destinationDirectory); return(_workingDirectoriesProvider.CreateTempDirectory(tempDirectory => { string version = nugetPackageFullName.Version == PackageVersion.LastVersion ? GetLastVersionPackage(nugetPackageFullName.Name, nugetSourceUrl) : nugetPackageFullName.Version; string nugetRestoreProjPath = Path.Combine(tempDirectory, NugetRestoreProjName); CreateNugetRestoreProj(nugetRestoreProjPath, nugetPackageFullName.Name, version); string result = RestorePackage(nugetRestoreProjPath, nugetSourceUrl, destinationDirectory) .Replace(nugetRestoreProjPath, $"\"{destinationDirectory}\""); return result; })); }
public void Install(IEnumerable <NugetPackageFullName> nugetPackageFullNames, string nugetSourceUrl) { _workingDirectoriesProvider.CreateTempDirectory(restoreTempDirectory => { foreach (NugetPackageFullName nugetPackageFullName in nugetPackageFullNames) { _nugetManager.RestoreToDirectory(nugetPackageFullName, nugetSourceUrl, restoreTempDirectory, true); } _workingDirectoriesProvider.CreateTempDirectory(zipTempDirectory => { var restoreTempDirectoryInfo = new DirectoryInfo(restoreTempDirectory); string packagePath = Path.Combine(zipTempDirectory, _packageArchiver.GetPackedGroupPackagesFileName(restoreTempDirectoryInfo.Name)); _packageArchiver.ZipPackages(restoreTempDirectory, packagePath, true); _packageInstaller.Install(packagePath); }); }); }
public void Pack(string packagePath, string packedPackagePath, bool skipPdb, bool overwrite) { CheckPackArgument(packagePath, packedPackagePath); _fileSystem.CheckOrDeleteExistsFile(packedPackagePath, overwrite); _workingDirectoriesProvider.CreateTempDirectory(tempPath => { _packageUtilities.CopyPackageElements(packagePath, tempPath, overwrite); var files = GetAllFiles(tempPath, skipPdb); _compressionUtilities.PackToGZip(files, tempPath, packedPackagePath); }); }
public void Pack(string nuspecFilePath, string destinationNupkgDirectory) { CheckArguments(nuspecFilePath, destinationNupkgDirectory); _workingDirectoriesProvider.CreateTempDirectory(tempDirectory => { string nugetPackProjPath = Path.Combine(tempDirectory, NugetPackProjName); CreateNugetPackProj(nugetPackProjPath); string packResult = PackPackage(nugetPackProjPath, nuspecFilePath, destinationNupkgDirectory); DeleteTempNetstandardDirectoryIfExists(destinationNupkgDirectory); _logger.WriteLine(packResult); }); }
public void Pack(string nuspecFilePath, string destinationNupkgFilePath) { CheckArguments(nuspecFilePath, destinationNupkgFilePath); _workingDirectoriesProvider.CreateTempDirectory(tempDirectory => { string nugetPackProjPath = Path.Combine(tempDirectory, NugetPackProjName); CreateNugetPackProj(nugetPackProjPath); string packResult = PackPackage(nugetPackProjPath, nuspecFilePath); string sourceNupkgFilePath; try { sourceNupkgFilePath = GetNupkgFilePath(nugetPackProjPath); CopyNupkgFileToDestinationDirectory(sourceNupkgFilePath, destinationNupkgFilePath); } catch (Exception) { _logger.WriteLine(packResult); throw; } packResult = ReplaceInOutputResult(packResult, nugetPackProjPath, sourceNupkgFilePath, destinationNupkgFilePath); _logger.WriteLine(packResult); }); }