Ejemplo n.º 1
0
        public static bool CheckValidFields(
            TrunkBotConfiguration botConfig,
            out string errorMessage)
        {
            errorMessage = string.Empty;

            if (string.IsNullOrEmpty(botConfig.Server))
            {
                errorMessage += BuildFieldError("server");
            }

            if (string.IsNullOrEmpty(botConfig.Repository))
            {
                errorMessage += BuildFieldError("repository");
            }

            if (string.IsNullOrEmpty(botConfig.TrunkBranch))
            {
                errorMessage += BuildFieldError("trunk branch");
            }

            if (string.IsNullOrEmpty(botConfig.UserApiKey))
            {
                errorMessage += BuildFieldError("user api key");
            }

            string propertyErrorMessage = null;

            if (!CheckValidPlasticFields(botConfig.Plastic, out propertyErrorMessage))
            {
                errorMessage += propertyErrorMessage;
            }

            propertyErrorMessage = null;
            if (!CheckValidIssueTrackerFields(botConfig.Issues, out propertyErrorMessage))
            {
                errorMessage += propertyErrorMessage;
            }

            propertyErrorMessage = null;
            if (!CheckValidContinuousIntegrationFields(botConfig.CI, out propertyErrorMessage))
            {
                errorMessage += propertyErrorMessage;
            }

            propertyErrorMessage = null;
            if (!CheckValidNotifierFields(botConfig.Notifications, out propertyErrorMessage))
            {
                errorMessage += propertyErrorMessage;
            }

            return(string.IsNullOrEmpty(errorMessage));
        }
Ejemplo n.º 2
0
        public static bool CheckConfiguration(
            TrunkBotConfiguration botConfig,
            out string errorMessage)
        {
            if (!CheckValidFields(botConfig, out errorMessage))
            {
                errorMessage = string.Format(
                    "trunkbot can't start without specifying a valid config for the following fields:\n{0}",
                    errorMessage);
                return(false);
            }

            return(true);
        }