Пример #1
0
        private async Task RunAllPackages(PackageStorage packageStorage)
        {
            Package package = null;

            while ((package = packageStorage.GetNextPackage()) != null)
            {
                try
                {
                    await package.Run(this.ioDefinition.TextWriter, this.GlobalVariables);

                    packageStorage.MarkPackageSolved(package);
                }
                catch (ShellCommandException ex)
                {
                    this.ioDefinition.TextWriter.WriteLine($"Encountered an {ex.GetType().Name} with: {ex.Message}");
                    packageStorage.MarkPackageFailed(package);

                    if (package.IsCritical)
                    {
                        this.ioDefinition.TextWriter.WriteLine("Bootstrapping won't continue as this is a critical package.");
                        return;
                    }
                }
            }
        }
Пример #2
0
        public FolderRepository(IDirectory packageBasePath, FolderRepositoryOptions options = FolderRepositoryOptions.Default)
        {
            if (packageBasePath == null)
            {
                throw new ArgumentNullException("packageBasePath");
            }
            _useSymLinks      = (options & FolderRepositoryOptions.UseSymLinks) == FolderRepositoryOptions.UseSymLinks;
            _anchoringEnabled = (options & FolderRepositoryOptions.AnchoringEnabled) == FolderRepositoryOptions.AnchoringEnabled;
            _canLock          = (options & FolderRepositoryOptions.SupportLocks) == FolderRepositoryOptions.SupportLocks;

            LockedPackages = Enumerable.Empty <IPackageInfo>().ToLookup(_ => string.Empty);

            _persistSource = (options & FolderRepositoryOptions.PersistPackageSources) == FolderRepositoryOptions.PersistPackageSources;

            BasePath = packageBasePath;


            _rootCacheDirectory = BasePath.GetOrCreateDirectory("_cache");

            _packageLoader = !_persistSource
                                 ? new PackageStorage(this, BasePath, _rootCacheDirectory)
                                 : new PackageStorageWithSource(this, BasePath, _rootCacheDirectory);
            if (_persistSource)
            {
                packageBasePath.GetFile("packages").MustExist();
            }
            RefreshPackages();
        }
Пример #3
0
        public void TestPackageStorageCount()
        {
            var storage = new PackageStorage();

            var elementsNumber = storage.Count();

            Assert.AreEqual(0, elementsNumber);
        }
Пример #4
0
        private void InitPackageStorages()
        {
            var logEntries = statusLogger.LoadOldLog(this.LogFilename);

            this.packages = new PackageStorage(logEntries, this.RawPackages);
            this.RawPackages.Clear();
            this.packages.ValidatePackages();
            this.cleanupPackages = new PackageStorage(null, RawCleanupPackages);
        }
Пример #5
0
        public void TestPackageStorageAdd()
        {
            var storage = new PackageStorage();

            storage.Add(new EddystoneTlm());

            var elementsNumber = storage.Count();

            Assert.AreEqual(1, elementsNumber);
        }