// TODO: This is an overly simplified manager. It should handle rollbacks and provide logging information about the actions.

        /// <summary>
        /// Executes a deployment action.
        /// </summary>
        /// <remarks>
        /// If <paramref name="actionType"/> is <see cref="DeploymentActionType.CopyFile"/> then two parameters are expected: the path to the source file to be copied as the first parameter and the path where to copy that file to as the second parameter.<br/>
        /// If <paramref name="actionType"/> is <see cref="DeploymentActionType.ExecuteFile"/> then at least two parameters are expected but up to five can be provided, in this order:<br/>
        /// 1- File to be executed<br/>
        /// 2- Arguments to be passed in to the execution of the file<br/>
        /// 3- Normal or Elevated, indicating if execution should be done without or with elevated rights<br/>
        /// 4- The user name of the user with which to execute the file<br/>
        /// 5- The password of the user with which to execute the file.
        /// </remarks>
        /// <param name="actionType">The type of the action.</param>
        /// <param name="actionParameters">The action parameters.</param>
        /// <returns>
        ///   <c>true</c> if action was executed successfully; <c>false</c> otherwise.
        /// </returns>
        public bool ExecuteDeploymentAction(DeploymentActionType actionType, params string[] actionParameters)
        {
            bool result = true;

            switch (actionType)
            {
            case DeploymentActionType.CheckUnitTests:
                result = CheckUnitTests(actionParameters);
                break;

            case DeploymentActionType.CopyFile:
                result = CopyFile(actionParameters);
                break;

            case DeploymentActionType.ExecuteFile:
                result = ExecuteFile(_processWaitMilliseconds, actionParameters);
                break;

            case DeploymentActionType.RunDatabaseScript:
                result = RunDatabaseScript(actionParameters);
                break;

            case DeploymentActionType.SendEmail:
                result = SendEmail(actionParameters);
                break;
            }

            return(result);
        }
Пример #2
0
 /// <summary>
 /// Initialises a new instance of the <see cref="DeploymentActionEntity"/> class.
 /// </summary>
 /// <param name="actionType">Type of the action.</param>
 /// <param name="actionParameters">The action parameters.</param>
 public DeploymentActionEntity(DeploymentActionType actionType, params string[] actionParameters)
 {
     _actionType       = actionType;
     _actionParameters = new Collection <string>(actionParameters);
 }
Пример #3
0
 /// <summary>
 /// Initialises a new instance of the <see cref="DeploymentActionEntity"/> class.
 /// </summary>
 /// <param name="actionType">Type of the action.</param>
 /// <param name="actionParameters">The action parameters.</param>
 public DeploymentActionEntity(DeploymentActionType actionType, Collection <string> actionParameters)
 {
     _actionType       = actionType;
     _actionParameters = actionParameters;
 }