private RunContext(ApplicationContext applicationContext, string action, ReleasesConfig releasesConfig, FeatureConfigCollection featuresConfig, TaskDefinitionConfigCollection taskDefinitionsConfig, TaskManager taskManager, ReleaseConfig activeRelease, EnvironmentConfig activeEnvironment, bool dryRun)
 {
     mApplicationContext = applicationContext;
     mAction = action;
     mReleasesConfig = releasesConfig;
     mFeaturesConfig = featuresConfig;
     mTaskDefinitionsConfig = taskDefinitionsConfig;
     mTaskManager = taskManager;
     mActiveRelease = activeRelease;
     mActiveEnvironment = activeEnvironment;
     mDryRun = dryRun;
 }
 public CustomTask(TaskDefinitionConfig taskDefinition, TaskManager manager)
 {
     mTaskDefinition = taskDefinition;
     mManager = manager;
 }
        public static RunContext Create(ApplicationContext applicationContext, string action, string release, string env, bool dryRun)
        {
            var releasesFile = Path.Combine(applicationContext.ProjectRoot, applicationContext.ProjectConfig.Releases);
            var releases = ReleasesConfig.LoadFromJson(releasesFile);

            var featuresFiles = FileUtils.ExpandGlob(Path.Combine(applicationContext.ProjectRoot, applicationContext.ProjectConfig.Features));
            var features = FeatureConfigCollection.LoadFromMultipleJsons(featuresFiles);

            var tasksFiles = FileUtils.ExpandGlob(Path.Combine(applicationContext.ProjectRoot, applicationContext.ProjectConfig.Tasks));
            var tasks = TaskDefinitionConfigCollection.LoadFromMultipleJsons(tasksFiles);

            if (string.IsNullOrWhiteSpace(release))
                release = applicationContext.UserConfig.ActiveRelease ?? releases.DefaultRelease;
            if (string.IsNullOrWhiteSpace(env))
                env = applicationContext.UserConfig.EnvironmentVariables.GetOrDefault(EnvironmentConstants.Environment, EnvironmentConstants.DefaultEnvironment);

            ReleaseConfig activeRelease;
            if (!releases.Releases.TryGet(release, out activeRelease))
                throw new SoftFailureException(string.Format("Cannot find Release '{0}'", release));

            EnvironmentConfig activeEnvironment;
            if (!applicationContext.ProjectConfig.Environments.TryGet(env, out activeEnvironment))
                throw new SoftFailureException(string.Format("Cannot find Environment '{0}'", env));

            var taskManager = new TaskManager(tasks);

            return new RunContext(applicationContext, action, releases, features, tasks, taskManager, activeRelease, activeEnvironment, dryRun);
        }