Beispiel #1
0
        /// <summary>
        /// Processes the record.
        /// </summary>
        protected override void ProcessRecord()
        {
            Manifest manifest = null; string manifestPath = null;

            InputObject?.GetManifestInfo(out manifest, out manifestPath);

            manifest = Overwrite(manifest ?? Manifest.LoadFrom(ManifestPath = ManifestPath ?? manifestPath));
            string json = Editor.UpdateManifestFile(ManifestPath, manifest);

            using (var file = new FileStream(ManifestPath, FileMode.Create, FileAccess.Write, FileShare.Read))
                using (var writer = new StreamWriter(file, Encoding.UTF8))
                {
                    writer.Write(json);
                    writer.Flush();
                }

            if (Stage)
            {
                Git.Stage(ManifestPath);
            }

            WriteObject(manifest.ToPSObject());
        }