Exemplo n.º 1
0
        /// <summary>
        /// Finds all slices requested on the cmd line and 
        /// build the layers into a list 
        /// </summary>
        /// <returns></returns>
        protected virtual LayerList BuildLayers()
        {
            var layerParams = Args.GetLayerParams();
            var osParam = Args.GetOsParam();

            var layerInfos = layerParams.Select(layerParam => new SemVerInfo(layerParam)).ToList();
            var osInfo = new SemVerInfo(osParam);

            var dirList = new SliceDirectoryList(Args.SlicesDir, Args.VersionInfo.FileMajorPart);
            var sliceList = dirList.Scan(osInfo);
            sliceList.CheckDepInfos();

            var layerList = new LayerList(sliceList, layerInfos, osInfo);
            return layerList;
        }
Exemplo n.º 2
0
        //[Fact]todo:do
        public void ScansByVersionMajor()
        {
            var root = Path.Combine(Path.GetTempPath(), new DateTime().ToString("yyyyMMddhhmmss"));
            var paths = new List<string[]>
            {
                new[] {"slices-0", "a", "aaa-1"},
                new[] {"slices-1", "a", "aaa-1"},
                new[] {"slices-1", "b", "bbb-1"},
                new[] {"slices-2", "b", "bbb-1"}
            };

            foreach (var path in paths)
            {
                var f = Path.Combine(root, string.Join(Path.DirectorySeparatorChar.ToString(), path));
                Directory.CreateDirectory(Path.GetDirectoryName(f));
                File.WriteAllText(f, "OS" + Environment.NewLine + "test");
            }

            var sdl = new SliceDirectoryList(root, 1);
            var sliceList = sdl.Scan(new SemVerInfo("test"));

            Assert.Equal(sliceList.Count, 2);
            Directory.Delete(root, true);
        }