private TestNodePlatform CreateNodePlatform( bool dynamicInstallIsEnabled, bool sdkAlreadyInstalled) { var cliOptions = new BuildScriptGeneratorOptions(); cliOptions.EnableDynamicInstall = dynamicInstallIsEnabled; var environment = new TestEnvironment(); var installer = new TestNodePlatformInstaller( Options.Create(cliOptions), sdkAlreadyInstalled, NullLoggerFactory.Instance); var versionProvider = new TestNodeVersionProvider(); var nodeScriptGeneratorOptions = new NodeScriptGeneratorOptions(); var detector = new TestNodePlatformDetector(); return(new TestNodePlatform( Options.Create(cliOptions), Options.Create(nodeScriptGeneratorOptions), versionProvider, NullLogger <NodePlatform> .Instance, detector, environment, installer)); }
private TestNodePlatform CreateNodePlatform( string[] supportedNodeVersions = null, string defaultVersion = null, string detectedVersion = null, BuildScriptGeneratorOptions commonOptions = null, NodeScriptGeneratorOptions nodeScriptGeneratorOptions = null) { nodeScriptGeneratorOptions = nodeScriptGeneratorOptions ?? new NodeScriptGeneratorOptions(); commonOptions = commonOptions ?? new BuildScriptGeneratorOptions(); var versionProvider = new TestNodeVersionProvider(supportedNodeVersions, defaultVersion); var environment = new TestEnvironment(); var detector = new TestNodePlatformDetector(detectedVersion: detectedVersion); var platformInstaller = new NodePlatformInstaller( Options.Create(commonOptions), NullLoggerFactory.Instance); return(new TestNodePlatform( Options.Create(commonOptions), Options.Create(nodeScriptGeneratorOptions), versionProvider, NullLogger <NodePlatform> .Instance, detector, environment, platformInstaller)); }
private TestNodePlatform CreateNodePlatform( BuildScriptGeneratorOptions commonOptions, NodeScriptGeneratorOptions nodeScriptGeneratorOptions, NodePlatformInstaller platformInstaller, string detectedVersion = null) { var environment = new TestEnvironment(); var versionProvider = new TestNodeVersionProvider(); var detector = new TestNodePlatformDetector(detectedVersion: detectedVersion); return(new TestNodePlatform( Options.Create(commonOptions), Options.Create(nodeScriptGeneratorOptions), versionProvider, NullLogger <NodePlatform> .Instance, detector, environment, platformInstaller)); }
private static IProgrammingPlatform GetNodePlatform( string defaultNodeVersion, BuildScriptGeneratorOptions commonOptions, NodeScriptGeneratorOptions nodeScriptGeneratorOptions) { var nodeVersionProvider = new TestNodeVersionProvider( new[] { "6.11.0", NodeVersions.Node8Version, NodeVersions.Node10Version, NodeVersions.Node12Version }, defaultVersion: defaultNodeVersion); nodeScriptGeneratorOptions = nodeScriptGeneratorOptions ?? new NodeScriptGeneratorOptions(); commonOptions = commonOptions ?? new BuildScriptGeneratorOptions(); return(new NodePlatform( Options.Create(commonOptions), Options.Create(nodeScriptGeneratorOptions), nodeVersionProvider, NullLogger <NodePlatform> .Instance, detector: null, new TestEnvironment(), new NodePlatformInstaller(Options.Create(commonOptions), NullLoggerFactory.Instance))); }
private static IProgrammingPlatform GetNodePlatformInstance( string defaultNodeVersion = null, string defaultNpmVersion = null, Dictionary <string, string> otherEnvironment = null) { var environment = new TestEnvironment(); environment.Variables[NodeScriptGeneratorOptionsSetup.NodeJsDefaultVersion] = defaultNodeVersion; environment.Variables[NodeScriptGeneratorOptionsSetup.NpmDefaultVersion] = defaultNpmVersion; if (otherEnvironment != null) { foreach (var environmentVariable in otherEnvironment.Keys) { environment.Variables[environmentVariable] = otherEnvironment[environmentVariable]; } } var nodeVersionProvider = new TestNodeVersionProvider( new[] { "6.11.0", NodeVersions.Node8Version, NodeVersions.Node10Version, NodeVersions.Node12Version }, defaultVersion: NodeVersions.Node12Version); var nodeScriptGeneratorOptions = Options.Create(new NodeScriptGeneratorOptions()); var optionsSetup = new NodeScriptGeneratorOptionsSetup(environment); optionsSetup.Configure(nodeScriptGeneratorOptions.Value); var commonOptions = Options.Create(new BuildScriptGeneratorOptions()); return(new NodePlatform( commonOptions, nodeScriptGeneratorOptions, nodeVersionProvider, NullLogger <NodePlatform> .Instance, detector: null, environment, new NodePlatformInstaller(commonOptions, environment))); }
private TestNodePlatform CreateNodePlatform( BuildScriptGeneratorOptions commonOptions, NodeScriptGeneratorOptions nodeScriptGeneratorOptions, NodePlatformInstaller platformInstaller) { var environment = new TestEnvironment(); var versionProvider = new TestNodeVersionProvider(); var detector = new TestNodeLanguageDetector( versionProvider, Options.Create(nodeScriptGeneratorOptions), NullLogger <NodeLanguageDetector> .Instance, environment, new TestStandardOutputWriter()); return(new TestNodePlatform( Options.Create(commonOptions), Options.Create(nodeScriptGeneratorOptions), versionProvider, NullLogger <NodePlatform> .Instance, detector, environment, platformInstaller)); }