示例#1
0
        public string LatestInSlice(Dictionary <string, Manifest> indexSlice)
        {
            List <string> realVersions = indexSlice.Keys.ToList();

            realVersions.RemoveAll(v => v == "_");
            return(Manifest.SortVersions(realVersions).LastOrDefault());
        }
示例#2
0
        private void FindManifests(string directory, FindManifestsCallback action)
        {
            if (!Directory.Exists(directory))
            {
                throw new ArgumentException(string.Format("Illegal path to cartridge repository: {0}", directory));
            }

            foreach (string path in Directory.GetDirectories(directory))
            {
                List <string> entries = Directory.GetDirectories(path).Select(v => new DirectoryInfo(v).Name).ToList <string>();
                if (entries.Count == 0)
                {
                    continue;
                }

                foreach (string version in Manifest.SortVersions(entries))
                {
                    string filename = Path.Combine(path, version, "metadata", "manifest.yml");
                    if (File.Exists(filename))
                    {
                        action(filename);
                    }
                }
            }
        }
        public Manifest Insert(Manifest cartridge)
        {
            string name             = cartridge.Name;
            string cartridgeVersion = cartridge.CartridgeVersion;

            foreach (string version in Manifest.SortVersions(cartridge.Versions))
            {
                Manifest projectedCartridge = cartridge.ProjectVersionOverrides(version, path);
                Index[name]          = new Dictionary <string, Dictionary <string, Manifest> >();
                Index[name][version] = new Dictionary <string, Manifest>();
                Index[name][version][cartridgeVersion] = projectedCartridge;
                Index[name][version]["_"] = projectedCartridge;
            }

            return(cartridge);
        }