Пример #1
0
        private void UpdateLiteralReplacer(string fl, CompleteVersion versonToWrite, DisplayType dtx)
        {
#if DEBUG
            if (!File.Exists(fl))
            {
                throw new InvalidOperationException("Must not be possible, check this before you reach this code");
            }
#endif

            Func <string, string> replacer;

            if (dtx == DisplayType.NoDisplay)
            {
                replacer = new Func <string, string>((inney) => {
                    return(inney.Replace("XXX-RELEASENAME-XXX", versonToWrite.ReleaseName));
                });
            }
            else
            {
                replacer = new Func <string, string>((inney) => {
                    return(inney.Replace("XXX-RELEASENAME-XXX", versonToWrite.ReleaseName)
                           .Replace("XXX-VERSION-XXX", versonToWrite.GetVersionString(dtx))
                           .Replace("XXX-VERSION3-XXX", versonToWrite.GetVersionString(DisplayType.ThreeDigit))
                           .Replace("XXX-VERSION2-XXX", versonToWrite.GetVersionString(DisplayType.Short)));
                });
            }


            string fileText = replacer(File.ReadAllText(fl));
            File.WriteAllText(fl, fileText);
        }
Пример #2
0
        /// <summary>
        /// Gets the version from storage, if the storage is not initialised then will return a default version.  If the underlying storage throws
        /// an error then this will be passed up to the caller.
        /// </summary>
        /// <returns>Version, or DefaultVersion where storage has not been used yet.</returns>
        public CompleteVersion GetVersion()
        {
            var loaded = ActualLoad();

            if (loaded == null)
            {
                loaded = CompleteVersion.GetDefault();
            }
            return(loaded);
        }
Пример #3
0
        public Versioning(VersionStorage jvp, bool dryRun = false)
        {
            b.Verbose.Log($"Versioning Online - DryRun {dryRun}");

            testMode = dryRun;
            repo     = jvp;
            cv       = repo.GetVersion();
            vfu      = new VersionFileUpdater(cv);

            fileUpdateMinmatchers.Add(FileUpdateType.NetAssembly, new List <string>());
            fileUpdateMinmatchers[FileUpdateType.NetAssembly].Add("**\\properties\\assemblyinfo.cs");
            fileUpdateMinmatchers[FileUpdateType.NetAssembly].Add("**\\properties\\commonassemblyinfo.cs");

            fileUpdateMinmatchers.Add(FileUpdateType.Nuspec, new List <string>());
            fileUpdateMinmatchers[FileUpdateType.Nuspec].Add("**\\*.nuspec");
        }
Пример #4
0
 public VersionFileUpdater(CompleteVersion cv, IHookVersioningChanges actions = null)
 {
     this.cv = cv;
 }
Пример #5
0
 protected abstract void ActualPersist(CompleteVersion cv);
Пример #6
0
 /// <summary>
 /// Saves the complete version to the underlying storage system.  Where the underlying storage system faults then this error will be passed
 /// up and it should be assumed that the save has not succeeded.
 /// </summary>
 /// <param name="cv">The CompleteVerison to save to the storage system.</param>
 public void Persist(CompleteVersion cv)
 {
     ActualPersist(cv);
 }
Пример #7
0
        private void LoadVersioningComponent()
        {
            var jvg = new JsonVersionPersister(PersistanceValue);

            ver = jvg.GetVersion();
        }
Пример #8
0
        protected override void ActualPersist(CompleteVersion cv)
        {
            string val = JsonConvert.SerializeObject(cv);

            File.WriteAllText(InitValue.InitialisationString, val);
        }
 protected override void ActualPersist(CompleteVersion cv)
 {
     // Name of the version to update
     // Branch Name
 }