Exemplo n.º 1
0
        public ActionResult Deploy(string versionNumber)
        {
            var settings = DocumentSession.GetSettings();

            if (string.IsNullOrEmpty(settings.DeploymentWorkingDirectory))
            {
                TempData["Message"] = "Please specify deployment working directory";
                return(RedirectToAction("Edit", "Settings"));
            }

            var deployScriptKey = versionNumber.MakeCustomDocumentKey("deploy.ps1");
            var deployScript    = DocumentSession.Advanced.DatabaseCommands.GetAttachment(deployScriptKey);

            using (var fileStream = System.IO.File.Create(Path.Combine(settings.DeploymentWorkingDirectory, deployScriptKey)))
            {
                deployScript.Data().CopyTo(fileStream);
            }

            var uniqueId  = Guid.NewGuid().ToString();
            var listenUrl = string.Format("http://{0}:12345/{1}", Environment.MachineName, uniqueId);
            var startInfo = new ProcessStartInfo(Path.Combine(settings.DeploymentWorkingDirectory, "PowerShellHtmlConsole.exe"),
                                                 string.Format(@"--listen={0} --script=.\{1}", listenUrl, deployScriptKey));

            startInfo.WorkingDirectory = settings.DeploymentWorkingDirectory;
            Process.Start(startInfo);
            Thread.Sleep(5000);
            return(Redirect(listenUrl + "/console.htm"));
        }
Exemplo n.º 2
0
        public ActionResult Index(int?page)
        {
            var settings = DocumentSession.GetSettings();

            decimal totalCount = DocumentSession
                                 .Query <ReleaseCandidate>()
                                 .Count();

            var query = DocumentSession
                        .Query <ReleaseCandidate>()
                        .OrderByDescending(x => x.CreationDate);

            var environments = DocumentSession
                               .Query <DeploymentEnvironment>()
                               .ToList();

            var allCandidates = page.HasValue && page.Value > 0
                                    ? GetPagedResult(page.Value, settings.PageSize, query)
                                    : query.Take(settings.PageSize).ToList();

            var currentPage = page ?? 1;
            var pageCount   = (int)Math.Ceiling(totalCount / (decimal)settings.PageSize);

            return(View(new ReleaseCandidateListViewModel
            {
                Items = allCandidates,
                Page = currentPage,
                Environments = environments,
                First = currentPage == 1,
                Last = currentPage == pageCount
            }));
        }
Exemplo n.º 3
0
        public ActionResult Edit(int pageSize, string deploymentWorkingDirectory)
        {
            var settings = DocumentSession.GetSettings();

            settings.PageSize = pageSize;
            settings.DeploymentWorkingDirectory = deploymentWorkingDirectory;

            return(RedirectToAction("Index", "ReleaseCandidate"));
        }
Exemplo n.º 4
0
        public ActionResult Edit()
        {
            var settings = DocumentSession.GetSettings();

            return(View(settings));
        }