doomjs
Version:
A bunch of modular gulp tasks
142 lines (112 loc) • 4 kB
JavaScript
var doom = process.doom;
var config = require('./main/config');
var core = require('./main/core');
var $ = require('./main/lib');
// ---------------------------------------------
// Doom Js
// author: @kreo
//
// Licensed under the MIT License
// http://opensource.org/licenses/MIT
// ---------------------------------------------
// ---------------------------------------------
// @module doom.index
// ---------------------------------------------
var Module = (function () {
// Private Vars
// ---------------------------------------------
// Require all tasks in modules/tasks, including subfolders
$.require_dir('../modules', {
recurse: true
});
// Private Methods
// ---------------------------------------------
// Public Methods
// ---------------------------------------------
var task_listing = function () {
core.launcher('ls', $.task_listing);
};
var logo = function () {
core.launcher('print:logo',
$.image_to_ascii(`${__dirname}/doom.{png,jpg}`, function (err, converted) {
console.log(err || converted);
})
);
};
var print_tasks = function () {
core.launcher('print:tasks', function () {
console.log(' ');
console.log($.colors.gray('Wraiths'));
console.log($.colors.gray('------------------------------'));
console.log(' ' + $.colors.magenta('-all'));
for (var i = 0; i < Object.keys(process.wraith.paths).length; i++) {
var wraith = Object.keys(process.wraith.paths)[i];
console.log(' ' + $.colors.magenta('-' + wraith));
}
console.log(' ');
//console.log($.colors.gray('Contexts'));
//console.log($.colors.gray('------------------------------'));
//console.log(' ' + $.colors.yellow('--context:all'));
//
//for (var i = 0; i < Object.keys(process.wraith.context).length; i++) {
//
// var context = Object.keys(process.wraith.context)[i];
// console.log(' ' + $.colors.yellow('--context:' + context));
//}
//console.log(' ');
});
};
var init = function () {
core.launcher('default', function () {
$.run_sequence(['ls', 'print:tasks']);
});
};
var delete_dist = function () {
core.launcher('delete:dist', function () {
core.wraith_manager(function () {
$.del(config.static + doom.dist);
});
});
};
var clean_npm_cache = function () {
core.launcher('clean:npm.cache', function () {
$.run('npm cache clean').exec();
});
};
var clean_bower_cache = function () {
core.launcher('clean:bower.cache', function () {
$.run('bower cache clean && bower prune').exec();
});
};
var update_bower = function () {
core.launcher('update:bower', function () {
$.run('bower update -a').exec();
});
};
var update_npm = function () {
core.launcher('update:npm', function () {
$.run('npm update -a').exec();
});
};
var update_dependecies = function () {
core.launcher('update:dependecies', function () {
$.run_sequence(['update:npm', 'update:bower']);
});
}
// Module API
// ---------------------------------------------
return {
init: init(),
print_tasks: print_tasks(),
task_listing: task_listing(),
delete_dist: delete_dist(),
clean_npm_cache: clean_npm_cache(),
clean_bower_cache: clean_bower_cache(),
update_bower: update_bower(),
update_npm: update_npm(),
update_dependecies: update_dependecies()
};
})();
// Module Export
// ---------------------------------------------
module.exports = Module;