public TaskExecutionContext(RunContext context, FeatureConfig feature, TaskConfig task, VariableReplacer replacer)
 {
     mContext = context;
     mFeature = feature;
     mTask = task;
     mReplacer = replacer;
 }
Ejemplo n.º 2
0
 private static ExecutionNode BuildReleaseNode(RunContext context, ReleaseConfig release)
 {
     var node = new ExecutionNode(string.Format("Begin release {0}", release.Name), string.Format("End release {0}", release.Name));
     foreach (var feature in release.Features)
     {
         node.AddChild(BuildFeatureNode(context, feature));
     }
     return node;
 }
Ejemplo n.º 3
0
        private static void RunCore(RunContext context)
        {
            var plan = ActionPlan.Build(context);

            var root = new ExecutionNode(string.Format("Running '{0}' action", context.Action), "Success!");
            foreach (var release in plan.Releases)
            {
                root.AddChild(BuildReleaseNode(context, release));
            }

            var sink = new CheckingRequirementSink(context.ApplicationContext.Log);
            root.GetRequirements(sink);
            if (sink.Finish())
                throw new SoftFailureException("Command aborted due to unmet requirements.");

            root.Run(context);
        }
Ejemplo n.º 4
0
        private static ExecutionNode BuildFeatureNode(RunContext context, string feature)
        {
            FeatureConfig featureConfig;
            if (!context.FeaturesConfig.TryGet(feature, out featureConfig))
                throw new SoftFailureException(string.Format("Cannot find feature '{0}'", feature));

            var node = new ExecutionNode(string.Format("Begin feature {0}", feature), string.Format("End feature {0}", feature));

            foreach (var taskConfig in featureConfig.Recipe)
            {
                var task = context.TaskManager.CreateTask(taskConfig);
                var replacer = new VariableReplacer(context.ApplicationContext, featureConfig, taskConfig);
                node.AddChild(new ExecutionNode(task, new TaskExecutionContext(context, featureConfig, taskConfig, replacer)));
            }

            return node;
        }
Ejemplo n.º 5
0
            private static ICacheManager CreateCacheManager(RunContext context, bool noCache)
            {
                if (noCache)
                    return new NullCacheManager();

                return new CacheManager(context.ApplicationContext.UserConfig.Cache.RootPath, true, context.ApplicationContext.UserConfig.Cache.MaxCacheSize, context.ApplicationContext.UserConfig.Cache.AutoGC, context.DryRun, context.ApplicationContext.Log);
            }
Ejemplo n.º 6
0
 public static DeployContext Create(RunContext runContext, bool resume, bool noCache, bool noBeeps)
 {
     return new DeployContext(runContext, CreateCacheManager(runContext, noCache), resume, noCache, noBeeps);
 }
Ejemplo n.º 7
0
 private DeployContext(RunContext runContext, ICacheManager cacheManager, bool resume, bool noCache, bool noBeeps)
 {
     mRunContext = runContext;
     mCacheManager = cacheManager;
     mResume = resume;
     mNoCache = noCache;
     mNoBeeps = noBeeps;
 }
Ejemplo n.º 8
0
            public void Run(RunContext context)
            {
                if (mLogPre != null)
                    context.ApplicationContext.Log.Log(mLogPre);

                if (mTask != null)
                {
                    StateHash hash = null;
                    mTask.Execute(mTaskContext, ref hash);
                }
                else if (mChildren.Count > 0)
                {
                    using (context.ApplicationContext.Log.IndentScope())
                    {
                        foreach (var child in mChildren)
                        {
                            child.Run(context);
                        }
                    }
                }

                if (mLogPost != null)
                    context.ApplicationContext.Log.Log(mLogPost);
            }