Esempio n. 1
0
        /// <summary>
        /// Handles the Deploy button.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnDeploy(object sender, EventArgs e)
        {
            var commit = new OnCommitArgs()
            {
                Hash    = this.GetLatestCommitHash(),
                Message = "Re-deploy"
            };

            NotificationWriter.Clear();
            this.Deploy(commit);
        }
Esempio n. 2
0
        /// <summary>
        /// Deploys dev websites on a successful commit
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="commit">
        /// The commit.
        /// </param>
        private void DeploySuccessfulCommit(object sender, OnCommitArgs commit)
        {
            if (commit.Success)
            {
                commit.Hash = this.GetLatestCommitHash();
                NotificationWriter.Clear();
                NotificationWriter.Write("Commit " + commit.Hash + " successful");
                this.Deploy(commit);
            }

            // Unsubscribe from successful commit event
            BlinkboxSccHooks.OnCommit -= this.DeploySuccessfulCommit;
        }
        /// <summary>
        /// Runs a command in the git tfs commandline environment.
        /// </summary>
        /// <param name="command">
        /// The command.
        /// </param>
        /// <param name="workingDirectory">
        /// The working directory.
        /// </param>
        public static void RunGitTfsCommand(string command, string workingDirectory)
        {
            var process = new System.Diagnostics.Process();

            process.StartInfo = new ProcessStartInfo("cmd.exe", "/k git tfs " + command);
            process.StartInfo.UseShellExecute  = false;
            process.StartInfo.CreateNoWindow   = true;
            process.StartInfo.WorkingDirectory = workingDirectory;
            process.StartInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Hidden;

            // Write output to the pending changes window
            NotificationWriter.Clear();
            NotificationWriter.NewSection("Git-Tfs " + command);
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.OutputDataReceived += (sender, args) => NotificationWriter.Write(args.Data);
            process.ErrorDataReceived  += (sender, args) => NotificationWriter.Write(args.Data);

            process.Start();
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();
        }