HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/cursos.ril.es/node_modules/laravel-elixir/Task.js
var _ = require('underscore');

var id = 0, Elixir;

/**
 * Create a new Task instance.
 *
 * @param {string}   name
 * @param {Function} description
 */
var Task = function(name, description) {
    this.id = id++;
    this.name = name;
    this.watchers = [];

    if (description) {
        this.describe(description);
    }
};

/**
 * Fetch the task(s) with the given name.
 *
 * @param  {string} name
 * @return {Task}
 */
Task.find = function(name) {
    var tasks = _.where(Elixir.tasks, { name: name });

    return tasks[Elixir.config.activeTasks[name]];
};

/**
 * Describe the task. This is the Gulp definition.
 *
 * @param  {Function} definition
 * @return {Task}
 */
Task.prototype.describe = function(definition) {
    this.definition = definition;

    this.register();

    return this;
};

/**
 * Set the task to be called, when firing `Gulp`.
 *
 * @return {Task}
 */
Task.prototype.register = function() {
    Elixir.tasks.push(this);

    Elixir.config.activeTasks = Elixir.config.activeTasks || {};
    Elixir.config.activeTasks[this.name] = 0;

    return this;
};

/**
 * Set a path regex to watch for changes.
 *
 * @param  {string}      regex
 * @param  {string|null} category
 * @return {Task}
 */
Task.prototype.watch = function(regex, category) {
    if (regex) {
        this.watchers.push(regex);
    }

    this.category = category || 'default';

    return this;
};

/**
 * Exclude the given path from the watcher.
 *
 * @param  {string} path
 * @return {Task}
 */
Task.prototype.ignore = function(path) {
    this.watchers.push(('!./' + path).replace('././', './'));

    return this;
};

/**
 * Execute the task definition.
 */
Task.prototype.run = function() {
    return this.definition();
};

/**
 * Log the task input and output.
 *
 * @param {string|Array} src
 * @param {string|null}  output
 */
Task.prototype.log = function(src, output) {
    var task = this.name.substr(0,1).toUpperCase() + this.name.substr(1);

    Elixir.Log
       .heading("Fetching " + task + " Source Files...")
       .files(src.path ? src.path : src, true);

    if (output) {
        Elixir.Log
            .heading('Saving To...')
            .files(output.path ? output.path : output);
    }
};

module.exports = function(elixir) {
    // Make Elixir available throughout this file.
    Elixir = elixir;

    return Task;
};