-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,56 @@ | ||
"use strict"; | ||
var _write, | ||
__slice = [].slice; | ||
|
||
_write = function(config, options, next) { | ||
var done, fileUtils, hasFiles, i, _ref; | ||
fileUtils = require('../../util/file'); | ||
hasFiles = ((_ref = options.files) != null ? _ref.length : void 0) > 0; | ||
if (!hasFiles) { | ||
return next(); | ||
} | ||
i = 0; | ||
done = function() { | ||
if (++i === options.files.length) { | ||
return next(); | ||
} | ||
}; | ||
return options.files.forEach(function(file) { | ||
if ((file.outputFileText !== "" && !file.outputFileText) || !file.outputFileName) { | ||
return done(); | ||
} | ||
if (file.outputFileText === "") { | ||
config.log.warn("Compile of file [[ " + file.inputFileName + " ]] resulted in empty output."); | ||
} | ||
if (config.log.isDebug()) { | ||
config.log.debug("Writing file [[ " + file.outputFileName + " ]]"); | ||
} | ||
return fileUtils.writeFile(file.outputFileName, file.outputFileText, function(err) { | ||
if (err != null) { | ||
config.log.error("Failed to write new file [[ " + file.outputFileName + " ]], Error: " + err, { | ||
exitIfBuild: true | ||
}); | ||
} else { | ||
config.log.success("Wrote file [[ " + file.outputFileName + " ]]", options); | ||
|
||
var _write = function( config, options, next ) { | ||
if ( options.files && options.files.length ) { | ||
|
||
var processed = 0; | ||
var done = function() { | ||
if ( ++processed === options.files.length ) { | ||
next(); | ||
} | ||
return done(); | ||
}); | ||
}); | ||
}; | ||
}; | ||
|
||
var fileUtils = require( "../../util/file" ); | ||
for ( var i = 0; i < options.files.length; i++ ) { | ||
var file = options.files[i]; | ||
|
||
exports.registration = function(config, register) { | ||
var e; | ||
e = config.extensions; | ||
register(['add', 'update', 'remove', 'buildExtension'], 'write', _write, __slice.call(e.template).concat(__slice.call(e.css))); | ||
return register(['add', 'update', 'buildFile'], 'write', _write, __slice.call(e.javascript).concat(__slice.call(e.copy), __slice.call(e.misc))); | ||
// If the outputText is null/undef or there is no name set then all done | ||
if ( ( file.outputFileText !== "" && !file.outputFileText ) || !file.outputFileName ) { | ||
return done(); | ||
} | ||
|
||
// if the output text is empty, let user know | ||
if ( file.outputFileText === "" ) { | ||
config.log.warn( "File [[ " + file.inputFileName + " ]] is empty." ); | ||
} | ||
|
||
fileUtils.writeFile( file.outputFileName, file.outputFileText, function( err ) { | ||
if ( err ) { | ||
config.log.error( "Failed to write new file [[ " + file.outputFileName + " ]], Error: " + err, {exitIfBuild:true}); | ||
} else { | ||
config.log.success( "Wrote file [[ " + file.outputFileName + " ]]", options ); | ||
} | ||
done(); | ||
}); | ||
} | ||
} else { | ||
next(); | ||
} | ||
}; | ||
|
||
exports.registration = function( config, register ) { | ||
var e = config.extensions; | ||
register( | ||
["add", "update", "remove", "buildExtension"], | ||
"write", | ||
_write, | ||
[].concat.apply( e.template, e.css ) | ||
); | ||
|
||
register( | ||
["add", "update", "buildFile"], | ||
"write", | ||
_write, | ||
[].concat.apply( e.javascript, e.copy, e.misc ) | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use strict"; | ||
|
||
var _write = function( config, options, next ) { | ||
if ( options.files && options.files.length ) { | ||
|
||
var processed = 0; | ||
var done = function() { | ||
if ( ++processed === options.files.length ) { | ||
next(); | ||
} | ||
}; | ||
|
||
var fileUtils = require( "../../util/file" ); | ||
for ( var i = 0; i < options.files.length; i++ ) { | ||
var file = options.files[i]; | ||
|
||
// If the outputText is null/undef or there is no name set then all done | ||
if ( ( file.outputFileText !== "" && !file.outputFileText ) || !file.outputFileName ) { | ||
return done(); | ||
} | ||
|
||
// if the output text is empty, let user know | ||
if ( file.outputFileText === "" ) { | ||
config.log.warn( "File [[ " + file.inputFileName + " ]] is empty." ); | ||
} | ||
|
||
fileUtils.writeFile( file.outputFileName, file.outputFileText, function( err ) { | ||
if ( err ) { | ||
config.log.error( "Failed to write new file [[ " + file.outputFileName + " ]], Error: " + err, {exitIfBuild:true}); | ||
} else { | ||
config.log.success( "Wrote file [[ " + file.outputFileName + " ]]", options ); | ||
} | ||
done(); | ||
}); | ||
} | ||
} else { | ||
next(); | ||
} | ||
}; | ||
|
||
exports.registration = function( config, register ) { | ||
var e = config.extensions; | ||
register( | ||
["add", "update", "remove", "buildExtension"], | ||
"write", | ||
_write, | ||
[].concat.apply( e.template, e.css ) | ||
); | ||
|
||
register( | ||
["add", "update", "buildFile"], | ||
"write", | ||
_write, | ||
[].concat.apply( e.javascript, e.copy, e.misc ) | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global.expect = require('chai').expect; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require("./units/modules/file/write-test") |