Ejemplo n.º 1
0
    private static bool ProcessModule(string name, Module info)
    {
        var modulePath  = $"../../../../Atom/{info.Category}/{name}";
        var moduleFiles = Directory.GetFiles(modulePath);

        var codeFiles   = moduleFiles.Where(f => Path.GetExtension(f) == ".cs").OrderBy(f => f).ToList();
        var hashBuilder = new HashBuilder();

        foreach (var file in codeFiles)
        {
            hashBuilder.Add(Path.GetFileName(file));
            hashBuilder.Add(File.ReadAllText(file));
        }
        var sourceHash = hashBuilder.GetHash();

        // normalize tags, if needed
        info.Tags = info.Tags.AsCommaList().ToCommaList();

        // sort dependencies, if needed
        if (info.DependsOn != null)
        {
            info.DependsOn = info.DependsOn.OrderBy(i => i).ToArray();
        }

        // if source files have changed then increase build number
        var updated = false;

        if (sourceHash != info.SourceHash)
        {
            var ver = new Version(info.Version);
            var upd = new Version(ver.Major, ver.Minor, ver.Build + 1);

            info.Version      = upd.ToString();
            info.SourceHash   = sourceHash;
            info.ReleaseNotes = "???";
            updated           = true;
        }

        var nuspecFile = Path.Combine(modulePath, $"Atom.{name}.nuspec");
        var nuspecXml  = CreateNuspecXml(name, info, codeFiles);

        File.WriteAllText(nuspecFile, nuspecXml);

        return(updated);
    }
Ejemplo n.º 2
0
        public void AddTest1()
        {
            HashBuilder target = new HashBuilder();

            target.Add <int>(2);
            target.Add <int>(1);
            target.Add <int>(4);
            target.Add <int>(3);

            int         result1 = target.Result;
            HashBuilder target2 = new HashBuilder();

            target2.Add <int>(2);
            target2.Add <int>(1);
            target2.Add <int>(4);
            target2.Add <int>(3);

            Assert.IsTrue(target.Result == target2.Result);
        }