37 lines
920 B
JavaScript
37 lines
920 B
JavaScript
var async = require('async');
|
|
var fs = require('fs');
|
|
var ncp = require('ncp').ncp;
|
|
var mkdirp = require('mkdirp');
|
|
var config = require('./config.js').config;
|
|
|
|
var Static = function(data) {
|
|
this.data = data;
|
|
}
|
|
|
|
Post.prototype.data = {}
|
|
|
|
Post.prototype.get = function (name) {
|
|
return this.data[name];
|
|
}
|
|
|
|
Post.prototype.set = function (name, value) {
|
|
this.data[name] = value;
|
|
}
|
|
|
|
Static.updateBuildFolder = function (callback) {
|
|
console.log("Removing "+config.staticDest);
|
|
fs.unlink(config.staticDest, function(err) {
|
|
console.log(config.staticDest+' deleted.');
|
|
ncp(config.staticSource, config.staticDest, function(err) {
|
|
if (!err) {
|
|
console.log(config.staticSource+' copied to '+config.staticDest);
|
|
callback(null);
|
|
}
|
|
else {
|
|
callback(err);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = Static;
|