public async Task <IPackageCatalog> GetCatalogAsync(bool forceDownload, IProgress <string> progress) { var command = new NpmGetCatalogCommand( _npmController.FullPathToRootPackageDirectory, _npmController.CachePath, forceDownload, pathToNpm: _npmController.PathToNpm, progress: progress); await DoCommandExecute(false, command); return((command as NpmGetCatalogCommand).Catalog); }
public void CheckDatabaseCreation() { string databaseFilename = NpmGetCatalogCommand.DatabaseCacheFilename; string registryFilename = NpmGetCatalogCommand.RegistryCacheFilename; string cachePath = "CachePath"; string registryDirectory = "registry"; Uri registryUrl = new Uri(RegistryUrl); string catalogDatabaseFilename = Path.Combine(cachePath, databaseFilename); string registryDatabaseFilename = Path.Combine(cachePath, registryDirectory, registryFilename); string relativeRegistryDatabaseFilename = Path.Combine(registryDirectory, registryFilename); using (var reader = GetCatalogueReader(PackageCacheAllJsonFilename)) { var getCatalogCommand = new NpmGetCatalogCommand(string.Empty, cachePath, false, RegistryUrl); getCatalogCommand.CreateCatalogDatabaseAndInsertEntries(catalogDatabaseFilename, registryUrl, registryDirectory); new NpmGetCatalogCommand(string.Empty, cachePath, false).ParseResultsAndAddToDatabase(reader, registryDatabaseFilename, registryUrl.ToString()); } IDictionary<string, IPackage> byName; var target = GetTestPackageList(cachePath, out byName); Assert.AreEqual(102, target.Count); CheckPackage( target, byName, 93, "cordova", "Cordova command line interface tool", "Anis Kadri", "07/08/2014 17:55:34", SemverVersion.Parse("3.5.0-0.2.6"), new[] { SemverVersion.Parse("3.5.0-0.2.6"), SemverVersion.Parse("3.5.0-0.2.4") }, new[] { "cordova", "client", "cli" } ); }
private IList<IPackage> GetTestPackageList( string cachePath, out IDictionary<string, IPackage> byName) { IList<IPackage> target = new List<IPackage>(); target = new NpmGetCatalogCommand(string.Empty, cachePath, false, RegistryUrl).GetCatalogPackagesAsync(string.Empty, new Uri(RegistryUrl)).GetAwaiter().GetResult().ToList(); // Do this after because package names can be split across multiple // lines and therefore may change after the IPackage is initially created. IDictionary<string, IPackage> temp = new Dictionary<string, IPackage>(); foreach (var package in target ) { temp[package.Name] = package; } byName = temp; return target; }
public async Task<IPackageCatalog> GetCatalogAsync(bool forceDownload, IProgress<string> progress) { var command = new NpmGetCatalogCommand( _npmController.FullPathToRootPackageDirectory, _npmController.CachePath, forceDownload, pathToNpm:_npmController.PathToNpm, progress: progress); await DoCommandExecute(false, command); return (command as NpmGetCatalogCommand).Catalog; }