Exemplo n.º 1
0
        /// <summary>
        /// Parses a configuration file into ITaskRunnerConfig
        /// </summary>
        /// <param name="configPath"></param>
        /// <param name="taskRunnerOptions"></param>
        /// <param name="environmentPath"></param>
        /// <param name="projectItem"></param>
        /// <returns></returns>
        public async Task <ITaskRunnerConfig> ParseConfig(ITaskRunnerCommandContext context, string configPath)
        {
            //Custom
            await Geoffrey.EnsureInitialized(context);

            ITaskRunnerNode hierarchy = LoadHierarchy(configPath);

            //Common
            return(new TaskRunnerConfig <PowershellBindingsPersister>(context, hierarchy, _icon));
        }
Exemplo n.º 2
0
        private ITaskRunnerNode LoadHierarchy(string configPath)
        {
            //Custom
            ITaskRunnerNode root             = new TaskRunnerNode("Geoffrey");
            string          workingDirectory = Path.GetDirectoryName(configPath);

            foreach (string taskName in Geoffrey.DiscoverTasksIn(configPath))
            {
                string args = @"-NoProfile -NoLogo -NonInteractive -ExecutionPolicy RemoteSigned -Command ""Import-Module '" + Geoffrey.ModulePath + "' 3>$null; Invoke-Geoffrey -scriptPath '" + configPath + "' -taskName " + taskName + @"""";

                ITaskRunnerNode task = new TaskRunnerNode(taskName, true)
                {
                    Command = new TaskRunnerCommand(workingDirectory, "powershell.exe", args)
                };

                root.Children.Add(task);
            }

            return(root);
        }