public CdkProjectHandler(IOrchestratorInteractiveService interactiveService, ICommandLineWrapper commandLineWrapper)
 {
     _interactiveService = interactiveService;
     _commandLineWrapper = commandLineWrapper;
     _appSettingsBuilder = new CdkAppSettingsSerializer();
     _directoryManager   = new DirectoryManager();
 }
Beispiel #2
0
 public NPMPackageInitializer(ICommandLineWrapper commandLineWrapper, IPackageJsonGenerator packageJsonGenerator, IFileManager fileManager, IDirectoryManager directoryManager)
 {
     _commandLineWrapper   = commandLineWrapper;
     _packageJsonGenerator = packageJsonGenerator;
     _fileManager          = fileManager;
     _directoryManager     = directoryManager;
 }
 public CustomRecipeLocator(IDeploymentManifestEngine deploymentManifestEngine, IOrchestratorInteractiveService orchestratorInteractiveService,
                            ICommandLineWrapper commandLineWrapper, IDirectoryManager directoryManager)
 {
     _orchestratorInteractiveService = orchestratorInteractiveService;
     _commandLineWrapper             = commandLineWrapper;
     _deploymentManifestEngine       = deploymentManifestEngine;
     _directoryManager = directoryManager;
 }
        void GivenTheAppWasRunWithNoArguments()
        {
            _installedVersion = new Version(1, 0);
            _builder          = new AppUpdaterBuilder(TestConstants.AppPackageId)
                                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper     = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns(@"\.myapp.exe");
            _commandLineWrapper.Arguments.Returns(new[] { @"\.myapp.exe" });
        }
        void GivenTheAppWasRunWithArgumentsThatDoNotContainSpaces()
        {
            _installedVersion = new Version(1, 0);
            _builder = new AppUpdaterBuilder(TestConstants.AppPackageId)
                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns(@".\myapp.exe -v1 -updatemode autoupdate");
            _commandLineWrapper.Arguments.Returns(new[] { @".\myapp.exe", "-v1", "-updatemode", "autoupdate" });
        }
Beispiel #6
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider       = appVersionProvider;
            _fileSystem               = fileSystem;
            _commandLineWrapper       = commandLineWrapper;
            _processWrapper           = processWrapper;
            _packageSource            = nugetConfig.PackageSource;
            _appPackageId             = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Beispiel #7
0
        void GivenTheAppWasRunWithAPathThatContainsSpacesAndArgumentsThatDoContainSpaces()
        {
            _installedVersion = new SemanticVersion(new Version(1, 0));
            _builder          = new AppUpdaterBuilder(TestConstants.AppPackageId)
                                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper     = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns("\"C:\\Program Files\\myapp.exe\" -v1 -updatemode \"auto update\"");
            _commandLineWrapper.Arguments.Returns(new[] { "C:\\Program Files\\myapp.exe", "-v1", "-updatemode", "auto update" });
        }
        void GivenTheAppWasRunWithAPathThatContainsSpacesAndArgumentsThatDoContainSpaces()
        {
            _installedVersion = new Version(1, 0);
            _builder = new AppUpdaterBuilder(TestConstants.AppPackageId)
                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns("\"C:\\Program Files\\myapp.exe\" -v1 -updatemode \"auto update\"");
            _commandLineWrapper.Arguments.Returns(new[] { "C:\\Program Files\\myapp.exe", "-v1", "-updatemode", "auto update" });
        }
        void GivenTheAppWasRunWithNoArguments()
        {
            _installedVersion = new Version(1, 0);
            _builder = new AppUpdaterBuilder(TestConstants.AppPackageId)
                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns(@"\.myapp.exe");
            _commandLineWrapper.Arguments.Returns(new[] { @"\.myapp.exe" });
        }
Beispiel #10
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider = appVersionProvider;
            _fileSystem = fileSystem;
            _commandLineWrapper = commandLineWrapper;
            _processWrapper = processWrapper;
            _packageSource = nugetConfig.PackageSource;
            _appPackageId = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Beispiel #11
0
        void GivenTheAppWasRunWithArgumentsThatDoNotContainSpaces()
        {
            _installedVersion = new Version(1, 0);
            _builder          = new AppUpdaterBuilder(TestConstants.AppPackageId)
                                .SetupWithTestValues(_installedVersion);

            _commandLineWrapper = _builder.GetSubsituteCommandLineWrapper();
            _processWrapper     = _builder.GetSubsituteProcessWrapper();

            _commandLineWrapper.Full.Returns(@".\myapp.exe -v1 -updatemode autoupdate");
            _commandLineWrapper.Arguments.Returns(new[] { @".\myapp.exe", "-v1", "-updatemode", "autoupdate" });
        }
Beispiel #12
0
 public DeploymentBundleHandler(
     ICommandLineWrapper commandLineWrapper,
     IAWSResourceQueryer awsResourceQueryer,
     IOrchestratorInteractiveService interactiveService,
     IDirectoryManager directoryManager,
     IZipFileManager zipFileManager)
 {
     _commandLineWrapper = commandLineWrapper;
     _awsResourceQueryer = awsResourceQueryer;
     _interactiveService = interactiveService;
     _directoryManager   = directoryManager;
     _zipFileManager     = zipFileManager;
 }
Beispiel #13
0
        /// <summary>
        /// Convenience extension to <see cref="ICommandLineWrapper.Run"/>
        /// that returns a <see cref="TryRunWithResult"/> with the full contents
        /// of <see cref="Process.StandardError"/> and <see cref="Process.StandardOutput"/>
        /// </summary>
        /// <param name="commandLineWrapper">
        /// See <see cref="ICommandLineWrapper"/>
        /// </param>
        /// <param name="command">
        /// Shell script to execute
        /// </param>
        /// <param name="workingDirectory">
        /// Default directory for the shell.  This needs to have the correct pathing for
        /// the current OS
        /// </param>
        /// <param name="streamOutputToInteractiveService">
        /// By default standard out/error will be piped to a <see cref="IOrchestratorInteractiveService"/>.
        /// Set this to false to disable sending output.
        /// </param>
        /// <param name="redirectIO">
        /// By default, <see cref="Process.StandardInput"/>, <see cref="Process.StandardOutput"/> and <see cref="Process.StandardError"/> will be redirected.
        /// Set this to false to avoid redirection.
        /// </param>
        /// <param name="cancelToken">
        /// <see cref="CancellationToken"/>
        /// </param>
        public static async Task <TryRunResult> TryRunWithResult(
            this ICommandLineWrapper commandLineWrapper,
            string command,
            string workingDirectory = "",
            bool streamOutputToInteractiveService = false,
            bool redirectIO = true,
            CancellationToken cancelToken = default)
        {
            var result = new TryRunResult();

            await commandLineWrapper.Run(
                command,
                workingDirectory,
                streamOutputToInteractiveService,
                onComplete : runResult => result = runResult,
                redirectIO : redirectIO,
                cancelToken);

            return(result);
        }
Beispiel #14
0
        /// <summary>
        /// AWS Credentials and Region information is determined after DI container is built.
        /// <see cref="RegisterAWSContext"/> extension method allows to register late bound properties (credentials & region) to
        /// <see cref="ICommandLineWrapper"/> instance.
        /// </summary>
        public static void RegisterAWSContext(
            this ICommandLineWrapper commandLineWrapper,
            AWSCredentials awsCredentials,
            string region)
        {
            commandLineWrapper.ConfigureProcess(async processStartInfo =>
            {
                var credentials = await awsCredentials.GetCredentialsAsync();

                // use this syntax to make sure we don't create duplicate entries
                processStartInfo.EnvironmentVariables["AWS_ACCESS_KEY_ID"]     = credentials.AccessKey;
                processStartInfo.EnvironmentVariables["AWS_SECRET_ACCESS_KEY"] = credentials.SecretKey;
                processStartInfo.EnvironmentVariables["AWS_REGION"]            = region;

                if (credentials.UseToken)
                {
                    processStartInfo.EnvironmentVariables["AWS_SESSION_TOKEN"] = credentials.Token;
                }
            });
        }
Beispiel #15
0
 public GenerateDeploymentProjectCommand(
     IToolInteractiveService toolInteractiveService,
     IConsoleUtilities consoleUtilities,
     ICdkProjectHandler cdkProjectHandler,
     ICommandLineWrapper commandLineWrapper,
     IDirectoryManager directoryManager,
     IFileManager fileManager,
     OrchestratorSession session,
     IDeploymentManifestEngine deploymentManifestEngine,
     string targetApplicationFullPath)
 {
     _toolInteractiveService = toolInteractiveService;
     _consoleUtilities       = consoleUtilities;
     _cdkProjectHandler      = cdkProjectHandler;
     _commandLineWrapper     = commandLineWrapper;
     _directoryManager       = directoryManager;
     _fileManager            = fileManager;
     _session = session;
     _deploymentManifestEngine  = deploymentManifestEngine;
     _targetApplicationFullPath = targetApplicationFullPath;
 }
Beispiel #16
0
        /// <summary>
        /// Convenience extension to <see cref="ICommandLineWrapper.Run"/>
        /// that returns a <see cref="TryRunWithResult"/> with the full contents
        /// of <see cref="Process.StandardError"/> and <see cref="Process.StandardOutput"/>
        /// </summary>
        /// <param name="commandLineWrapper">
        /// See <see cref="ICommandLineWrapper"/>
        /// </param>
        /// <param name="command">
        /// Shell script to execute
        /// </param>
        /// <param name="workingDirectory">
        /// Default directory for the shell.  This needs to have the correct pathing for
        /// the current OS
        /// </param>
        /// <param name="streamOutputToInteractiveService">
        /// By default standard out/error will be piped to a <see cref="IOrchestratorInteractiveService"/>.
        /// Set this to false to disable sending output.
        /// </param>
        /// <param name="redirectIO">
        /// By default, <see cref="Process.StandardInput"/>, <see cref="Process.StandardOutput"/> and <see cref="Process.StandardError"/> will be redirected.
        /// Set this to false to avoid redirection.
        /// </param>
        /// <param name="environmentVariables">
        /// <see cref="command"/> is executed as a child process of running process which inherits the parent process's environment variables.
        /// <see cref="environmentVariables"/> allows to add (replace if exists) extra environment variables to the child process.
        /// <remarks>
        /// AWS Execution Environment string to append in AWS_EXECUTION_ENV env var.
        /// AWS SDK calls made while executing <see cref="command"/> will have User-Agent string containing
        /// </remarks>
        /// </param>
        /// <param name="cancelToken">
        /// <see cref="CancellationToken"/>
        /// </param>
        public static async Task <TryRunResult> TryRunWithResult(
            this ICommandLineWrapper commandLineWrapper,
            string command,
            string workingDirectory = "",
            bool streamOutputToInteractiveService = false,
            bool redirectIO = true,
            IDictionary <string, string>?environmentVariables = null,
            CancellationToken cancelToken = default,
            bool needAwsCredentials       = false)
        {
            var result = new TryRunResult();

            await commandLineWrapper.Run(
                command,
                workingDirectory,
                streamOutputToInteractiveService,
                onComplete : runResult => result = runResult,
                redirectIO : redirectIO,
                environmentVariables : environmentVariables,
                cancelToken : cancelToken,
                needAwsCredentials : needAwsCredentials);

            return(result);
        }
Beispiel #17
0
 public ZipFileManager(ICommandLineWrapper commandLineWrapper, IFileManager fileManager)
 {
     _commandLineWrapper = commandLineWrapper;
     _fileManager        = fileManager;
 }
Beispiel #18
0
 public SystemCapabilityEvaluator(ICommandLineWrapper commandLineWrapper, CDKManager cdkManager)
 {
     _commandLineWrapper = commandLineWrapper;
     _cdkManager         = cdkManager;
 }
Beispiel #19
0
 public SystemCapabilityEvaluator(ICommandLineWrapper commandLineWrapper)
 {
     _commandLineWrapper = commandLineWrapper;
 }
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will determine what the current command line arguments
 /// are.  This use used for the LaunchInstalledUpdate feature.
 /// </summary>
 public AppUpdaterBuilder CommandLineInfoProvidedBy(ICommandLineWrapper commandLineWrapper)
 {
     _commandLineWrapper = commandLineWrapper;
     return(this);
 }
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will determine what the current command line arguments
 /// are.  This use used for the LaunchInstalledUpdate feature.
 /// </summary>
 public AppUpdaterBuilder CommandLineInfoProvidedBy(ICommandLineWrapper commandLineWrapper)
 {
     _commandLineWrapper = commandLineWrapper;
     return this;
 }
Beispiel #22
0
 public CDKInstaller(ICommandLineWrapper commandLineWrapper)
 {
     _commandLineWrapper = commandLineWrapper;
 }