예제 #1
0
파일: Layer.cs 프로젝트: waybuild/wb
        public void FindDependenciesRecursive(LayerList registryLayers)
        {
            foreach (var section in _slice.Sections.Where(s => s.SectionType == SliceSection.Type.DEP))
            {
                foreach (var line in section.Lines)
                {
                    var semName = new SemName(line);
                    var dep = registryLayers.FindLayer(semName.NamePart);
                    if (dep != null)
                    {
                        Dependencies.Add(dep);
                        dep.FindDependenciesRecursive(registryLayers);
                    }
                }
            }

            if (Dependencies.Count == 0)
            {
                foreach (var section in _slice.Sections.Where(s => s.SectionType == SliceSection.Type.OS))
                {
                    foreach (var line in section.Lines)
                    {
                        var semName = new SemName(line);
                        if (semName.NamePart != Name)
                        {
                            var os = registryLayers.FindLayer(semName.NamePart);
                            if (os != null)
                            {
                                Dependencies.Add(os);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
파일: Slice.cs 프로젝트: waybuild/wb
        public Slice(SemName semName, IList<string> lines)
        {
            SemName = semName;
            SemVersion = new SemVersion(semName.VersionPart, semName.PreReleasePart);
            Sections = new List<SliceSection>();
            OsList = new List<string>();

            int lineStart = 0;
            SliceSection section;
            while ((section = SliceSection.Parse(lines, lineStart)) != null)
            {
                lineStart = section.EndLine > lineStart ? section.EndLine : lineStart + 1;
                Sections.Add(section);
            }

            foreach (var s in Sections.Where(s => s.SectionType == SliceSection.Type.OS))
            {
                foreach (var line in s.Lines.Where(l => !l.StartsWith("#")))
                {
                    OsList.Add(new SemName(line.Trim()).NamePart.ToLower());
                }
            }
        }
예제 #3
0
        private static void ScanFiles(string dir, IList<Slice> list, string osName)
        {
            foreach (var path in Directory.EnumerateFiles(dir))
            {
                var fileName = Path.GetFileName(path);
                if (fileName == null || fileName.StartsWith("."))
                    continue;

                var ext = Path.GetExtension(path);
                if (ext == ".md" || ext == ".txt")
                    continue;

                var fi = new FileInfo(path);
                var nameParts = fi.Name.Split("_"); // handles names like debian-8.2_jekyll-3.0 and possibly with more underscores
                fileName = nameParts.Length == 1 ? nameParts[0] : nameParts[nameParts.Length - 1];
                var semName = new SemName(fileName);

                var lines = File.ReadAllLines(path);
                var slice = new Slice(semName, lines);

                if (slice.OsList.Contains(osName))
                    list.Add(slice);
            }
        }
예제 #4
0
파일: Fetch.cs 프로젝트: waybuild/wb
 private string FetchLatestBranchName()
 {
     var list = new List<SemVersion>();
     var branches = FetchBranches();
     foreach (var branch in branches.Where(b => b != "master"))
     {
         var semName = new SemName(branch);
         list.Add(new SemVersion(semName.VersionPart, semName.PreReleasePart));
     }
     list.Sort((x, y) => y.CompareTo(x));
     return list[0].ToString();
 }