예제 #1
0
        /// <summary>
        /// Overide of the Prepare creates the correct
        /// directories and files for the config
        /// </summary>
        protected override void Prepare()
        {
            DirectoryNode circleDir  = Root.Add <DirectoryNode>(".circleci");
            FileNode      circleFile = circleDir.Add <FileNode>("config.yml");

            circleFile.AddTemplate("circleci.yml");

            Root.Add <DirectoryNode>(".github");

            DirectoryNode devDir = Root.Add <DirectoryNode>("dev");

            devDir.Add <DirectoryNode>("tests");


            FileNode composeFile = devDir.Add <FileNode>("docker-compose.yaml");

            composeFile.AddTemplate("application.yml");

            DirectoryNode opsDir = Root.Add <DirectoryNode>("ops");

            opsDir.Add <DirectoryNode>("deploy");
            opsDir.Add <DirectoryNode>("provision");
            opsDir.Add <DirectoryNode>("tests");

            Root.Add <DirectoryNode>("tests");
        }
예제 #2
0
        public void Add(IContentProvider provider)
        {
            var separator = new[] { '\\', '/' };

            foreach (AssetEntry current in provider.GetAssets())
            {
                string[]      array     = current.FullName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                DirectoryNode directory = root;
                for (int i = 0; i < array.Length - 1; i++)
                {
                    if (!directory.HasDirectory(array[i]))
                    {
                        directory.Add(array[i]);
                    }
                    directory = directory.GetDirectory(array[i]);
                }
                if (directory.Files.ContainsKey(current.Name))
                {
                    directory.Files[current.Name] = current;
                }
                else
                {
                    directory.Files.Add(current.Name, current);
                }
            }
        }
예제 #3
0
        public async Task <Scanned> GetEntriesAsync([NotNull] List <IFileInfo> list, string baseId, string baseName,
                                                    [CanBeNull] IProgress <AsyncProgressEntry> progress, CancellationToken cancellation)
        {
            progress?.Report(AsyncProgressEntry.FromStringIndetermitate("Scanning…"));

            var       result         = new List <ContentEntryBase>();
            var       missingContent = false;
            Exception readException  = null;

            var s    = Stopwatch.StartNew();
            var root = new DirectoryNode(_installationParams.FallbackId ?? baseId, null);

            root.ForceName(baseName);

            foreach (var info in list)
            {
                root.Add(info);
            }

            Logging.Debug($"Building tree: {s.Elapsed.TotalMilliseconds:F1} ms");

            s.Restart();
            var queue = new Queue <DirectoryNode>();

            queue.Enqueue(root);

            while (queue.Count > 0)
            {
                var directory = queue.Dequeue();

                ContentEntryBase found;
                try {
                    found = await CheckDirectoryNode(directory, cancellation).ConfigureAwait(false); // WHY IT DOES NOT WORK?

                    if (cancellation.IsCancellationRequested)
                    {
                        break;
                    }
                } catch (Exception e) when(e.IsCancelled())
                {
                    break;
                } catch (MissingContentException) {
                    missingContent = true;
                    continue;
                } catch (Exception e) {
                    Logging.Warning(e);
                    readException = e;
                    continue;
                }

                if (found != null)
                {
                    result.Add(found);
                }
                else
                {
                    foreach (var value in directory.Directories)
                    {
                        queue.Enqueue(value);
                    }

                    foreach (var value in directory.Files)
                    {
                        try {
                            found = await CheckFileNode(value, cancellation).ConfigureAwait(false);

                            if (cancellation.IsCancellationRequested)
                            {
                                break;
                            }
                        } catch (Exception e) when(e.IsCancelled())
                        {
                            break;
                        } catch (MissingContentException) {
                            missingContent = true;
                            continue;
                        } catch (Exception e) {
                            Logging.Warning(e);
                            readException = e;
                            continue;
                        }

                        if (found != null)
                        {
                            result.Add(found);
                        }
                    }
                }
            }

            Logging.Debug($"Scanning directories: {s.Elapsed.TotalMilliseconds:F1} ms");
            return(new Scanned(result, missingContent, readException));
        }
예제 #4
0
        /// <summary>
        /// Overide of the Prepare creates the correct
        /// directories and files for the config
        /// </summary>
        protected override void Prepare()
        {
            DirectoryNode fastDir = Root.Add <DirectoryNode>(".fast");

            fastDir.Add <FileNode>("config.yml");
        }