Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Localized buildDir to the module

  • Loading branch information...
commit 5191a0944ee94ba04feacec9e9fa8be9c3664681 1 parent 58de8bd
@davglass davglass authored
Showing with 22 additions and 21 deletions.
  1. +22 −21 lib/module.js
View
43 lib/module.js
@@ -189,7 +189,6 @@ var Stack = require('./stack').Stack,
}
return str;
},
- buildDir = shifter.getBuildDir(),
loggerRegex = /^.*?(?:logger|Y.log).*?(?:;|\).*;|(?:\r?\n.*?)*?\).*;).*;?.*?\r?\n/mg;
@@ -220,7 +219,6 @@ exports.reset = function() {
};
exports.loggerRegex = loggerRegex;
-exports.buildDir = buildDir;
var buildCSS = function (mod, name, callback) {
var queue = new Queue({
@@ -241,13 +239,13 @@ var buildCSS = function (mod, name, callback) {
})
.md5check({
error: cacheBuild,
- current: path.join(buildDir, name, name + '.css')
+ current: path.join(mod.buildDir, name, name + '.css')
})
.check()
- .write(path.join(buildDir, name, name + '.css'))
+ .write(path.join(mod.buildDir, name, name + '.css'))
.cssmin()
.check()
- .write(path.join(buildDir, name, name + '-min.css'))
+ .write(path.join(mod.buildDir, name, name + '-min.css'))
.run(function (err) {
if (err) {
if (/file has not changed/.test(err)) {
@@ -306,10 +304,10 @@ var buildJS = function (mod, name, callback) {
queue.md5check({
error: cacheBuild,
- current: path.join(buildDir, fileName, fileName + '-debug.js')
+ current: path.join(mod.buildDir, fileName, fileName + '-debug.js')
})
.check()
- .write(path.join(buildDir, fileName, fileName + '-debug.js'));
+ .write(path.join(mod.buildDir, fileName, fileName + '-debug.js'));
if (regex) {
queue.replace({
@@ -319,13 +317,13 @@ var buildJS = function (mod, name, callback) {
queue.log('writing RAW file')
.check()
- .write(path.join(buildDir, fileName, fileName + '.js'))
+ .write(path.join(mod.buildDir, fileName, fileName + '.js'))
.log('compressing ' + path.join(fileName, fileName + '.js with ' + cName[compressorFn]));
queue[compressorFn](compressorConfig)
.log('writing -min file')
.check()
- .write(path.join(buildDir, fileName, fileName + '-min.js'))
+ .write(path.join(mod.buildDir, fileName, fileName + '-min.js'))
.run(function (err, result) {
if (err) {
if (/file has not changed/.test(err)) {
@@ -353,7 +351,7 @@ var buildCoverage = function (mod, name, callback) {
fileName = mod.basefilename || name;
queue.read([
- path.join(buildDir, fileName, fileName + '.js')
+ path.join(mod.buildDir, fileName, fileName + '.js')
])
.log('coverage file read, starting coverage for: ' + fileName + '/' + fileName + '.js')
.coverage({
@@ -364,7 +362,7 @@ var buildCoverage = function (mod, name, callback) {
.replace(replaceOptions)
.check()
.log('writing coverage file to ' + fileName + '/' + fileName + '-coverage.js')
- .write(path.join(buildDir, fileName, fileName + '-coverage.js'))
+ .write(path.join(mod.buildDir, fileName, fileName + '-coverage.js'))
.run(function (err) {
if (err) {
log.err('coverage: ' + err);
@@ -419,7 +417,7 @@ var buildLang = function (mod, name, callback) {
queue[compressorFn](compressorConfig)
.check()
- .write(path.join(buildDir, name, 'lang', fileName))
+ .write(path.join(mod.buildDir, name, 'lang', fileName))
.run(stack.add(function (err) {
if (err) {
log.err('lang: ' + err);
@@ -438,7 +436,7 @@ exports.lang = buildLang;
var copyAssets = function (mod, name, callback) {
var from = path.join(shifter.cwd(), 'assets'),
- to = path.join(buildDir, name, 'assets');
+ to = path.join(mod.buildDir, name, 'assets');
if (exists(from)) {
log.info('shifting assets for ' + name);
@@ -454,7 +452,7 @@ var buildSkin = function (mod, name, callback) {
var stack = new Stack(),
subMod = '',
from = path.join(shifter.cwd(), 'assets'),
- to = path.join(buildDir, name, 'assets');
+ to = path.join(mod.buildDir, name, 'assets');
if (exists(path.join(shifter.cwd(), 'assets', name))) {
log.info('found a subskin, shifting for ' + name);
@@ -500,7 +498,7 @@ var buildSkin = function (mod, name, callback) {
.cssmin()
.check()
.log('writing skin file with core wrapper')
- .write(path.join(buildDir, name, 'assets', 'skins', skinName, name + '.css'))
+ .write(path.join(mod.buildDir, name, 'assets', 'skins', skinName, name + '.css'))
.run(stack.add(function (err) {
if (err) {
log.err(err);
@@ -520,7 +518,7 @@ var buildSkin = function (mod, name, callback) {
])
.check()
.log('writing skin file without core wrapper')
- .write(path.join(buildDir, name, 'assets', 'skins', skinName, name + '-skin.css'))
+ .write(path.join(mod.buildDir, name, 'assets', 'skins', skinName, name + '-skin.css'))
.run(stack.add(function () {
}));
}));
@@ -674,8 +672,8 @@ var build = function (mod, name, options, callback) {
});
if (options.clean) {
- log.info('deleting build dir: ' + path.join(buildDir, name || mod.name));
- rimraf(path.join(buildDir, name || mod.name), _build);
+ log.info('deleting build dir: ' + path.join(mod.buildDir, name || mod.name));
+ rimraf(path.join(mod.buildDir, name || mod.name), _build);
} else {
_build();
}
@@ -750,6 +748,9 @@ var exec = function (exec, name, callback) {
exports.exec = exec;
exports.build = function (mod, name, options, callback) {
+
+ mod.buildDir = options['build-dir'];
+
var end = function () {
if (mod.postexec) {
exec(mod.postexec, name, callback);
@@ -796,7 +797,7 @@ var _rollup = function (mod, name, options, callback) {
.replace(replaceOptions)
.log('writing rollup file ' + path.join(fileName, fileName + '-debug.js'))
.check()
- .write(path.join(buildDir, fileName, fileName + '-debug.js'));
+ .write(path.join(mod.buildDir, fileName, fileName + '-debug.js'));
if (regex) {
queue.replace({
@@ -810,13 +811,13 @@ var _rollup = function (mod, name, options, callback) {
queue.log('linting done, writing ' + path.join(fileName, fileName + '.js'))
.check()
- .write(path.join(buildDir, fileName, fileName + '.js'))
+ .write(path.join(mod.buildDir, fileName, fileName + '.js'))
.log('compressing ' + path.join(fileName, fileName + '.js with ' + cName[compressorFn]));
queue[compressorFn](compressorConfig)
.check()
.log('compressing done, writing ' + path.join(fileName, fileName + '-min.js'))
- .write(path.join(buildDir, fileName, fileName + '-min.js'))
+ .write(path.join(mod.buildDir, fileName, fileName + '-min.js'))
.run(function (err) {
if (err) {
log.error(name + ' rollup: ' + err);
Please sign in to comment.
Something went wrong with that request. Please try again.