private VariableReplacer(ApplicationContext context, FeatureConfig feature, TaskConfig task, Dictionary<string, string> replacements)
 {
     mContext = context;
     mFeature = feature;
     mTask = task;
     mReplacements = replacements;
 }
 public TaskExecutionContext(RunContext context, FeatureConfig feature, TaskConfig task, VariableReplacer replacer)
 {
     mContext = context;
     mFeature = feature;
     mTask = task;
     mReplacer = replacer;
 }
Esempio n. 3
0
        public ITask CreateTask(TaskConfig taskConfig)
        {
            Type taskType;
            if (mTypeMap.TryGetValue(taskConfig.TaskName, out taskType))
            {
                return (ITask)Activator.CreateInstance(taskType);
            }

            TaskDefinitionConfig taskDefinition;
            if (mTaskDefinitions.TryGet(taskConfig.TaskName, out taskDefinition))
            {
                return new CustomTask(taskDefinition, this);
            }

            throw new SoftFailureException(string.Format("Cannot find task {0}", taskConfig.TaskName));
        }
        private static Dictionary<string, string> BuildInitialReplacements(ApplicationContext context, FeatureConfig feature, TaskConfig task)
        {
            var result = new Dictionary<string, string>();

            result["projectRoot"] = context.ProjectRoot;
            result["f:name"] = feature.Name;
            result["f:baseDirectory"] = feature.BaseDirectory;

            foreach (var kvp in context.UserConfig.EnvironmentVariables)
            {
                result[string.Format("e:{0}", kvp.Key)] = kvp.Value;
            }

            foreach (var kvp in task.Parameters)
            {
                result[kvp.Key] = kvp.Value;
            }

            return result;
        }
 public VariableReplacer WithSubTask(TaskDefinitionConfig taskDefinition, TaskConfig taskConfig)
 {
     return new VariableReplacer(mContext, mFeature, taskConfig, MergeDictionaries(mReplacements, MergeDictionaries(taskConfig.Parameters, taskDefinition.Definitions)));
 }
 public VariableReplacer(ApplicationContext context, FeatureConfig feature, TaskConfig task)
     : this(context, feature, task, BuildInitialReplacements(context, feature, task))
 {
 }