Exemple #1
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            InvokeInDeploymentOperationContext(() =>
            {
                List <DeployResult> deployments = DeploymentChannel.GetDeployments(MaxResults ?? DefaultMaxResults);

                if (CommitId != null)
                {
                    DeployResult deployment = deployments.FirstOrDefault(d => d.Id.Equals(CommitId));
                    if (deployment == null)
                    {
                        throw new Exception(string.Format(Resources.InvalidDeployment, CommitId));
                    }

                    if (Details)
                    {
                        SetDetails(deployment);
                    }

                    deployments.Add(deployment);
                }
                else if (Details)
                {
                    foreach (DeployResult deployResult in deployments)
                    {
                        SetDetails(deployResult);
                    }
                }

                WriteObject(deployments, true);
            });
        }
        public override void ExecuteCmdlet()
        {
            if (string.IsNullOrEmpty(Output))
            {
                Output = Path.Combine(GetCurrentPath(), DefaultOutput);
            }
            else
            {
                // Set the file extension to .zip
                Output = Path.ChangeExtension(Output, "zip");
            }

            base.ExecuteCmdlet();

            // List new deployments
            Stream websiteLogs = null;

            InvokeInDeploymentOperationContext(() => { websiteLogs = DeploymentChannel.DownloadLogs(); });

            using (Stream file = File.OpenWrite(Output))
            {
                CopyStream(websiteLogs, file);
            }

            websiteLogs.Dispose();

            if (PassThru.IsPresent)
            {
                WriteObject(true);
            }
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            if (!Force.IsPresent &&
                !ShouldProcess("", string.Format(Resources.RedeployCommit, CommitId),
                               Resources.ShouldProcessCaption))
            {
                return;
            }

            InvokeInDeploymentOperationContext(() => DeploymentChannel.Deploy(CommitId));

            // List new deployments
            InvokeInDeploymentOperationContext(() =>
            {
                List <DeployResult> deployments = DeploymentChannel.GetDeployments(GetAzureWebsiteDeploymentCommand.DefaultMaxResults);
                WriteObject(deployments, true);
            });
        }
Exemple #4
0
 internal void SetDetails(DeployResult deployResult)
 {
     InvokeInDeploymentOperationContext(() => { deployResult.Logs = DeploymentChannel.GetDeploymentLogs(deployResult.Id); });
 }