コード例 #1
0
ファイル: DroneEnv.cs プロジェクト: juankakode/Drone
        public static void Set(DroneEnv env)
        {
            if(env == null)
                throw new ArgumentNullException("env");

            current = env;
        }
コード例 #2
0
ファイル: DroneTaskContext.cs プロジェクト: juankakode/Drone
        /// <summary>
        /// Initializes a new instance of the <see cref="DroneTaskContext" /> class.
        /// </summary>
        /// <param name="module">The module from where the task came from.</param>
        /// <param name="task">The task being executed.</param>
        /// <param name="env">The env.</param>
        /// <param name="log">The task log.</param>
        /// <param name="taskRunner">The run task function use to run other tasks.</param>
        /// <exception cref="System.ArgumentNullException">module
        /// or
        /// task
        /// or
        /// config
        /// or
        /// taskLog
        /// or
        /// runTask</exception>
        public DroneTaskContext(
			DroneModule module,
			DroneTask task, 
			DroneEnv env,
			Logger log, 
			DroneTaskRunner taskRunner)
        {
            if(module == null)
                throw new ArgumentNullException("module");

            if(task == null)
                throw new ArgumentNullException("task");

            if(env == null)
                throw new ArgumentNullException("env");

            if(log == null)
                throw new ArgumentNullException("log");

            if(taskRunner == null)
                throw new ArgumentNullException("taskRunner");

            this.Module = module;
            this.Task = task;
            this.Env = env;
            this.Log = log;
            this.taskRunner = taskRunner;
        }
コード例 #3
0
ファイル: DroneApp.cs プロジェクト: juankakode/Drone
        private void ListCommand(ParameterTokenSet tokens, DroneFlags flags)
        {
            var config = this.droneService.LoadConfig(flags.ConfigFileName);
            var env = new DroneEnv(config, flags);

            // need to add pattern matching to the check
            var tasks = this.droneService.GetTasks(env).ToList();

            var searchPatternFlag = tokens.Pop();

            if(searchPatternFlag != null)
            {
                var searchPattern = searchPatternFlag.Value ?? string.Empty;
                tasks = tasks.Where(x => Regex.IsMatch(x.Name, searchPattern)).ToList();
            }

            var taskCounter = 0;

            foreach (var task in tasks)
            {
                this.log.Info("{0}─ {1}", this.GetTaskListPositionSymbol(taskCounter, tasks.Count - 1, false), task.Name);

                if (task.Dependencies.Count > 0)
                {
                    var depCounter = 0;

                    foreach (var dep in task.Dependencies)
                    {
                        this.log.Info("│  {0}─ {1}", this.GetTaskListPositionSymbol(depCounter, task.Dependencies.Count - 1, true), dep);
                        depCounter += 1;
                    }
                }

                taskCounter += 1;
            }
        }
コード例 #4
0
ファイル: DroneApp.cs プロジェクト: juankakode/Drone
 private void RunCommand(ParameterTokenSet tokens, DroneFlags flags)
 {
     var config = this.droneService.LoadConfig(flags.ConfigFileName);
     var env = new DroneEnv(config, flags);
     var taskNames = tokens.Where(x => !x.Value.StartsWith("-")).Select(x => x.Value);
     this.droneService.RunTasks(env, taskNames);
 }
コード例 #5
0
ファイル: DroneApp.cs プロジェクト: juankakode/Drone
 private void CompileCommand(ParameterTokenSet tokens, DroneFlags flags)
 {
     var config = this.droneService.LoadConfig(flags.ConfigFileName);
     var env = new DroneEnv(config, flags);
     this.droneService.CompileTasks(env, LogLevel.Info);
 }