This commit is contained in:
Gabriel Bazán 2017-03-22 10:20:26 -03:00
commit ddde39ee11

View file

@ -23,8 +23,6 @@ var MakefileHeader = "# PLEASE! Do not edit this file directly \n# Modify
var fs = require('fs-extra'); var fs = require('fs-extra');
var path = require('path'); var path = require('path');
var configBlob = fs.readFileSync(configDir + '/appConfig.json', 'utf8'); var configBlob = fs.readFileSync(configDir + '/appConfig.json', 'utf8');
var config = JSON.parse(configBlob, 'utf8'); var config = JSON.parse(configBlob, 'utf8');
@ -101,43 +99,17 @@ try {
} }
fs.writeFileSync('../externalServices.json', externalServices, 'utf8'); fs.writeFileSync('../externalServices.json', externalServices, 'utf8');
function copyDir(from, to, cb) { function copyDir(from, to) {
console.log('Copying dir ' + from + ' to ' + to); console.log('Copying dir ' + from + ' to ' + to);
if (fs.existsSync(to)) fs.removeSync(to); // remove previous app directory if (fs.existsSync(to)) fs.removeSync(to); // remove previous app directory
if (!fs.existsSync(from)) return; // nothing to do if (!fs.existsSync(from)) return; // nothing to do
var files = []; fs.copySync(from, to);
fs.walk(from)
.on('data', function(item) {
if ((item.stats["mode"] & 0x4000)) {
var tmp = item.path + '/';
var l = tmp.length - from.length;
if (tmp.indexOf(from) == l) return; // #same dir
}
if (item.path.indexOf('DS_Store') >= 0) return;
if (!files.includes(path.dirname(item.path))) {
files.push(item.path);
}
})
.on('end', function() {
files.forEach(function(i) {
console.log(' # ' + i);
fs.copySync(i, to);
})
return cb();
})
} }
// Push Notification // Push Notification
fs.copySync(configDir + '/GoogleService-Info.plist', '../GoogleService-Info.plist'); fs.copySync(configDir + '/GoogleService-Info.plist', '../GoogleService-Info.plist');
fs.copySync(configDir + '/google-services.json', '../google-services.json'); fs.copySync(configDir + '/google-services.json', '../google-services.json');
copyDir(configDir + '/img', '../www/img/app', function() { copyDir(configDir + '/img', '../www/img/app');
copyDir(configDir + '/saas', '../src/sass/app', function() { copyDir(configDir + '/sass', '../src/sass/app');
console.log("apply.js finished. \n\n"); console.log("apply.js finished. \n\n");
});
});