예제 #1
0
        private static ProcessArgumentBuilder GetNpmRunArguments(NpmRunScriptSettings settings)
        {
            var args = new ProcessArgumentBuilder();

            settings?.Evaluate(args);
            return(args);
        }
        public static void NpmRunScript(this ICakeContext context, string scriptName, IEnumerable <string> arguments)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (String.IsNullOrWhiteSpace(scriptName))
            {
                throw new ArgumentNullException(nameof(scriptName));
            }

            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            var settings = new NpmRunScriptSettings
            {
                ScriptName = scriptName
            };

            foreach (var argument in arguments)
            {
                settings.Arguments.Add(argument);
            }

            context.NpmRunScript(settings);
        }
예제 #3
0
        /// <summary>
        /// execute 'npm run'/'npm run-script' with arguments
        /// </summary>
        /// <param name="scriptName">name of the </param>
        /// <param name="configure"></param>
        public INpmRunnerCommands RunScript(string scriptName, Action <NpmRunScriptSettings> configure = null)
        {
            var settings = new NpmRunScriptSettings(scriptName);

            configure?.Invoke(settings);
            var args = GetNpmRunArguments(settings);

            Run(settings, args);
            return(this);
        }
        public static void NpmRunScript(this ICakeContext context, NpmRunScriptSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            AddinInformation.LogVersionInformation(context.Log);

            var packer = new NpmScriptRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log);

            packer.RunScript(settings);
        }
        public static void NpmRunScript(this ICakeContext context, string scriptName, Action <NpmRunScriptSettings> configurator)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (String.IsNullOrWhiteSpace(scriptName))
            {
                throw new ArgumentNullException(nameof(scriptName));
            }

            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var settings = new NpmRunScriptSettings {
                ScriptName = scriptName
            };

            configurator(settings);
            context.NpmRunScript(settings);
        }