Skip to content

Commit

Permalink
Merge pull request #290 from aws/dev
Browse files Browse the repository at this point in the history
chore: release 0.15
  • Loading branch information
96malhar authored Aug 11, 2021
2 parents 51a8a3f + 0674e75 commit 0b355e6
Show file tree
Hide file tree
Showing 26 changed files with 1,164 additions and 198 deletions.
34 changes: 27 additions & 7 deletions src/AWS.Deploy.CLI/Commands/CommandFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Collections.Generic;
using Amazon;
using AWS.Deploy.CLI.Commands.TypeHints;
using AWS.Deploy.CLI.Utilities;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class CommandFactory : ICommandFactory
private static readonly Option<bool> _optionDisableInteractive = new(new []{"-s", "--silent" }, "Disable interactivity to deploy without any prompts for user input.");
private static readonly Option<string> _optionOutputDirectory = new(new[]{"-o", "--output"}, "Directory path in which the CDK deployment project will be saved.");
private static readonly Option<string> _optionProjectDisplayName = new(new[] { "--project-display-name" }, "The name of the deployment project that will be displayed in the list of available deployment options.");
private static readonly Option<string> _optionDeploymentProject = new(new[] { "--deployment-project" }, "The absolute or relative path of the CDK project that will be used for deployment");

private readonly IToolInteractiveService _toolInteractiveService;
private readonly IOrchestratorInteractiveService _orchestratorInteractiveService;
Expand All @@ -56,6 +58,7 @@ public class CommandFactory : ICommandFactory
private readonly IDisplayedResourcesHandler _displayedResourceHandler;
private readonly IConsoleUtilities _consoleUtilities;
private readonly IDeploymentManifestEngine _deploymentManifestEngine;
private readonly ICustomRecipeLocator _customRecipeLocator;

public CommandFactory(
IToolInteractiveService toolInteractiveService,
Expand All @@ -75,7 +78,8 @@ public CommandFactory(
ITypeHintCommandFactory typeHintCommandFactory,
IDisplayedResourcesHandler displayedResourceHandler,
IConsoleUtilities consoleUtilities,
IDeploymentManifestEngine deploymentManifestEngine)
IDeploymentManifestEngine deploymentManifestEngine,
ICustomRecipeLocator customRecipeLocator)
{
_toolInteractiveService = toolInteractiveService;
_orchestratorInteractiveService = orchestratorInteractiveService;
Expand All @@ -95,6 +99,7 @@ public CommandFactory(
_displayedResourceHandler = displayedResourceHandler;
_consoleUtilities = consoleUtilities;
_deploymentManifestEngine = deploymentManifestEngine;
_customRecipeLocator = customRecipeLocator;
}

public Command BuildRootCommand()
Expand Down Expand Up @@ -127,7 +132,8 @@ private Command BuildDeployCommand()
_optionStackName,
_optionApply,
_optionDiagnosticLogging,
_optionDisableInteractive
_optionDisableInteractive,
_optionDeploymentProject
};

deployCommand.Handler = CommandHandler.Create(async (DeployCommandHandlerInput input) =>
Expand All @@ -150,7 +156,7 @@ private Command BuildDeployCommand()
var systemCapabilities = _systemCapabilityEvaluator.Evaluate();

var projectDefinition = await _projectParserUtility.Parse(input.ProjectPath ?? "");

var callerIdentity = await _awsResourceQueryer.GetCallerIdentity();

var session = new OrchestratorSession(
Expand Down Expand Up @@ -179,9 +185,17 @@ private Command BuildDeployCommand()
_displayedResourceHandler,
_cloudApplicationNameGenerator,
_consoleUtilities,
_customRecipeLocator,
session);

await deploy.ExecuteAsync(input.StackName ?? "", userDeploymentSettings);
var deploymentProjectPath = input.DeploymentProject ?? string.Empty;
if (!string.IsNullOrEmpty(deploymentProjectPath))
{
var targetApplicationDirectoryPath = new DirectoryInfo(projectDefinition.ProjectPath).Parent!.FullName;
deploymentProjectPath = Path.GetFullPath(deploymentProjectPath, targetApplicationDirectoryPath);
}

await deploy.ExecuteAsync(input.StackName ?? "", deploymentProjectPath, userDeploymentSettings);

return CommandReturnCodes.SUCCESS;
}
Expand Down Expand Up @@ -346,12 +360,18 @@ private Command BuildDeploymentProjectCommand()
_toolInteractiveService.Diagnostics = input.Diagnostics;
var projectDefinition = await _projectParserUtility.Parse(input.ProjectPath ?? "");

var saveDirectory = input.Output ?? "";
var projectDisplayName = input.ProjectDisplayName ?? "";
var saveDirectory = input.Output;
var projectDisplayName = input.ProjectDisplayName;

OrchestratorSession session = new OrchestratorSession(projectDefinition);

var targetApplicationFullPath = new DirectoryManager().GetDirectoryInfo(projectDefinition.ProjectPath).FullName;
var targetApplicationFullPath = new DirectoryInfo(projectDefinition.ProjectPath).FullName;

if (!string.IsNullOrEmpty(saveDirectory))
{
var targetApplicationDirectoryFullPath = new DirectoryInfo(targetApplicationFullPath).Parent!.FullName;
saveDirectory = Path.GetFullPath(saveDirectory, targetApplicationDirectoryFullPath);
}

var generateDeploymentProject = new GenerateDeploymentProjectCommand(
_toolInteractiveService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public class DeployCommandHandlerInput
public string? Apply { get; set; }
public bool Diagnostics { get; set; }
public bool Silent { get; set; }
public string? DeploymentProject { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class GenerateDeploymentProjectCommandHandlerInput
{
public string? ProjectPath { get; set; }
public bool Diagnostics { get; set; }
public string? Output { get; set; }
public string? ProjectDisplayName { get; set; }
public string Output { get; set; } = string.Empty;
public string ProjectDisplayName { get; set; } = string.Empty;
}
}
Loading

0 comments on commit 0b355e6

Please sign in to comment.