private ICommandResolver GetProjectDependenciesCommandResolver()
        {
            var environment = new EnvironmentProvider();
            var packagedCommandSpecFactory = new PackagedCommandSpecFactory();

            return new ProjectDependenciesCommandResolver(environment, packagedCommandSpecFactory);
        }
Esempio n. 2
0
        public static CompositeCommandResolver Create()
        {
            var environment = new EnvironmentProvider();

            var platformCommandSpecFactory = default(IPlatformCommandSpecFactory);
            if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
            {
                platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();
            }
            else
            {
                platformCommandSpecFactory = new GenericPlatformCommandSpecFactory();
            }

            return CreateScriptCommandResolver(environment, platformCommandSpecFactory);
        }
Esempio n. 3
0
        public static CompositeCommandResolver Create()
        {
            var environment = new EnvironmentProvider();
            var packagedCommandSpecFactory      = new PackagedCommandSpecFactory();
            var publishedPathCommandSpecFactory = new PublishPathCommandSpecFactory();

            var platformCommandSpecFactory = default(IPlatformCommandSpecFactory);

            if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
            {
                platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();
            }
            else
            {
                platformCommandSpecFactory = new GenericPlatformCommandSpecFactory();
            }

            return(CreateDefaultCommandResolver(
                       environment,
                       packagedCommandSpecFactory,
                       platformCommandSpecFactory,
                       publishedPathCommandSpecFactory));
        }
Esempio n. 4
0
        private ICommandResolver GetProjectDependenciesCommandResolver(NuGetFramework framework)
        {
            var environment = new EnvironmentProvider();

            if (framework.IsDesktop())
            {
                IPlatformCommandSpecFactory platformCommandSpecFactory = null;
                if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
                {
                    platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();
                }
                else
                {
                    platformCommandSpecFactory = new GenericPlatformCommandSpecFactory();
                }

                return(new OutputPathCommandResolver(environment, platformCommandSpecFactory));
            }
            else
            {
                var packagedCommandSpecFactory = new PackagedCommandSpecFactory();
                return(new ProjectDependenciesCommandResolver(environment, packagedCommandSpecFactory));
            }
        }
Esempio n. 5
0
        private static void ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
        {
            using (PerfTrace.Current.CaptureTiming())
            {
                using (var nugetPackagesArchiver = new NuGetPackagesArchiver())
                {
                    var environmentProvider = new EnvironmentProvider();
                    var commandFactory = new DotNetCommandFactory();
                    var nugetCachePrimer = 
                        new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
                    var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
                        nugetCachePrimer,
                        nugetCacheSentinel,
                        environmentProvider);

                    dotnetConfigurer.Configure();
                }
            }
        }
        public void It_wraps_command_with_CMD_EXE_when_command_has_CMD_Extension_and_using_WindowsExePreferredCommandSpecFactory()
        {
            var environment = new EnvironmentProvider(new [] {".cmd"});
            var platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();

            var pathCommandResolver = new PathCommandResolver(environment, platformCommandSpecFactory);

            var testCommandPath = 
                CommandResolverTestUtils.CreateNonRunnableTestCommand(AppContext.BaseDirectory, "cmdWrapCommand", ".cmd");

            var commandResolverArguments = new CommandResolverArguments()
            {
                CommandName = "cmdWrapCommand",
                CommandArguments = null
            };

            var result = pathCommandResolver.Resolve(commandResolverArguments);

            result.Should().NotBeNull();

            var commandFile = Path.GetFileName(result.Path);
            commandFile.Should().Be("cmd.exe");

            result.Args.Should().Contain(testCommandPath);
        }
Esempio n. 7
0
        public void It_prefers_EXE_over_CMD_when_two_command_candidates_exist_and_using_WindowsExePreferredCommandSpecFactory()
        {
            var environment = new EnvironmentProvider(new [] {".exe", ".cmd"}, new[] { s_testDirectory });
            var platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();

            var pathCommandResolver = new PathCommandResolver(environment, platformCommandSpecFactory);

            CommandResolverTestUtils.CreateNonRunnableTestCommand(s_testDirectory, "extensionPreferenceCommand", ".exe");
            CommandResolverTestUtils.CreateNonRunnableTestCommand(s_testDirectory, "extensionPreferenceCommand", ".cmd");

            var commandResolverArguments = new CommandResolverArguments()
            {
                CommandName = "extensionPreferenceCommand",
                CommandArguments = null
            };

            var result = pathCommandResolver.Resolve(commandResolverArguments);

            result.Should().NotBeNull();

            var commandFile = Path.GetFileName(result.Path);
            commandFile.Should().Be("extensionPreferenceCommand.exe");
        }
        private ICommandResolver GetProjectDependenciesCommandResolver(NuGetFramework framework)
        {
            var environment = new EnvironmentProvider();

            if (framework.IsDesktop())
            {
                IPlatformCommandSpecFactory platformCommandSpecFactory = null;
                if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
                {
                    platformCommandSpecFactory = new WindowsExePreferredCommandSpecFactory();
                }
                else
                {
                    platformCommandSpecFactory = new GenericPlatformCommandSpecFactory();
                }

                return new OutputPathCommandResolver(environment, platformCommandSpecFactory);
            }
            else
            {
                var packagedCommandSpecFactory = new PackagedCommandSpecFactory();
                return new ProjectDependenciesCommandResolver(environment, packagedCommandSpecFactory);
            }
        }