예제 #1
0
        public virtual void GenerateKeyFile(IProcessFactory processFactory, IPackageTree packageTree)
        {
            string strongKey = Path.Combine(packageTree.WorkingDirectory.FullName,
                                            string.Format("{0}.snk", packageTree.Name));

            string cmdLineArguments = string.Format("-k {0}", strongKey.QuotePath());

            var PSI = new ProcessStartInfo("cmd.exe")
            {
                RedirectStandardInput  = true,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                UseShellExecute        = false
            };

            var sn = GetSnExe(packageTree);

            IProcess process = processFactory.GetProcess(sn.ToString().QuotePath(), cmdLineArguments, packageTree.WorkingDirectory.FullName);

            while (true)
            {
                string line = process.GetLineOrOutput();

                if (line == null)
                {
                    break;
                }

                log.Info(line);
            }

            process.WaitForExit();
        }
예제 #2
0
        protected virtual void ProcessBuild(IPackageTree packageTree, IProcessFactory processFactory, string pathToBuildTool, string cmdLineArguments)
        {
            IProcess process = processFactory.GetProcess(pathToBuildTool, cmdLineArguments, packageTree.WorkingDirectory.FullName);

            while (true)
            {
                string line = process.GetLineOrOutput();

                if (line == null)
                {
                    break;
                }

                log.Info(line);
            }

            try
            {
                process.WaitForExit();
            }
            catch (ProcessFailedException)
            {
                throw new BuildFailedException(string.Format("The build tool {0} failed building the {1} package", packageTree.BuildMetaData.BuildEngine.BuildTool, packageTree.Name));
            }
        }
예제 #3
0
        public override string Update(IPackageTree packageTree, FileSystemInfo destination)
        {
            Settings.WorkingDir = destination.FullName;

            try
            {
                var processFactory = new DiagnosticsProcessFactory();

                var git = Path.Combine(Settings.GitBinDir, "git.exe");

                IProcess process = processFactory.GetProcess(git, "pull -v ", packageTree.WorkingDirectory.FullName);

                while (true)
                {
                    string line = process.GetLineOrOutput();

                    if (line == null)
                    {
                        break;
                    }

                    log.Info(line);
                }

                try
                {
                    process.WaitForExit();
                }
                catch (ProcessFailedException)
                {
                    throw new GitPullFailedException(string.Format("A git pull failed for the {0} package", packageTree.Name));
                }

                //Ensure we're on the right branch
                if (!IsBranchCheckedOut(BranchName))
                {
                    if (BranchExists(BranchName))
                    {
                        RunGitCommand(string.Format("checkout {0}", BranchName));
                    }
                    else
                    {
                        CreateAndTrackRemoteBranch(BranchName, destination);
                    }
                }

                //TODO: The following should work.  Might be the way I set up msysgit?
                //GitCommands.GitCommands.Pull("origin", "master", false);
            }
            catch (Exception ex)
            {
                HandleExceptions(ex);
            }

            return(CurrentRevisionNumber());
        }
예제 #4
0
        public string RunCommand(string command, string args, string workingDirectory)
        {
            IProcess process = processFactory.GetProcess(command, args, workingDirectory);

            return(process.GetLineOrOutput());
        }