void EnableLoging(string destinationDirectory) { Console.WriteLine("Enabling logging."); if (!string.IsNullOrEmpty((destinationDirectory))) { if (File.Exists(destinationDirectory)) { Console.Error.WriteLine("{0} is a file, not a directory!"); Environment.Exit(1); } EnsureDirectoryExists(destinationDirectory); } ToolConfiguration toolConfig = ToolConfiguration.Load(); LoggingConfiguration loggingConfig = toolConfig.LoggingConfig; loggingConfig.Enabled = true; loggingConfig.DestinationPath = destinationDirectory; toolConfig.Save(); Console.WriteLine( "Logging enabled. Logs will be saved to {0}.", loggingConfig.DestinationPath); }
void DeleteFilteredRepo(string repo) { Console.WriteLine("Deleting repository '{0}' from the filter list.", repo); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.RepoFilterConfig.DeleteFilteredRepo(repo); toolConfig.Save(); Console.WriteLine("Repository '{0}' correctly deleted!", repo); }
void AddFilteredRepo(string repo) { Console.WriteLine("Adding repository '{0}' to the filter list.", repo); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.RepoFilterConfig.AddFilteredRepo(repo); toolConfig.Save(); Console.WriteLine("Repository '{0}' correctly added!", repo); }
static void InitializeMonoRuntimePath() { ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.RuntimeConfig.MonoRuntimePath = ConsoleUtils.ReadLine( "Enter Mono runtime path", PlatformUtils.DefaultMonoRuntimePath); toolConfig.Save(); }
void DisableLogging() { Console.WriteLine("Disabling logging."); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.LoggingConfig.Enabled = false; toolConfig.Save(); Console.WriteLine("Logging disabled."); }
void DeleteServer(string server) { Console.WriteLine("Deleting server '{0}'", server); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.ServerConfig.DeleteServer(server); toolConfig.Save(); Console.WriteLine("Server '{0}' correctly deleted!", server); }
void AddServer(string server) { Console.WriteLine("Adding server '{0}'.", server); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.ServerConfig.AddServer(server); toolConfig.Save(); Console.WriteLine("Server '{0}' correctly added!", server); }
void DeleteDestinationAddress(string destinationAddress) { ToolConfiguration toolConfig = ToolConfiguration.Load(); EmailConfiguration emailConfig = toolConfig.EmailConfig; emailConfig.RemoveDestinationEmail(destinationAddress); toolConfig.Save(); Console.WriteLine( "Correctly removed '{0}' from the destination addresses.", destinationAddress); }
void AddDestinationAddress(string destinationAddress) { ToolConfiguration toolConfig = ToolConfiguration.Load(); EmailConfiguration emailConfig = toolConfig.EmailConfig; emailConfig.AddDestinationEmail(destinationAddress); toolConfig.Save(); Console.WriteLine( "Correctly added '{0}' to the destination addresses.", destinationAddress); }
void ConfigureEmailWarnings() { ToolConfiguration toolConfig = ToolConfiguration.Load(); EmailConfiguration emailConfig = toolConfig.EmailConfig; emailConfig.SmptServer = ConsoleUtils.ReadLine("SMTP server address"); emailConfig.EnableSsl = ConsoleUtils.ReadBool("Enable SSL"); emailConfig.Port = ConsoleUtils.ReadInt("Port number"); emailConfig.SourceEmail = ConsoleUtils.ReadLine("Email account"); emailConfig.Password = ConsoleUtils.ReadPassword("Password"); toolConfig.Save(); Console.WriteLine("The account was correctly configured!"); }
void DeleteRepoMap(string srcRepo, string dstRepo, string dstServer) { RepoMapping mapping = new RepoMapping(srcRepo, dstRepo, dstServer); Console.WriteLine( "Deleting repository mapping '{0}' -> '{1}@{2}'", mapping.SrcRepo, mapping.DstRepo, mapping.DstServer); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.RepoMapConfig.DeleteMappedRepo(mapping); toolConfig.Save(); Console.WriteLine("Repository mapping correctly deleted!"); }
void ICmd.Execute(string[] args) { if (args.Length == 1 || args.Length > 3) { Console.Error.WriteLine(HELP); Environment.Exit(1); } string srcServer = args[1]; if (!Utils.CheckServerSpec(srcServer)) { Console.Error.WriteLine( "The server spec is not correct: {0}", srcServer); Environment.Exit(1); } Console.WriteLine( "Installing the necessary triggers on server {1}:{0}" + "* after-checkin{0}" + "* after-replicationwrite{0}" + "* after-mklabel{0}" + "* after-chattvalue", Environment.NewLine, srcServer); string executablePath = Utils.GetAssemblyLocation(); Console.WriteLine( "Using syncservertrigger located at {0}.", executablePath); if (!PlatformUtils.IsWindows) { InitializeMonoRuntimePath(); } if (!InstallTrigger(Trigger.Types.AfterCi, Trigger.Names.AfterCi, executablePath, srcServer) || !InstallTrigger(Trigger.Types.AfterRW, Trigger.Names.AfterRW, executablePath, srcServer) || !InstallTrigger(Trigger.Types.AfterMkLb, Trigger.Names.AfterMkLb, executablePath, srcServer) || !InstallTrigger(Trigger.Types.AfterChAttVal, Trigger.Names.AfterChAttVal, executablePath, srcServer)) { Environment.Exit(1); } Console.WriteLine( "Triggers successfully installed in {0}!", srcServer); if (args.Length != 3) { return; } string dstServer = args[2]; if (!Utils.CheckServerSpec(dstServer)) { Console.Error.WriteLine( "The server spec is not correct: {0}", dstServer); Environment.Exit(1); } Console.WriteLine( "Adding '{0}' as the first destination server.", dstServer); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.ServerConfig.AddServer(dstServer); toolConfig.Save(); Console.WriteLine( "Server '{0}' correctly added!", dstServer); }