kopia lustrzana https://github.com/c9/core
Merge pull request +6409 from c9/revert-attempt
Revert option A: partial revertpull/39/head^2
commit
682fb97230
|
@ -1,16 +1,44 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
require("amd-loader");
|
var Url = require("url");
|
||||||
|
|
||||||
var Fs = require("fs");
|
var Fs = require("fs");
|
||||||
var Path = require("path");
|
var Path = require("path");
|
||||||
var exec = require("child_process").exec;
|
var exec = require("child_process").exec;
|
||||||
exports.parse = require("./git_url_parse");
|
|
||||||
|
|
||||||
exports.isValidUrl = function(url) {
|
exports.isValidUrl = function(url) {
|
||||||
return !!exports.parse(url);
|
return !!exports.parse(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.parse = function(url) {
|
||||||
|
var m = url.match(/^(git)@([\w\.\d\-\_]+)(?:\/|:)([\w\.\d\-\_\/]+)/);
|
||||||
|
if (m) {
|
||||||
|
return {
|
||||||
|
protocol: "ssh:",
|
||||||
|
auth: m[1],
|
||||||
|
hostname: m[2],
|
||||||
|
pathname: m[3]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var parsed = Url.parse(url);
|
||||||
|
if (
|
||||||
|
parsed &&
|
||||||
|
parsed.protocol &&
|
||||||
|
parsed.protocol.match(/^(git|http|https):$/) &&
|
||||||
|
parsed.hostname &&
|
||||||
|
parsed.slashes &&
|
||||||
|
parsed.pathname
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
protocol: parsed.protocol,
|
||||||
|
auth: parsed.auth || "",
|
||||||
|
hostname: parsed.hostname,
|
||||||
|
pathname: parsed.pathname.replace(/^\/+/, ""),
|
||||||
|
full: url
|
||||||
|
};
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
exports.getHeadRevision = function(path, callback) {
|
exports.getHeadRevision = function(path, callback) {
|
||||||
exec("git rev-parse HEAD", {
|
exec("git rev-parse HEAD", {
|
||||||
|
|
|
@ -62,7 +62,7 @@ module.exports = {
|
||||||
assert.equal(rev.length, 40);
|
assert.equal(rev.length, 40);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
|
|
||||||
"test get head branch": function(next) {
|
"test get head branch": function(next) {
|
||||||
git.getHeadBranch(__dirname, function(err, rev) {
|
git.getHeadBranch(__dirname, function(err, rev) {
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
define(function(require, exports, module) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var Url = require("url");
|
|
||||||
|
|
||||||
module.exports = function(url) {
|
|
||||||
var m = url.match(/^(git)@([\w\.\d\-\_]+)(?:\/|:)([\w\.\d\-\_\/]+)/);
|
|
||||||
if (m) {
|
|
||||||
return {
|
|
||||||
protocol: "ssh:",
|
|
||||||
auth: m[1],
|
|
||||||
hostname: m[2],
|
|
||||||
pathname: m[3]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var parsed = Url.parse(url);
|
|
||||||
if (
|
|
||||||
parsed &&
|
|
||||||
parsed.protocol &&
|
|
||||||
parsed.protocol.match(/^(git|http|https):$/) &&
|
|
||||||
parsed.hostname &&
|
|
||||||
parsed.slashes &&
|
|
||||||
parsed.pathname
|
|
||||||
)
|
|
||||||
return {
|
|
||||||
protocol: parsed.protocol,
|
|
||||||
auth: parsed.auth || "",
|
|
||||||
hostname: parsed.hostname,
|
|
||||||
pathname: parsed.pathname.replace(/^\/+/, ""),
|
|
||||||
full: url
|
|
||||||
};
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1157,7 +1157,6 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
removeFromList();
|
|
||||||
fileWatchers[path] = fileWatchers[path] || [];
|
fileWatchers[path] = fileWatchers[path] || [];
|
||||||
fileWatchers[path].push(_self);
|
fileWatchers[path].push(_self);
|
||||||
|
|
||||||
|
@ -1235,15 +1234,14 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var handleWatchEvent = this.handleWatchEvent = function(event, filename, isVfsWrite) {
|
function handleWatchEvent(event, filename) {
|
||||||
|
console.log("watch event", event, filename, path);
|
||||||
// it is a temp file
|
// it is a temp file
|
||||||
if (filename && filename.substr(-1) == "~"
|
if (filename && filename.substr(-1) == "~"
|
||||||
&& filename.charAt(0) == ".")
|
&& filename.charAt(0) == ".")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
createStatEntry(pathBasename(path), path, function(entry) {
|
createStatEntry(pathBasename(path), path, function(entry) {
|
||||||
entry.vfsWrite = isVfsWrite || false;
|
|
||||||
|
|
||||||
if (entry.err) {
|
if (entry.err) {
|
||||||
event = "delete";
|
event = "delete";
|
||||||
close();
|
close();
|
||||||
|
@ -1294,7 +1292,7 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var sendToAllListeners = this.sendToAllListeners = function(event, filename, entry, files) {
|
var sendToAllListeners = this.sendToAllListeners = function(event, filename, entry, files) {
|
||||||
listeners.forEach(function(fn) {
|
listeners.forEach(function(fn){
|
||||||
fn(event, filename, entry, files);
|
fn(event, filename, entry, files);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1370,11 +1368,7 @@ module.exports = function setup(fsOptions) {
|
||||||
function writeToWatchedFile(path, callback) {
|
function writeToWatchedFile(path, callback) {
|
||||||
if (!fileWatchers[path])
|
if (!fileWatchers[path])
|
||||||
return callback(function(c) { c(); });
|
return callback(function(c) { c(); });
|
||||||
|
|
||||||
var watchers = fileWatchers[path].slice();
|
var watchers = fileWatchers[path].slice();
|
||||||
var parentDir = dirname(path) + "/";
|
|
||||||
var dirWatchers = (fileWatchers[parentDir] || []).slice();
|
|
||||||
|
|
||||||
watchers.forEach(function(w) {
|
watchers.forEach(function(w) {
|
||||||
w.pause();
|
w.pause();
|
||||||
});
|
});
|
||||||
|
|
|
@ -175,39 +175,33 @@ define(function(require, exports, module) {
|
||||||
if (WAIT_FOR_SIGNAL)
|
if (WAIT_FOR_SIGNAL)
|
||||||
ignore(path, 200);
|
ignore(path, 200);
|
||||||
// console.warn("[watchers] ignored event for", path, stat.vfsWrite ? "(was vfsWrite)" : "(was on ignore list)");
|
// console.warn("[watchers] ignored event for", path, stat.vfsWrite ? "(was vfsWrite)" : "(was on ignore list)");
|
||||||
|
return;
|
||||||
fireWatcherEvent(".all");
|
|
||||||
} else {
|
|
||||||
fireWatcherEvent("");
|
|
||||||
fireWatcherEvent(".all");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fireWatcherEvent(eventSuffix) {
|
if (event == "error") {
|
||||||
if (event == "error") {
|
// console.error("[watchers] received error for", path, err, stat);
|
||||||
// console.error("[watchers] received error for", path, err, stat);
|
}
|
||||||
}
|
else if (event == "delete") {
|
||||||
else if (event == "delete") {
|
fs.unwatch(path, handler);
|
||||||
fs.unwatch(path, handler);
|
delete handlers[path];
|
||||||
delete handlers[path];
|
// console.log("[watchers] received", event, "event for", path, stat);
|
||||||
// console.log("[watchers] received", event, "event for", path, stat);
|
emit("delete", { path : path });
|
||||||
emit("delete" + eventSuffix, { path : path });
|
}
|
||||||
}
|
else if (event == "directory") {
|
||||||
else if (event == "directory") {
|
emit("directory", {
|
||||||
emit("directory" + eventSuffix, {
|
path: path,
|
||||||
path: path,
|
files: files,
|
||||||
files: files,
|
stat: stat
|
||||||
stat: stat
|
});
|
||||||
});
|
}
|
||||||
}
|
else {
|
||||||
else {
|
// console.log("[watchers] received", event, "event for", path, stat);
|
||||||
// console.log("[watchers] received", event, "event for", path, stat);
|
emit("change", {
|
||||||
emit("change" + eventSuffix, {
|
type: event, //change || rename
|
||||||
type: event, // change || rename
|
filename: filename,
|
||||||
filename: filename,
|
path: path,
|
||||||
path: path,
|
stat: stat
|
||||||
stat: stat
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,12 @@ function main(options, imports, register) {
|
||||||
|
|
||||||
function sharedModules() {
|
function sharedModules() {
|
||||||
return [
|
return [
|
||||||
"lib/architect/architect"
|
"lib/architect/architect",
|
||||||
|
"ace/mode/html",
|
||||||
|
"ace/mode/javascript",
|
||||||
|
"ace/mode/css",
|
||||||
|
"ace/mode/c9search",
|
||||||
|
"ace/multi_select"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ if (!module.parent) {
|
||||||
.boolean("symlink")
|
.boolean("symlink")
|
||||||
.describe("compress", "Compress output files")
|
.describe("compress", "Compress output files")
|
||||||
.boolean("compress")
|
.boolean("compress")
|
||||||
.describe("react-style", "compile react less CSS")
|
|
||||||
.boolean("react-style")
|
|
||||||
.describe("dest", "destination folder for the static files")
|
.describe("dest", "destination folder for the static files")
|
||||||
.boolean("help")
|
.boolean("help")
|
||||||
.describe("help", "Show command line options.");
|
.describe("help", "Show command line options.");
|
||||||
|
@ -108,12 +106,6 @@ function main(config, settings, options, callback) {
|
||||||
app.services.makestatic.getMounts(options.dest, callback);
|
app.services.makestatic.getMounts(options.dest, callback);
|
||||||
else if (options.symlink)
|
else if (options.symlink)
|
||||||
app.services.makestatic.symlink(options.dest, callback);
|
app.services.makestatic.symlink(options.dest, callback);
|
||||||
else if (options["react-style"])
|
|
||||||
app.services["react.style"].compile(function(err, code) {
|
|
||||||
if (err) return callback(err);
|
|
||||||
console.log(code);
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
else
|
else
|
||||||
app.services.makestatic.copy(options.dest, callback);
|
app.services.makestatic.copy(options.dest, callback);
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue