예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        static void InitializeMonoRuntimePath()
        {
            ToolConfiguration toolConfig = ToolConfiguration.Load();

            toolConfig.RuntimeConfig.MonoRuntimePath =
                ConsoleUtils.ReadLine(
                    "Enter Mono runtime path",
                    PlatformUtils.DefaultMonoRuntimePath);

            toolConfig.Save();
        }
예제 #5
0
        void DisableLogging()
        {
            Console.WriteLine("Disabling logging.");

            ToolConfiguration toolConfig = ToolConfiguration.Load();

            toolConfig.LoggingConfig.Enabled = false;
            toolConfig.Save();

            Console.WriteLine("Logging disabled.");
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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!");
        }
예제 #11
0
        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!");
        }
예제 #12
0
        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);
        }