コード例 #1
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;
        }
コード例 #2
0
ファイル: DroneModuleExt.cs プロジェクト: juankakode/Drone
        /// <summary>
        /// Includes the module into this module without any namespace prefix.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="otherModule">The other module.</param>
        /// <exception cref="System.ArgumentNullException">
        /// module
        /// or
        /// otherModule
        /// </exception>
        public static void Include(this DroneModule module, DroneModule otherModule)
        {
            if(module == null)
                throw new ArgumentNullException("module");

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

            module.Include(string.Empty, otherModule);
        }
コード例 #3
0
ファイル: DroneModule.cs プロジェクト: juankakode/Drone
        /// <summary>
        /// Includes the module into this module prefixing any
        /// updating task names with the given namespace if any.
        /// </summary>
        /// <param name="ns">The namespace to prefix on the tasks included.</param>
        /// <param name="module">The module to include.</param>
        /// <exception cref="System.ArgumentNullException">
        /// ns
        /// or
        /// module
        /// </exception>
        public void Include(string ns, DroneModule module)
        {
            if (ns == null)
                throw new ArgumentNullException("ns");

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

            var hasNamespace = !string.IsNullOrWhiteSpace(ns);

            foreach (var task in module.Tasks)
            {
                var newTaskName = task.Name;
                var newTaskDeps = task.Dependencies;

                if(hasNamespace)
                {
                    newTaskName = string.Format("{0}/{1}", ns, task.Name);
                    newTaskDeps = task.Dependencies.Select(x => string.Format("{0}/{1}", ns, x)).ToList();
                }

                var newTask = task.Clone(newTaskName);
                newTask.Dependencies = newTaskDeps;

                this.Add(newTask);
            }
        }