kopia lustrzana https://github.com/c9/core
cleanup
rodzic
054bddd577
commit
2913ba0880
|
@ -40,7 +40,8 @@ module.exports = function(config, optimist) {
|
||||||
.describe("setting-path", "The path to store the settings.")
|
.describe("setting-path", "The path to store the settings.")
|
||||||
.boolean("inProcessLocalFs")
|
.boolean("inProcessLocalFs")
|
||||||
.describe("inProcessLocalFs", "Whether to run localfs in same process for debugging.")
|
.describe("inProcessLocalFs", "Whether to run localfs in same process for debugging.")
|
||||||
.default("inProcessLocalFs", config.inProcessLocalFs);
|
.default("inProcessLocalFs", config.inProcessLocalFs)
|
||||||
|
.boolean("useBrowserCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
var argv = optimist.argv;
|
var argv = optimist.argv;
|
||||||
|
@ -215,6 +216,7 @@ module.exports = function(config, optimist) {
|
||||||
/* ### BEGIN #*/
|
/* ### BEGIN #*/
|
||||||
}, {
|
}, {
|
||||||
packagePath: "./c9.static/cdn",
|
packagePath: "./c9.static/cdn",
|
||||||
|
useBrowserCache: argv.useBrowserCache,
|
||||||
cacheFiles: argv.cache
|
cacheFiles: argv.cache
|
||||||
}, {
|
}, {
|
||||||
packagePath: "./c9.static/build",
|
packagePath: "./c9.static/build",
|
||||||
|
|
|
@ -284,7 +284,7 @@ var config = require.config = function(cfg) {
|
||||||
config.paths[p] = cfg.paths[p];
|
config.paths[p] = cfg.paths[p];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cfg.useCache && global.caches) {
|
if (cfg.useCache && global.caches && !/Firefox/i.test(navigator.userAgent)) { // Firefox promises throw too much recursion error
|
||||||
config.useCache = true;
|
config.useCache = true;
|
||||||
checkCache();
|
checkCache();
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,6 @@ function checkCache() {
|
||||||
if (parts[i]) {
|
if (parts[i]) {
|
||||||
var del = ideCache.delete(baseUrl + parts[i]);
|
var del = ideCache.delete(baseUrl + parts[i]);
|
||||||
toDelete.push(del);
|
toDelete.push(del);
|
||||||
console.log(parts[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function(e, t) {
|
}, function(e, t) {
|
||||||
|
|
|
@ -70,9 +70,9 @@ function main(options, imports, register) {
|
||||||
var buffer = "";
|
var buffer = "";
|
||||||
var t = Date.now();
|
var t = Date.now();
|
||||||
var q = new FsQ();
|
var q = new FsQ();
|
||||||
var skinChanged = false;
|
var skinChanged = 0;
|
||||||
var requestedSkin = "";
|
var requestedSkin = "";
|
||||||
var requestedSkinChanged = false;
|
var requestedSkinChanged = -1;
|
||||||
q.process = function(e) {
|
q.process = function(e) {
|
||||||
var parts = e.split(" ");
|
var parts = e.split(" ");
|
||||||
var id = parts[1];
|
var id = parts[1];
|
||||||
|
@ -96,9 +96,9 @@ function main(options, imports, register) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
if (!skinChanged && /\.(css|less)/.test(id))
|
if (!skinChanged && /\.(css|less)/.test(id))
|
||||||
skinChanged = true;
|
skinChanged = s ? s.mtime.valueOf() : Infinity;
|
||||||
if (requestedSkin == id)
|
if (requestedSkin == id)
|
||||||
requestedSkinChanged = true;
|
requestedSkinChanged = s ? s.mtime.valueOf() : 0;
|
||||||
res.write(id + "\n");
|
res.write(id + "\n");
|
||||||
}
|
}
|
||||||
q.oneDone();
|
q.oneDone();
|
||||||
|
@ -106,12 +106,11 @@ function main(options, imports, register) {
|
||||||
};
|
};
|
||||||
q.end = function() {
|
q.end = function() {
|
||||||
if (!q.buffer.length && !q.active) {
|
if (!q.buffer.length && !q.active) {
|
||||||
console.log(skinChanged, requestedSkinChanged, requestedSkin)
|
if (skinChanged >= requestedSkinChanged && requestedSkin) {
|
||||||
if (skinChanged && !requestedSkinChanged && requestedSkin) {
|
|
||||||
res.write(requestedSkin + "\n");
|
res.write(requestedSkin + "\n");
|
||||||
console.info("Deleting old skin", requestedSkin);
|
console.info("Deleting old skin", requestedSkin);
|
||||||
return fs.unlink(build.cacheDir + "/" + requestedSkin, function() {
|
return fs.unlink(build.cacheDir + "/" + requestedSkin, function() {
|
||||||
skinChanged = false;
|
requestedSkin = "";
|
||||||
q.end();
|
q.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue