protected override int Execute() { ConsoleWriter.WriteProgressWithoutSave("self-update"); Helper.SaveLastUpdateTime(); try { InstallPowerShell(); InstallClinkScript(); InstallBashScript(); CreateRunners(); AddInstallToPath(); } catch (Exception exception) { Log.Error("Fail to install cement", exception); ConsoleWriter.WriteError("Fail to install cement: " + exception); } var server = CementSettings.Get().CementServer; Log.Info($"Cement server: {server}"); var updater = server == null ? (ICementUpdater) new CementFromGitHubUpdater(Log) : (ICementUpdater) new CementFromServerUpdater(server, branch, Log); return(UpdateBinary(updater)); }
protected override int Execute() { var cmd = CementSettings.Get().UserCommands[arguments[0]]; Log.Debug("Run command " + arguments[0] + ": '" + cmd + "'"); if (arguments.Length > 1) { arguments = arguments.Skip(1).ToArray(); cmd = string.Format(cmd, arguments); } return(Run(cmd)); }
private static void SearchAndSaveBranchInSettings(ref string branch) { var settings = CementSettings.Get(); if (branch != null) { settings.SelfUpdateTreeish = branch; } else { branch = settings.SelfUpdateTreeish; } settings.Save(); }
private static int Run(string[] args) { var commands = CommandsList.Commands; if (commands.ContainsKey(args[0])) { return(commands[args[0]].Run(args)); } if (CementSettings.Get().UserCommands.ContainsKey(args[0])) { return(new UserCommand().Run(args)); } ConsoleWriter.WriteError("Bad command: '" + args[0] + "'"); return(-1); }
public string DefineCorrectDefaultToolVersion(string toolName, string settingVersion, string defaultVersion) { var settings = new CementSettings { DefaultMsBuildVersion = settingVersion }; var input = $@"build: target: Solution.sln configuration: Release tool: name: {toolName} "; var defaults = new BuildData(null, null, new Tool(null, defaultVersion), new List <string>(), string.Empty); var parser = new BuildSectionParser(settings); var buildSections = GetBuildSections(input); var actual = parser.ParseConfiguration(buildSections, defaults); return(actual?[0].Tool.Version); }
public BuildSectionParser(CementSettings settings) { this.settings = settings; }
public BuildSectionParser() : this(CementSettings.Get()) { }