public int Execute(Options options) { var calculator = new VersionCalculator(); var finder = new GitFolderFinder(); var version = calculator.CalculateVersion(options); if (version == null) { return(1); } if (version.IsDirty) { Console.WriteLine("Cannot apply tag with uncommitted changes"); return(1); } var gitFolder = finder.FindGitFolder(options.Path); using (var repo = new Repository(gitFolder)) { repo.ApplyTag(version.SemVer); } Console.WriteLine($"Created Tag: {version.SemVer}"); return(0); }
public int Execute(Options options) { var finder = new GitFolderFinder(); var gitFolder = finder.FindGitFolder(options.Path); if (gitFolder == null) { Console.WriteLine("not a git repository"); return(1); } var config = Configuration.Load(gitFolder, _create); if (config == null) { Console.WriteLine("No repo-version.json file. Please run repo-version init"); return(1); } TransformConfiguration(options, config); var json = JsonConvert.SerializeObject(config, Formatting.Indented); var path = Path.Combine(gitFolder, "repo-version.json"); File.WriteAllText(path, json); OnSuccess(config, path); return(0); }