Merge remote-tracking branch 'origin/master' into fix/clone-newclient

Conflicts:
	plugins/c9.api.project/remote/docker.js
This commit is contained in:
Tim Robinson 2015-11-04 09:39:54 +00:00
commit 6aaff0141e
73 changed files with 1053 additions and 330 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ plugins/c9.fs/mock/
# ignore node_modules
node_modules/*
plugins/c9.batch/analytics/node_modules/
# except git subtrees
!node_modules/ace*
!node_modules/architect*

View File

@ -91,4 +91,4 @@ To protect the interests of the Cloud9 contributors and users we require contrib
If you want to contribute to the Cloud9 SDK and/or open source plugins please go to the online form, fill it out and submit it.
Happy coding, Cloud9
Happy coding, Cloud9

2
bin/c9
View File

@ -6,8 +6,6 @@ var architect = require("architect");
// Add ability to load AMD modules
require("amd-loader");
var verbose = process.argv.indexOf("--verbose") + 1
|| process.argv.indexOf("-v") + 1;
architect.resolveConfig(require("../configs/cli.js")(),
__dirname + "/../plugins", function (err, config) {

View File

@ -1,12 +1,14 @@
module.exports = function(options) {
// workaround for api difference between node and c9 events modules
var EventEmitter = require("events").EventEmitter;
var emit_ = EventEmitter.prototype.emit
EventEmitter.prototype.emit = function() {
emit_.apply(this, arguments);
return true;
}
var EventEmitter = require("../plugins/c9.nodeapi/events").EventEmitter;
var Module = require("module");
var _resolveFilename_orig = Module._resolveFilename
Module._resolveFilename = function(id, parent) {
if (id == "events" && parent && /c9.core[\\/]ext\.js/.test(parent.id))
id = "../c9.nodeapi/events";
return _resolveFilename_orig.call(Module, id, parent);
};
var PID = process.env.C9_PID || 526;
var APIHOST = process.env.C9_APIHOST || "api.c9.io"; // "api.c9.io";

View File

@ -84,6 +84,9 @@ module.exports.makeLocal = function(config, options) {
config[i].autoInit = false;
} else if (config[i].packagePath == "plugins/c9.ide.tree/tree") {
config[i].defaultExpanded = !config.hosted;
} else if (config[i].packagePath == "plugins/c9.ide.errorhandler/raygun_error_handler") {
// TODO fix cycle introduced by local/info and raygun_error_handler
config[i].packagePath = "plugins/c9.ide.errorhandler/simple_error_handler";
}
}
@ -127,9 +130,13 @@ module.exports.makeLocal = function(config, options) {
contents: options.project.contents,
descr: options.project.descr
}
}].filter(Boolean);
},
c9Ws && "plugins/c9.ide.analytics/mock_analytics",
].filter(Boolean);
var excludes = c9Ws ? {} : {
var excludes = c9Ws ? {
"plugins/c9.ide.analytics/analytics": true,
} : {
"plugins/c9.ide.newresource/open": true,
"plugins/c9.ide.info/info": true,
// "plugins/c9.ide.login/login": true,

View File

@ -122,7 +122,8 @@ module.exports = function(options) {
servers: options.vfsServers,
updateServers: hosted,
strictRegion: options.strictRegion
|| options.mode === "beta" && "beta"
|| options.mode === "beta" && "beta",
ignoreProtocolVersion: options.ignoreProtocolVersion,
},
{
packagePath: "plugins/c9.ide.auth/auth",
@ -381,7 +382,7 @@ module.exports = function(options) {
"plugins/c9.ide.immediate/evaluator",
"plugins/c9.ide.immediate/evaluators/browserjs",
"plugins/c9.ide.immediate/evaluators/debugnode",
// "plugins/c9.ide.immediate/evaluators/bash",
"plugins/c9.ide.immediate/evaluators/bash",
"plugins/c9.ide.run.debug/variables",
"plugins/c9.ide.run.debug/watches",
"plugins/c9.ide.run.debug/liveinspect",
@ -704,6 +705,22 @@ module.exports = function(options) {
staticPrefix: staticPrefix + "/plugins/c9.ide.collab/notifications"
},
// Test
{
packagePath: "plugins/c9.ide.test/test"
},
"plugins/c9.ide.test/testpanel",
"plugins/c9.ide.test/testrunner",
{
packagePath: "plugins/c9.ide.test/all",
staticPrefix: staticPrefix + "/plugins/c9.ide.test"
},
"plugins/c9.ide.test/results",
"plugins/c9.ide.test/coverage",
"plugins/c9.ide.test/coverageview",
"plugins/c9.ide.test.mocha/mocha",
// git integration
"plugins/c9.ide.scm/scm",
"plugins/c9.ide.scm/scmpanel",
@ -711,26 +728,9 @@ module.exports = function(options) {
"plugins/c9.ide.scm/log",
"plugins/c9.ide.scm/git",
"plugins/c9.ide.scm/editor",
"plugins/c9.ide.scm/mergetool"
];
if (!options.sdk) {
plugins.push(
// Test
"plugins/c9.ide.test/test",
"plugins/c9.ide.test/testpanel",
"plugins/c9.ide.test/testrunner",
{
packagePath: "plugins/c9.ide.test/all",
staticPrefix: staticPrefix + "/plugins/c9.ide.test"
},
"plugins/c9.ide.test/results",
"plugins/c9.ide.test/coverage",
"plugins/c9.ide.test/coverageview",
"plugins/c9.ide.test.mocha/mocha"
);
}
if (packaging || !devel) {
plugins.push({

View File

@ -155,7 +155,9 @@ module.exports = function(config, optimist) {
"c9.cli.bridge": true,
"c9.nodeapi": true,
"c9.ide.experiment": true,
"saucelabs.preview": true
"saucelabs.preview": true,
"salesforce.sync": true,
"salesforce.language": true
}
},
"./c9.preview/statics",
@ -184,6 +186,7 @@ module.exports = function(config, optimist) {
"./c9.vfs.server/cache",
"./c9.vfs.server/download",
"./c9.vfs.server/filelist",
"./c9.vfs.server/fetchcache",
"./c9.vfs.server/statics",
"./c9.analytics/mock_analytics",
"./c9.metrics/mock_metrics",

View File

@ -271,7 +271,7 @@
function loadRequireJsConfig(cb) {
var requirejs = window.requirejs;
window.require = requirejs;
requirejs.setConfig = requirejs.config;
requirejs.setConfig = requirejs.setConfig || requirejs.config;
requirejs.config = function(config) {
config.baseUrl = requirejsBaseUrl + (config.baseUrl || "");
if (config.paths) {
@ -293,7 +293,7 @@
require.packaged = true;
if (!packed || devel) {
packageIsLoading = true;
loadScript("plugins/c9.vfs.standalone/www/require.js", function() {
loadScript("node_modules/architect-build/build_support/mini_require.js", function() {
removeNwRequire();
startIde();
packageIsLoading = false;

View File

@ -361,7 +361,7 @@ var server = {
}
}
if (p.staticPrefix && options.windowLocation && options.packed) {
if (p.staticPrefix && options.windowLocation && (options.packed || isRemote)) {
p.staticPrefix = p.staticPrefix.replace(/^\/static/, options.windowLocation);
}
}
@ -392,6 +392,10 @@ var server = {
plugins = require(configPath).makeLocal(config.plugins, settings);
settings.url = config.url;
}
plugins.forEach(function(p) {
if (p.staticPrefix)
p.staticPrefix = p.staticPrefix.replace(/^https?:\/\/.*?\/static/, "/static");
})
updateFilePaths(plugins, function(){
cb(plugins, settings);
});
@ -415,7 +419,6 @@ var server = {
openWindow : openWindow,
parseArgs : parseArgs,
getRecentWindows: getRecentWindows,
listC9Projects: listC9Projects,
getRemoteWorkspaceConfig: getRemoteWorkspaceConfig
};
@ -1023,49 +1026,6 @@ function loadData(url, callback) {
xhr.send("");
}
// TODO add proper api to c9 server
function listC9Projects(user, callback) {
if (!user)
return callback(null, []);
var url = "https://c9.io/" + user.name;
loadData(url, function(err, result) {
if (err) return callback(err);
var ownProjects = [];
var sharedProjects = [];
try {
var pids = Object.create(null);
JSON.parse(result.match(/projects:\s*(.*),/)[1]).forEach(function(x) {
var userName = x.owner_username || user.name;
var project = {
name: userName + "/" + x.name,
projectName: x.name,
pid: x.pid,
isRemote: true,
};
if (pids[project.pid])
return;
pids[project.pid] = project;
if (userName == user.name)
ownProjects.push(project);
else
sharedProjects.push(project);
});
} catch(e) {
console.error(e);
return callback(e);
}
callback(null, {
shared: sharedProjects,
own: ownProjects
});
});
}
function getRemoteWorkspaceConfig(projectName, callback) {
var url = "https://ide.c9.io/" + projectName + "?config=1";
loadData(url, function(err, result, xhr) {

View File

@ -281,7 +281,9 @@ function normalizeCommandKeys(callback, e, keyCode) {
keyCode = -1;
}
if (hashId & 8 && (keyCode === 91 || keyCode === 92)) {
// keyCode of right command is 93 on mac and 92 on windows.
// keyCode of left command key is 91
if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) {
keyCode = -1;
}

View File

@ -294,6 +294,8 @@ function LineWidgets(session) {
if (!w || !w.el) continue;
if (w.session != this.session) continue;
if (!w._inDocument) {
if (this.session.lineWidgets[w.row] != w)
continue;
w._inDocument = true;
renderer.container.appendChild(w.el);
}

View File

@ -98,6 +98,7 @@ var VScrollBar = function(parent, renderer) {
this.width = dom.scrollbarWidth(parent.ownerDocument);
this.inner.style.width =
this.element.style.width = (this.width || 15) + 5 + "px";
this.$minWidth = 0;
};
oop.inherits(VScrollBar, ScrollBar);
@ -124,7 +125,7 @@ oop.inherits(VScrollBar, ScrollBar);
* @returns {Number}
**/
this.getWidth = function() {
return this.isVisible ? this.width : 0;
return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
};
/**

View File

@ -799,8 +799,10 @@ var Selection = function(session) {
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row])
docPos.row++;
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
if (docPos.row > 0 || rows > 0)
docPos.row++;
}
}
// move the cursor and update the desired column

View File

@ -299,8 +299,17 @@ require.undef = function(module, recursive) {
function undefAll(module, hash) {
Object.keys(hash).forEach(function(key) {
var i = key.indexOf("!") + 1;
if (key.lastIndexOf(module, 0) == 0)
require.undef(key);
if (i) {
var plugin = key.slice(0, i - 1);
var resource = key.slice(i);
if (resource.lastIndexOf(module, 0) == 0 || plugin.lastIndexOf(module, 0) == 0) {
require.undef(key);
require.undef(resource);
}
}
});
}

View File

@ -406,7 +406,9 @@ function checkCycles(config, lookup) {
"\nMissing services:\n" + unresolvedList.join("\n") + "\n", unresolved,
"\nResolved services:", Object.keys(resolved));
var err = new Error("Could not resolve dependencies\n"
+ "Missing services: " + unresolvedList);
+ (unresolvedList.length ? "Missing services: " + unresolvedList
: "Config contains cyclic dependencies" // TODO print cycles
));
err.unresolved = unresolvedList;
throw err;
}

24
node_modules/c9/has-internal-domain.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
if (define === undefined) {
var define = function(fn) {
fn(require, exports, module);
};
}
define(function(require, exports, module) {
"use strict";
var _ = require("lodash");
var internalDomain = ['c9.io', 'cloud9beta.com'];
function hasInternalDomain(email) {
if (!email) return false;
var emailElements = email.split("@");
var emailDomain = emailElements[emailElements.length - 1];
return _.contains(internalDomain, emailDomain);
}
module.exports = hasInternalDomain;
});

34
node_modules/c9/has-internal-domain_test.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
"use strict";
"use mocha";
require("c9/inline-mocha")(module);
var assert = require("assert");
var faker = require("faker");
var hasInternalDomain= require("c9/has-internal-domain");
describe("has-internal-domain", function() {
it("returns false when undefined email", function() {
var email;
assert.equal(false, hasInternalDomain(email), "should return false when email undefined");
});
it("returns true when email has c9.io domain", function() {
var email = "test@c9.io";
assert.equal(true, hasInternalDomain(email), "should return true when email has c9.io domain");
});
it("returns true when has cloud9beta.com domain", function() {
var email = "test@cloud9beta.com";
assert.equal(true, hasInternalDomain(email), "should return true when email has cloud9beta.com domain");
});
it("returns false when not internal email", function() {
var email = faker.internet.email();
assert.equal(false, hasInternalDomain(email), "should return false when email is not internal");
});
});

28
node_modules/c9/json-with-re.js generated vendored Normal file
View File

@ -0,0 +1,28 @@
/**
* JSON (de-)serializer with support for encosing regular expressions
*/
"use strict";
exports.replacer = function(key, value) {
if (value instanceof RegExp)
return ("__REGEXP " + value.toString());
else
return value;
};
exports.reviver = function(key, value) {
if ((value + "").indexOf("__REGEXP ") == 0) {
var m = value.match(/__REGEXP \/(.*)\/(.*)?/);
return new RegExp(m[1], m[2]);
}
else
return value;
};
exports.stringify = function(value, space) {
return JSON.stringify(value, exports.replacer, space);
};
exports.parse = function(rext) {
return JSON.parse(rext, exports.reviver);
};

27
node_modules/c9/json-with-re_test.js generated vendored Normal file
View File

@ -0,0 +1,27 @@
/*global describe it before after beforeEach afterEach define*/
"use strict";
"use server";
"use mocha";
require("c9/inline-mocha")(module);
var assert = require("assert-diff");
var reJSON = require("./json-with-re");
describe(__filename, function(){
it("should encode regular expressions", function() {
assert.deepEqual(reJSON.stringify({ foo: /foo/ }), '{"foo":"__REGEXP /foo/"}');
assert.deepEqual(reJSON.stringify({ foo: /foo\//gi }), "{\"foo\":\"__REGEXP /foo\\\\//gi\"}");
});
it("should decode regular expressions", function() {
assert.deepEqual(reJSON.parse('{"foo":"__REGEXP /foo/"}'), { foo: /foo/ });
assert.deepEqual(reJSON.parse("{\"foo\":\"__REGEXP /foo\\\\//gi\"}"), { foo: /foo\//gi });
});
it("should deal with null values", function() {
var o = {
foo: null,
bar: /dd/
};
assert.deepEqual(reJSON.parse(reJSON.stringify(o)), o);
});
});

15
node_modules/c9/oberr.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
define(function(require, exports, module) {
/**
* Turns a JS Error into a proper object that can be stringified
* https://github.com/timjrobinson/oberr for more information
**/
return function oberr(err) {
var ob = {};
Object.getOwnPropertyNames(err).forEach(function(key) {
ob[key] = err[key];
});
return ob;
};
});

9
node_modules/c9/object.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
/*
* Swap keys and values of an object
*/
exports.invert = function(obj) {
return Object.keys(obj).reduce(function(res, key) {
res[obj[key]] = key;
return res;
}, {});
};

20
node_modules/c9/skip-analytics.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
if (define === undefined) {
var define = function(fn) {
fn(require, exports, module);
};
}
define(function(require, exports, module) {
"use strict";
var hasInternalDomain = require("c9/has-internal-domain");
function skipAnalytics(user) {
if (!user) return true;
if (user.id === -1) return true;
if (hasInternalDomain(user.email)) return true;
return false;
}
module.exports = skipAnalytics;
});

53
node_modules/c9/skip-analytics_test.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
"use strict";
"use mocha";
require("c9/inline-mocha")(module);
var assert = require("assert");
var faker = require("faker");
var skipAnalytics = require("c9/skip-analytics");
describe("skip-analytics", function() {
it("returns true when user undefined", function() {
var user;
assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user undefined");
});
it("returns true when user id is -1", function() {
var user = {
id: -1
};
assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user id is -1");
});
it("returns false when user has no email", function() {
var user = {
id: faker.random.uuid()
};
assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user has no email");
});
it("returns true when user has internal email", function() {
var user = {
id: faker.random.uuid(),
email: "test@c9.io"
};
assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has internal email");
user.email = "test@cloud9beta.com";
assert.equal(true, skipAnalytics(user), "skipAnalytics should return true when user has internal beta email");
});
it("returns false when user is authorized and does not have intermal email", function() {
var user = {
id: faker.random.uuid(),
email: faker.internet.email()
};
assert.equal(false, skipAnalytics(user), "skipAnalytics should return false when user is authorized and does not have internal email");
});
});

9
node_modules/c9/string.js generated vendored
View File

@ -43,5 +43,14 @@ exports.repeat = function(str, times) {
exports.count = function(str, substr){
return str.split(substr).length - 1;
};
exports.endsWith = function(subjectString, searchString, position) {
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
});

107
node_modules/c9/urls.js generated vendored
View File

@ -6,36 +6,71 @@
* @copyright 2015, Ajax.org B.V.
*/
var plugin = module.exports = main;
var assert = require("assert");
plugin.consumes = ["error.logger"];
plugin.provides = ["urls"];
var errorLogger = mockErrorLogger;
function getHost(req) {
var host =
req.headers && req.headers.host ||
req.host ||
req.url ||
req;
return host.replace(/^https?:\/\/([^/]*).*/, "$1");
}
function main(options, imports, register) {
errorLogger = imports["error.logger"];
function splitDomain(req, domains) {
var host = getHost(req);
register(null, {
urls: plugin
});
var allDomains = domains.join("|");
var domainRe = new RegExp("^(.*?)\\.?(" + allDomains.replace(".", "\\.") + ")(?::(\\d+))?$");
var m = host.match(domainRe);
if (m) {
return {
subDomains: m[1],
domainName: m[2],
port: m[3] || ""
};
} else {
return {
subDomains: "",
domainName: host.split(":")[0],
port: host.split(":")[1] || ""
};
}
}
/**
* Get a desired base URL, given some context.
*
* @param req The current request object or URL
* @param {String} [sourceUrlPattern] The source URL pattern, e.g. https://ide.$DOMAIN
* @param {String} targetBaseUrlPattern The target URL pattern, e.g. https://$DOMAIN
* Example for a request coming into the IDE service:
*
* ```
* getBaseUrl(req, "https://ide.$DOMAIN", "https://preview.$DOMAIN");
* ```
*
* The above example will determine the domain name from the request,
* by stripping off the "https://ide." part. So, for a domain like
* "https://ide.c9.io" we'll get "c9.io". For a domain like
* "https://ide.dogfooding-lennartcl.c9.io" we'll get dogfooding-lennartcl.c9.io.
* If there is no match, a warning is shown. The target pattern
* is used to construct the resulting URL, e.g. https://preview.c9.io.
*
* @param req
* The current request object or URL
* @param {String} [sourceUrlPattern]
* The URL pattern of the current service, e.g. https://ide.$DOMAIN if
* we are getting an incoming request for the IDE service
* @param {String} targetBaseUrlPattern
* The URL pattern of the target service. E.g., if we want to
* construct the base URL of the API service, this might be https://api.$DOMAIN.
*/
plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
var sourceHost = req.headers && req.headers.host
|| req.host
|| req.url && req.url.replace(/^https?:\/\/([^/]*).*/, "$1")
|| req;
function getBaseUrl(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
var sourceHost = getHost(req);
if (typeof sourceHost !== "string")
throw new Error("Not a valid request object: " + req);
if (!sourceBaseUrlPattern)
throw new Error("getBaseUrl() requires at least two arguments");
@ -46,24 +81,29 @@ plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
.replace("$DOMAIN", "([^/]+)");
var hostMatch = sourceHost.match(sourceHostMatcher);
var targetHost;
if (hostMatch) {
targetHost = hostMatch[1];
}
else {
errorLogger.log(new Error("Could not construct URL: request host "
+ sourceHost + " should match " + sourceBaseUrlPattern));
console.error(new Error("Could not construct URL: request host " + sourceHost + " should match " + sourceBaseUrlPattern));
targetHost = "c9.io";
}
if (targetHost.match(/^(ide|vfs)./) && !targetBaseUrlPattern)
errorLogger.log(new Error("Warning: no targetBaseUrlPattern specified, will stay at " + targetHost), { sourceBaseUrlPattern: sourceBaseUrlPattern });
if (targetHost.match(/^(ide|vfs)./))
console.trace("Warning: possibly incorrect baseUrl constructed, with 'ide.' in the hostname: " + targetHost);
if (/^(ide|vfs)./.test(targetHost) && !targetBaseUrlPattern)
console.error(new Error("Warning: no targetBaseUrlPattern specified, will stay at " + targetHost), {
sourceBaseUrlPattern: sourceBaseUrlPattern
});
if (/^(ide|vfs)./.test(targetHost))
console.trace("Warning: possibly incorrect baseUrl constructed, with 'ide.' in the hostname: " + targetHost);
return replaceDomain(targetBaseUrlPattern || sourceBaseUrlPattern, targetHost)
.replace(/\/$/, "");
};
}
plugin.replaceDomains = function(settings, domains) {
function replaceDomains(settings, domains) {
domains = Array.isArray(domains) ? domains : domains.split(",");
var primaryDomain = domains[0];
settings.domains = domains;
@ -85,14 +125,15 @@ plugin.replaceDomains = function(settings, domains) {
});
}
}
};
}
function replaceDomain(url, domain) {
return url.replace("$DOMAIN", domain);
}
function mockErrorLogger() {}
mockErrorLogger.log = function(err) {
console.error(err.stack);
};
plugin.mockErrorLogger = mockErrorLogger;
module.exports = {
replaceDomains: replaceDomains,
getBaseUrl: getBaseUrl,
splitDomain: splitDomain,
getHost: getHost
};

26
node_modules/c9/urls_test.js generated vendored
View File

@ -9,7 +9,7 @@ if (typeof define === "undefined") {
require("../../test/setup_paths");
}
var assert = require("assert");
var assert = require("assert-diff");
var urls = require("./urls");
var url = require("url");
var sinon = require("sinon");
@ -126,4 +126,28 @@ describe("urls", function() {
var baseUrl = urls.getBaseUrl(input, "https://preview.$DOMAIN");
assert.equal(baseUrl, "https://preview.newclient-lennartcl.c9.io");
});
it("should split domains", function() {
var domains = ["c9.io", "c9users.io", "cs50.io"];
assert.deepEqual(urls.splitDomain("fjakobs-ace.c9.io", domains), {
domainName: "c9.io",
subDomains: "fjakobs-ace",
port: ""
});
assert.deepEqual(urls.splitDomain("preview.c9users.io", domains), {
domainName: "c9users.io",
subDomains: "preview",
port: ""
});
assert.deepEqual(urls.splitDomain("fjakobs.ace.cs50.io", domains), {
domainName: "cs50.io",
subDomains: "fjakobs.ace",
port: ""
});
assert.deepEqual(urls.splitDomain("fjakobs.ace.cs50.io:8081", domains), {
domainName: "cs50.io",
subDomains: "fjakobs.ace",
port: "8081"
});
});
});

View File

@ -1,11 +1,24 @@
"use strict";
var url = require("url");
module.exports = function(options, imports, register) {
var trustedDomainsRe = options.trustedDomainsRe || /.*/;
imports.connect.addResponseMethod("redirect", function(location) {
this.writeHead(302, {Location: location});
this.end("");
});
imports.connect.addResponseMethod("secureRedirect", function(location) {
var parsedLocation = url.parse(location);
if (!trustedDomainsRe.test(parsedLocation.host))
location = parsedLocation.path;
this.writeHead(302, {Location: location});
this.end("");
});
imports.connect.addResponseMethod("returnTo", function(req, defaultReturn) {
var url = defaultReturn || "/";
if (req.session && req.session.returnTo) {

2
node_modules/vfs-local/localfs.js generated vendored
View File

@ -1402,7 +1402,7 @@ module.exports = function setup(fsOptions) {
tryConnect();
function tryConnect() {
var called = false;
var socket = net.connect(port, process.env.OPENSHIFT_DIY_IP || "localhost", function() {
var socket = net.connect(port, "127.0.0.1", function() {
if (called) return;
called = true;

View File

@ -1,7 +1,7 @@
{
"name": "c9",
"description": "New Cloud9 Client",
"version": "3.0.2817",
"version": "3.1.190",
"author": "Ajax.org B.V. <info@ajax.org>",
"private": true,
"main": "bin/c9",
@ -26,7 +26,7 @@
"mkdirp": "~0.3.5",
"msgpack-js": "~0.1.1",
"msgpack-js-browser": "~0.1.4",
"nak": "",
"nak": "git://github.com/cloud9ide/nak.git#719f2188ec1d8e4ce553286e80737d7e6434d777",
"netutil": "~0.0.2",
"optimist": "~0.6.0",
"qs": "0.6.6",
@ -55,42 +55,42 @@
"c9"
],
"c9plugins": {
"c9.ide.language": "#ff78609c3f",
"c9.ide.language": "#a6ffafabce",
"c9.ide.language.css": "#a649f2a710",
"c9.ide.language.generic": "#77d43cfaf0",
"c9.ide.language.html": "#0f4078c187",
"c9.ide.language.html.diff": "#24f3608d26",
"c9.ide.language.javascript": "#2b77bdb96a",
"c9.ide.language.javascript.immediate": "#0535804ada",
"c9.ide.language.javascript.eslint": "#df7e424b54",
"c9.ide.language.javascript.eslint": "#3ec4557969",
"c9.ide.language.javascript.tern": "#ad1d9b1b3a",
"c9.ide.language.javascript.infer": "#8478e3c702",
"c9.ide.language.jsonalyzer": "#83646961c7",
"c9.ide.collab": "#6066918891",
"c9.ide.local": "#a9703b630c",
"c9.ide.language.jsonalyzer": "#8401c240b3",
"c9.ide.collab": "#11bdc3aecf",
"c9.ide.local": "#a6e689e33b",
"c9.ide.find": "#35379124ca",
"c9.ide.find.infiles": "#c132ad243c",
"c9.ide.find.replace": "#44772dd796",
"c9.ide.run.debug": "#e38e16e120",
"c9.ide.run.debug": "#3b76105b4e",
"c9.automate": "#47e2c429c9",
"c9.ide.ace.emmet": "#6dc4585e02",
"c9.ide.ace.gotoline": "#a8ff07c8f4",
"c9.ide.ace.keymaps": "#bf6d36213f",
"c9.ide.ace.repl": "#7989bbd07f",
"c9.ide.ace.keymaps": "#2e3c6e3c8f",
"c9.ide.ace.repl": "#4b88a85b7b",
"c9.ide.ace.split": "#0ae0151c78",
"c9.ide.ace.statusbar": "#d95be89d53",
"c9.ide.ace.stripws": "#cf0f42ac59",
"c9.ide.behaviors": "#e2c7f68242",
"c9.ide.behaviors": "#05e5681e2e",
"c9.ide.closeconfirmation": "#cee4674141",
"c9.ide.configuration": "#382b61f4ab",
"c9.ide.configuration": "#a9066299a2",
"c9.ide.dialog.wizard": "#7667ec79a8",
"c9.ide.fontawesome": "#781602c5d8",
"c9.ide.format": "#b0bb91a623",
"c9.ide.format": "#5ec97fb083",
"c9.ide.help.support": "#e95f98f87c",
"c9.ide.imgeditor": "#66a9733dc1",
"c9.ide.immediate": "#18c23aa730",
"c9.ide.immediate": "#29fd6d3f51",
"c9.ide.installer": "#0fde9f0067",
"c9.ide.mount": "#dccfb51a2b",
"c9.ide.mount": "#3e017a3324",
"c9.ide.navigate": "#c191d9b92f",
"c9.ide.newresource": "#981a408a7b",
"c9.ide.openfiles": "#7fa4a97fed",
@ -102,14 +102,14 @@
"c9.ide.recentfiles": "#7c099abf40",
"c9.ide.remote": "#301d2ab519",
"c9.ide.processlist": "#2b12cd1bdd",
"c9.ide.run": "#ba97f384a6",
"c9.ide.run": "#f360984649",
"c9.ide.run.build": "#0598fff697",
"c9.ide.run.debug.xdebug": "#61dcbd0180",
"c9.ide.save": "#e00549cb0f",
"c9.ide.scm": "#38d2b48b31",
"c9.ide.save": "#4a4a60a004",
"c9.ide.scm": "#aabd0d181e",
"c9.ide.terminal.monitor": "#b76f1c9f24",
"c9.ide.test": "#d312a01ac6",
"c9.ide.test.mocha": "#79ff886c04",
"c9.ide.test": "#26cd260224",
"c9.ide.test.mocha": "#f6cc482886",
"c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b",
"c9.ide.undo": "#b028bcb4d5",

View File

@ -44,6 +44,7 @@ define(function(require, exports, module) {
var force = false;
var dryRun = false;
var createTag = false;
var compress = false;
// Set up basic auth for api if needed
if (BASICAUTH) api.basicAuth = BASICAUTH;
@ -85,6 +86,11 @@ define(function(require, exports, module) {
"alias": "t",
"default": false,
"boolean": true
},
"compress" : {
"description": "Minify output with uglify.js",
"default": true,
"boolean": true
}
},
check: function(argv) {
@ -108,7 +114,7 @@ define(function(require, exports, module) {
process.exit(1);
}
else if (!dryRun) {
console.log("Succesfully published version", data.version);
console.log("Successfully published version", data.version);
process.exit(0);
}
});
@ -125,9 +131,17 @@ define(function(require, exports, module) {
"alias": "d",
"default": false,
"boolean": true
},
"compress" : {
"description": "Minify output with uglify.js",
"default": false,
"boolean": true
}
},
exec: function(argv) {
compress = argv["compress"];
verbose = argv["verbose"];
force = argv["force"];
if (argv["devel"]) {
var code = function(argument) {
/* TODO explain */
@ -159,13 +173,14 @@ define(function(require, exports, module) {
}
else {
dryRun = true;
publish({local: true}, function(err){
publish({local: true}, function(err, result){
if (err) {
console.error(err);
if (!verbose)
console.error("\nTry running with --verbose flag for more information");
process.exit(1);
}
console.log("Done!");
});
}
}
@ -186,6 +201,7 @@ define(function(require, exports, module) {
check: function(argv) {},
exec: function(argv) {
verbose = argv["verbose"];
compress = argv["compress"];
unpublish(
function(err, data){
@ -194,7 +210,7 @@ define(function(require, exports, module) {
process.exit(1);
}
else {
console.log("Succesfully disabled package");
console.log("Successfully disabled package");
process.exit(0);
}
});
@ -234,6 +250,37 @@ define(function(require, exports, module) {
return (verbose ? JSON.stringify(err, 4, " ") : (typeof err == "string" ? err : err.message));
}
function addMissingValues(json) {
json.permissions = json.permissions || "world";
return json;
}
function validateConfig(json) {
var cwd = process.cwd();
// Basic Validation
if (json.private)
return new Error("ERROR: Private flag in package.json prevents from publishing");
if (!json.name)
return new Error("ERROR: Missing name property in package.json");
if (!json.name.match(/^[\w\._]+$/))
return new Error("ERROR: Package name can only contain Alphanumeric characters, periods and underscores");
if (basename(cwd) != json.name) {
console.warn("WARNING: The name property in package.json is not equal to the directory name, which is " + basename(cwd));
if (!force)
return new Error("Use --force to ignore this warning.");
}
if (!json.repository)
return new Error("ERROR: Missing repository property in package.json");
if (!json.repository.url)
return new Error("ERROR: Missing repository.url property in package.json");
if (!json.categories || json.categories.length == 0)
return new Error("ERROR: At least one category is required in package.json");
if (!json.permissions || !json.permissions.match(/org|world/))
return new Error("ERROR: Permissions must be 'org' or 'world'");
}
function publish(options, callback) {
if (typeof options != "object")
options = {version: options};
@ -250,36 +297,29 @@ define(function(require, exports, module) {
return callback(new Error("ERROR: Could not parse package.json: ", e.message));
}
// Basic Validation
if (json.private)
return callback(new Error("ERROR: Private flag in package.json prevents from publishing"));
if (!json.name)
return callback(new Error("ERROR: Missing name property in package.json"));
if (basename(cwd) != json.name) {
console.warn("WARNING: The name property in package.json is not equal to the directory name, which is " + basename(cwd));
if (!force)
return callback(new Error("Use --force to ignore this warning."));
}
if (!json.repository)
return callback(new Error("ERROR: Missing repository property in package.json"));
if (!json.repository.url)
return callback(new Error("ERROR: Missing repository.url property in package.json"));
if (!json.categories || json.categories.length == 0)
return callback(new Error("ERROR: At least one category is required in package.json"));
console.log("Permissions are: ", json.permissions);
console.log("Data is: ", data);
json = addMissingValues(json);
console.log("Permissions are: ", json.permissions);
var validationError = validateConfig(json);
if (validationError) return callback(validationError);
var description = json.description;
if (description)
console.warn("WARNING: Description property in package.json will be ignored. README.md will be used.");
// Validate README.md
if (!fs.existsSync(join(cwd, "README.md"))) {
if (fs.existsSync(join(cwd, "README.md"))) {
description = fs.readFileSync(join(cwd, "README.md"), "utf8")
.replace(/^\#.*\n*/, "");
} else {
console.warn("WARNING: README.md is missing.");
if (!force)
return callback(new Error("Use --force to ignore these warnings."));
}
if (json.description)
console.warn("WARNING: Description property in package.json will be ignored. README.md will be used.");
var description = fs.readFileSync(join(cwd, "README.md"), "utf8")
.replace(/^\#.*\n*/, "");
// Validate plugins
var plugins = {};
@ -572,7 +612,7 @@ define(function(require, exports, module) {
enableBrowser: true,
includeConfig: false,
noArchitect: true,
compress: !dryRun,
compress: compress,
obfuscate: true,
oneLine: true,
filter: [],
@ -683,7 +723,7 @@ define(function(require, exports, module) {
description: description,
owner_type: "user", // @TODO implement this when adding orgs
owner_id: parseInt(user.id),
permissions: json.permissions || "world",
permissions: json.permissions,
categories: json.categories,
repository: json.repository,
longname: json.longname,
@ -692,9 +732,10 @@ define(function(require, exports, module) {
pricing: json.pricing || {}
}
}, function(err, pkg){
if (err)
if (err) {
return callback(new Error("ERROR: Failed to upload new package to API - "
+ stringifyError(err)));
}
next(pkg);
});

View File

@ -2,8 +2,6 @@
"use strict";
"use server";
"use blacklist";
require("c9/inline-mocha")(module);
if (typeof define === "undefined") {
@ -64,7 +62,7 @@ describe("cli.publish", function(){
"description": "",
"star_count": 0,
"star_total": 0,
"installs": 0,
"screenshots": [
// TODO Screenshots are broken
@ -95,6 +93,14 @@ describe("cli.publish", function(){
});
});
it("should be fine if json.permissions is missing as it defaults to world", function(done){
fs.writeFileSync(packagePath, packageJson.replace(/"permissions[\s\S]*?\],/, ""));
runCLI("publish", ["major"], function(err, stdout, stderr){
assert(!err, err);
done();
});
});
it("should warn if the package.json is missing", function(done){
fs.unlinkSync(packagePath);
runCLI("publish", ["major"], function(err, stdout, stderr){
@ -116,6 +122,13 @@ describe("cli.publish", function(){
done();
});
});
it("should fail if the name in the package.json contains invalid characters", function(done){
fs.writeFileSync(packagePath, packageJson.replace('c9.ide.example', 'c9-ide-example'));
runCLI("publish", ["major"], function(err, stdout, stderr){
expect(stderr).to.match(/ERROR: Package name can only contain/);
done();
});
});
it("should fail if the name in the package.json is not equal to the directory", function(done){
fs.writeFileSync(packagePath, packageJson.replace('"name": "c9.ide.example"', '"name": "wrongname"'));
runCLI("publish", ["major"], function(err, stdout, stderr){
@ -137,6 +150,16 @@ describe("cli.publish", function(){
done();
});
});
it("should fail if json.permissions is not org or world", function(done){
var parsedJson = JSON.parse(packageJson);
parsedJson.permissions = "notvalid";
fs.writeFileSync(packagePath, JSON.stringify(parsedJson));
runCLI("publish", ["major"], function(err, stdout, stderr){
console.log("stdout: ", stdout)
expect(stderr).to.match(/ERROR: Permissions must be/);
done();
});
});
it("should warn if a plugin is not listed in the package.json", function(done){
fs.writeFileSync(packagePath, packageJson.replace('"example": {}', ''));
runCLI("publish", ["major"], function(err, stdout, stderr){

View File

@ -530,8 +530,8 @@ define(function(require, exports, module) {
});
}
function cleanUp(keepElements) {
if (!keepElements) {
function cleanUp(what) {
if (!what || ~what.indexOf("elements")) {
// Loop through elements
elements.forEach(function(element) {
element.destroy(true, true);
@ -542,33 +542,36 @@ define(function(require, exports, module) {
}
// Loop through events
events.forEach(function(eventRecord) {
var event = eventRegistry[eventRecord[0]];
if (!event) return; // this happens with mock plugins during testing
var type = eventRecord[1];
var id = eventRecord[2];
var _events = event._events;
var eventList = _events && _events[type];
if (typeof eventList == "function") {
if (eventList.listenerId == id)
event.off(type, eventList);
} else if (Array.isArray(eventList)) {
eventList.some(function(listener) {
if (listener.listenerId != id) return;
event.off(type, listener);
return true;
});
}
});
events = [];
if (!what || ~what.indexOf("events")) {
events.forEach(function(eventRecord) {
var event = eventRegistry[eventRecord[0]];
if (!event) return; // this happens with mock plugins during testing
var type = eventRecord[1];
var id = eventRecord[2];
var _events = event._events;
var eventList = _events && _events[type];
if (typeof eventList == "function") {
if (eventList.listenerId == id)
event.off(type, eventList);
} else if (Array.isArray(eventList)) {
eventList.some(function(listener) {
if (listener.listenerId != id) return;
event.off(type, listener);
return true;
});
}
});
events = [];
onNewEvents = {};
}
// Loop through other
other.forEach(function(o) {
o();
});
other = [];
onNewEvents = {};
if (!what || ~what.indexOf("other")) {
other.forEach(function(o) {
o();
});
other = [];
}
}
function setAPIKey(apikey){

View File

@ -391,13 +391,14 @@ define(function(require, exports, module) {
}
if (hash[key] === value)
return;
var oldValue = hash[key];
hash[key] = value;
// Tell everyone this property changed
emit(parts.join("/"), value);
emit(parts.join("/"), value, oldValue);
// Tell everyone it's parent changed
emit(query, value);
emit(query, value, oldValue);
// Tell everyone the root type changed (user, project, state)
scheduleAnnounce(parts[0], userData);
@ -422,7 +423,7 @@ define(function(require, exports, module) {
function getJson(query) {
var json = get(query, true);
if (query.indexOf("json()") == -1)
if (query.indexOf("@") == -1 && query.indexOf("json()") == -1)
json = json["json()"];
if (typeof json === "object")
@ -433,6 +434,7 @@ define(function(require, exports, module) {
return JSON.parse(json);
} catch (e) {}
}
// do not return null or undefined so that getJson(query).foo never throws
return false;
}

View File

@ -115,11 +115,20 @@ function plugin(options, imports, register) {
if (/json/.test(accept)) {
var error = {
code: statusCode,
message: err.message,
hostname: options.hostname,
scope: options.scope,
stack: stack,
stack: stack
};
var allowedErrorKeys = [
"message", "projectState", "premium", "retryIn", "progress",
"oldHost", "blocked"
];
allowedErrorKeys.forEach(function(key) {
if (err.hasOwnProperty(key))
error[key] = err[key];
});
try {
JSON.stringify(error);

View File

@ -0,0 +1,91 @@
#!/usr/bin/env node
/*global describe it before after beforeEach afterEach */
"use strict";
"use server";
require("c9/inline-mocha")(module);
require("amd-loader");
var assert = require("assert-diff");
var sinon = require("sinon");
var error = require("http-error");
var errorHandlerPlugin = require("./error_handler");
describe(__filename, function(){
this.timeout(2000);
var errorHandler;
var imports;
var options = {
scope: "ide",
hostname: "fabian-dev"
};
beforeEach(function(done) {
imports = {
connect: {
useError: sinon.stub(),
useStart: sinon.stub()
},
"connect.static": {
addStatics: sinon.stub()
}
};
errorHandlerPlugin(options, imports, function(err, services) {
errorHandler = imports.connect.useError.lastCall.args[0];
done(err);
});
});
afterEach(function () {
});
it("should only pass white listed keys", function(done) {
var err = new error.PreconditionRequired("Resizing workspace; please retry later");
err.projectState = 1;
err.premium = true;
err.retryIn = 2000;
err.progress = {
progress: 0,
nextProgress: 0
};
err.FOO = "not me";
var req = {
headers: {
accept: "application/json"
}
};
var res = {
json: function(err, body, code) {
assert(!body);
assert.equal(code, 428);
assert.deepEqual(err, {
error: {
code: 428,
hostname: "fabian-dev",
scope: "ide",
stack: undefined,
message: "Resizing workspace; please retry later",
projectState: 1,
premium: true,
retryIn: 2000,
progress: {
progress: 0,
nextProgress: 0
}
}
});
done();
}
};
errorHandler(err, req, res, function() {
assert.fail();
done();
});
});
});

View File

@ -1,3 +1,8 @@
/**
* This error handler is for server side error logging.
*
**/
"use strict";
plugin.consumes = ["raygun"];

View File

@ -4,7 +4,7 @@ var domain = require("domain");
var url = require("url");
var _ = require("lodash");
plugin.consumes = ["raygun", "connect", "http", "connect.remote-address"];
plugin.consumes = ["raygun", "connect", "http", "connect.remote-address", "metrics"];
plugin.provides = ["raygun.connect"];
module.exports = plugin;
@ -15,6 +15,7 @@ function plugin(options, imports, register) {
var warningClient = raygun.warningClient;
var connect = imports.connect;
var server = imports.http.getServer();
var metrics = imports.metrics;
errorClient.user = warningClient.user = function(req) {
return (req && req.user) ? req.user.name : "";
@ -62,7 +63,6 @@ function plugin(options, imports, register) {
var req = domain && domain.members[0];
if (req && req.url)
sendRequestWarning(new Error("Request timed out: " + req.url), req);
});
function sendRequestError(err, req) {

View File

@ -292,29 +292,33 @@ define(function(require, exports, module) {
// Validation
var toNode = findNode(newPath);
if (parent) { // Dir is in cache
if (toNode)
deleteNode(toNode);
deleteNode(node, true);
if (toNode)
deleteNode(toNode, true);
createNode(newPath, null, node); // Move node
recurPathUpdate(node, oldPath, newPath);
createNode(newPath, null, node); // Move node
recurPathUpdate(node, oldPath, newPath);
e.undo = function(){
if (!parent) {
var tmpParent = node;
while (node.parent && tmpParent.parent.status == "pending")
tmpParent = tmpParent.parent;
if (tmpParent)
deleteNode(tmpParent, true);
}
deleteNode(node, true);
if (toNode)
createNode(newPath, null, toNode);
e.undo = function(){
createNode(oldPath, null, node);
recurPathUpdate(node, newPath, oldPath);
if (toNode)
createNode(newPath, null, toNode);
};
e.confirm = function() {
if (node.status === "predicted")
node.status = "loaded";
};
node.status = "predicted";
}
else {
removeSingleNode(e);
}
createNode(oldPath, null, node);
recurPathUpdate(node, newPath, oldPath);
};
e.confirm = function() {
if (node.status === "predicted")
node.status = "loaded";
};
node.status = "predicted";
}, plugin);
fs.on("afterRename", afterHandler, plugin);
@ -553,10 +557,6 @@ define(function(require, exports, module) {
node.status = "loaded";
}
if (isFolder && !node.map)
node.map = {};
else if (!isFolder && node.map)
delete node.map;
if (stat.size != undefined)
node.size = stat.size;
if (stat.mtime != undefined)
@ -566,6 +566,11 @@ define(function(require, exports, module) {
node.isFolder = isFolder;
}
if (node.isFolder && !node.map)
node.map = {};
else if (!node.isFolder && node.map)
delete node.map;
node.children = null;
if (!updating) {

View File

@ -347,7 +347,7 @@ define(function(require, exports, module) {
* @param {String} path the path of the directory to get the listing from
* @param {Function} callback called after the file listing is read
* @param {Error} callback.err the error information returned by the operation
* @param {String[]} callback.files a list of strings containing the filenames of the files in the directory
* @param {Stat[]} callback.files a list of stat objects (See fs.stat) containing the file information of the files in the directory
* @fires error
*/
readdir: api.readdir,

View File

@ -618,8 +618,8 @@ define(function(require, exports, module) {
return isAvailable ? isAvailable(editor.ace) : true;
};
command.findEditor = function(editor) {
if (apf.activeElement && apf.activeElement.ace && apf.activeElement.ace.isFocused())
command.findEditor = function(editor, e) {
if (e && apf.activeElement && apf.activeElement.ace && apf.activeElement.ace.isFocused())
return apf.activeElement.ace;
return editor && editor.ace || editor;
};

View File

@ -1,7 +1,7 @@
define(function(require, exports, module) {
"use strict";
main.consumes = ["Plugin", "ui", "metrics"];
main.consumes = ["Plugin", "ui", "metrics", "error_handler"];
main.provides = ["dialog.error"];
return main;
@ -9,6 +9,7 @@ define(function(require, exports, module) {
var Plugin = imports.Plugin;
var ui = imports.ui;
var metrics = imports.metrics;
var errorHandler = imports.error_handler;
/***** Initialization *****/
@ -114,14 +115,17 @@ define(function(require, exports, module) {
+ (message.className ? message.className : "");
if (!message.noError) {
metrics.increment("dialog.error");
if (!message) {
console.trace();
return console.error("empty error message", message);
}
console.error("Error dialog shown: ", getMessageString(message));
metrics.increment("dialog.error");
errorHandler.log(new Error("Error dialog shown"), {
message: message,
messageString: getMessageString(message),
});
}
hide(function() {

View File

@ -26,7 +26,6 @@
font-size: 8pt;
overflow: hidden;
position: relative;
height: 210px;
border-radius:3px;
}

View File

@ -55,6 +55,7 @@ define(function(require, module, exports) {
function setBookmarkedValue(value, cleansed) {
if (plugin.value == value) {
recentValue = value;
undoManager.bookmark();
return;
}

View File

@ -10,6 +10,9 @@ define(function(require, module, exports) {
var Plugin = imports.Plugin;
var menus = imports.menus;
var extname = require("path").extname;
var basename = require("path").basename;
/***** Initialization *****/
var plugin = new Plugin("Ajax.org", main.consumes);
@ -54,9 +57,20 @@ define(function(require, module, exports) {
return editor;
}
function editorSupportsFile(type, path) {
var extensions = findEditor(type).fileExtensions;
var ext = extname(path).substr(1).toLowerCase();
var filename = basename(path).toLowerCase();
return ~extensions.indexOf(path)
|| ~extensions.indexOf(filename)
|| ~extensions.indexOf(ext) ? true : false;
}
function findEditorByFilename(fn) {
var ext = fn.substr(fn.lastIndexOf(".") + 1).toLowerCase();
var ext = extname(fn).substr(1).toLowerCase();
var filename = basename(fn).toLowerCase();
var editor = fileExtensions[fn] && fileExtensions[fn][0]
|| fileExtensions[filename] && fileExtensions[filename][0]
|| fileExtensions[ext] && fileExtensions[ext][0]
|| defaultEditor;
@ -169,6 +183,8 @@ define(function(require, module, exports) {
});
plugin.on("unload", function(){
loaded = false;
defaultEditor = null;
group = null;
});
/***** Register and define API *****/
@ -245,6 +261,11 @@ define(function(require, module, exports) {
*/
findEditorByFilename: findEditorByFilename,
/**
*
*/
editorSupportsFile: editorSupportsFile,
/**
* Create an editor instance based on it's type
* @param {String} type The type of the editor to create

View File

@ -12,7 +12,7 @@ define(function(require, exports, module) {
/***** Initialization *****/
var extensions = ["gif", "ico", "svg"];
var extensions = ["gif", "ico"];
function ImageEditor(){
var plugin = new Editor("Ajax.org", main.consumes, extensions);
@ -135,4 +135,4 @@ define(function(require, exports, module) {
ImageEditor, extensions)
});
}
});
});

View File

@ -7,6 +7,7 @@ define(function(require, module, exports) {
var Plugin = imports.Plugin;
var Document = imports.Document;
var ui = imports.ui;
var alert = imports["dialog.alert"].show;
var stylesheet = ui.createStylesheet();
@ -249,7 +250,7 @@ define(function(require, module, exports) {
// var lastType = tab.editorType;
amlPane.cloud9pane.createEditor(type, function(err, editor) {
var info = {};
if (editor.isValid(amlTab.document, info) === false) {
if (editor.isValid(amlTab.cloud9tab.document, info) === false) {
alert(
info.title || "Could not switch editor",
info.head || "Could not switch editor because this document is invalid.",
@ -257,6 +258,8 @@ define(function(require, module, exports) {
);
return;
}
var currentValue = plugin.document.value;
editorType = type;
amlTab.setAttribute("type", "editor::" + type);
@ -264,6 +267,11 @@ define(function(require, module, exports) {
if (amlPane.getPage() == amlTab) {
amlPane.activepage = -1;
amlPane.set(amlTab);
plugin.document.value = currentValue;
// TODO undo managers for different editors conflict
// however, resetting removes changed state
// plugin.document.undoManager.reset();
}
callback();

View File

@ -178,7 +178,7 @@ define(function(require, module, exports) {
if (!editors.findEditor(e.value).fileExtensions.length)
openEditor(e.value, true, function(){});
else if (focussedTab)
focussedTab.switchEditor(e.value, function(){});
switchEditor(focussedTab, e.value, function(){});
});
editors.on("menuShow", function(e) {
var group, editor = focussedTab && focussedTab.editor;
@ -186,13 +186,8 @@ define(function(require, module, exports) {
group = node.group;
var path = focussedTab && focussedTab.path || "";
var ext = path.substr(path.lastIndexOf(".") + 1);
var type = node.value;
var extensions = editors.findEditor(type).fileExtensions;
var isAvailable = editors.defaultEditor == type
|| extensions.indexOf(ext.toLowerCase()) > -1
|| !extensions.length;
var isAvailable = editors.editorSupportsFile(type, path);
node.setAttribute("disabled", !isAvailable);
});
@ -1075,7 +1070,7 @@ define(function(require, module, exports) {
options.document.title = basename(path);
options.document.tooltip = path;
}
if (typeof options.value == "string")
if (typeof options.value == "string" && !options.newOnError)
options.document.value = options.value;
// if (options.document.filter === undefined)
// options.document.filter = true;
@ -1091,7 +1086,7 @@ define(function(require, module, exports) {
var doc = options.document;
var loadFromDisk = path
&& (!doc || doc.value === undefined)
&& options.value === undefined
&& (options.value === undefined || options.newOnError)
// autoload to false prevents loading data, used by image editor
&& (!editor || editor.autoload !== false);
@ -1410,6 +1405,13 @@ define(function(require, module, exports) {
return true;
}
function switchEditor(tab, type, callback) {
tab.switchEditor(type, function(){
emit("switchEditor", { tab: tab });
callback.apply(this, arguments);
});
}
/**** Support for state preservation ****/
function pauseTabResize(){
@ -1961,6 +1963,11 @@ define(function(require, module, exports) {
*/
clone: clone,
/**
*
*/
switchEditor: switchEditor,
/**
* @ignore
*/

View File

@ -116,9 +116,11 @@ define(function(require, module, exports) {
return {
mark: mark,
position: position,
stack: stack.map(function(item) {
return item.getState ? item.getState() : item;
})
stack: stack
.filter(function(item){ return item; })
.map(function(item) {
return item.getState ? item.getState() : item;
})
};
}

View File

@ -1,5 +1,7 @@
/**
* This error handler catches window.onerror and sends them to raygun.io
* This error handler is for client side error logging
* It also automatically catches window.onerror and sends them to raygun.io
* You can also import it and call .log to manually send an error
*
* @extends Plugin
* @singleton

View File

@ -21,9 +21,9 @@
</div>
<div class="c9Staff">
<p textselect="true">
Arron Bailiss, Bas de Wachter, Fabian Jakobs, Harutyun Amirjanyan,
Arron Bailiss, Bas de Wachter, Dana Ivan, Fabian Jakobs, Harutyun Amirjanyan,
Ivar Pruijn, Justin Dray, Lennart Kats, Luca Cipriani,
Mostafa Eweda, Matthijs van Henten, Nikolai Onken, Tim Robinson, Ruben Daniels
Mostafa Eweda, Matthijs van Henten, Nikolai Onken, Suraj Biyani, Tim Robinson, Ruben Daniels
</p>
</div>
<div class="c9Copyright">

View File

@ -127,10 +127,10 @@ define(function(require, exports, module) {
}
if (command.isAvailable && !command.isAvailable(editor, args, e))
return; //Disable commands for other contexts
return; // Disable commands for other contexts
if (command.findEditor)
editor = command.findEditor(editor);
editor = command.findEditor(editor, e);
if (editor && editor.$readOnly && !command.readOnly)
return false;

View File

@ -1226,7 +1226,7 @@
@dropdown-black-image-height: 5px;
@dropdown-black-background-position: 50% 50%;
@dropdown-black-height: 28px;
@dropdown-black-padding: 8px 0 5px 9px;
@dropdown-black-padding: 7px 8px 5px 9px;
@dropdown-black-font-family: @general-font-family;
@dropdown-black-font-size: 13px;
@dropdown-black-button-width: 24px;

View File

@ -305,6 +305,9 @@
.filetree .tree-row > span.caption {
margin-left: 4px;
}
.filetree .tree-row.heading > span.caption {
margin-left: 0;
}
.toolbar-top.basic .c9-menu-btnDown.scripts{
border: 0;
@ -417,6 +420,8 @@
.has_apf .toolbar-top .sbtb_middle{
height: auto;
padding: 4px 25px 3px 5px;
border: 0;
margin-right: 1px;
}
.top-test-panel{
@ -424,8 +429,26 @@
box-shadow: none;
}
.runner-form-header{
border-bottom: 1px solid @border-highlight-dark;
body .runner-form-header{
background: whitesmoke;
}
.runtestbtn .icon{
background-position: 1px 2px;
height: 22px;
}
.coverage-toolbar{
background-color:#f7f7f7;
border-bottom: 1px solid #ECECEC;
box-sizing: border-box;
}
.coverage-toolbar .label{
padding:7px;
}
.coverage-toolbar .black_dropdown{
margin: 0 !important;
min-height: 28px !important;
}
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 1.25dppx) {
@ -483,4 +506,7 @@
.c9-toolbarbutton-glossy .c9-icon {
height: 19px;
}
.runtestbtn .icon{
height: 21px;
}
}

View File

@ -16,7 +16,7 @@ define(function(require, exports, module) {
/***** Initialization *****/
var plugin = new PreferencePanel("Ajax.org", main.consumes, {
caption: "Settings",
caption: "User Settings",
form: true,
index: 100
});

View File

@ -258,10 +258,10 @@ define(function(require, exports, module) {
["foregroundColor", colors[1]],
["selectionColor", colors[2]],
["antialiasedfonts", colors[3]],
["fontfamily", "Ubuntu Mono, Menlo, Consolas, monospace"], //Monaco,
["fontfamily", "Ubuntu Mono, Menlo, Consolas, monospace"], // Monaco,
["fontsize", "12"],
["blinking", "false"],
["scrollback", "1000"]
["scrollback", 10000]
]);
setSettings();
@ -356,6 +356,13 @@ define(function(require, exports, module) {
}
});
});
handle.on("unload", function(){
mnuTerminal = null;
lastEditor = null;
lastTerminal = null;
shownDotsHelp = null;
installPrompted = null;
});
handle.draw = function(){
ui.insertMarkup(null, markupMenu, handle);

View File

@ -278,9 +278,9 @@ define(function(require, exports, module) {
tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize);
tree.renderer.on("resize", updateScrollBarSize);
function updateScrollBarSize() {
var w = tree.renderer.scrollBarV.getWidth();
var scrollBarV = tree.renderer.scrollBarV;
var w = scrollBarV.isVisible ? scrollBarV.getWidth() : 0;
btnTreeSettings.$ext.style.marginRight = Math.max(w - 2, 0) + "px";
tree.renderer.scroller.style.right = Math.max(w, 10) + "px";
}
tree.on("drop", function(e) {

View File

@ -240,9 +240,13 @@ define(function(require, exports, module) {
value: options.path
? createBind(options.path)
: (options.defaultValue || ""),
min: options.min,
max: options.max,
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1
min: options.min || 0,
max: options.max || 10,
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1,
onafterchange: function(e) {
if (options.onchange)
options.onchange({ value: e.value });
},
})
];
break;
@ -254,16 +258,24 @@ define(function(require, exports, module) {
: (options.defaultCheckboxValue || ""),
width: width, maxwidth: maxwidth,
label: name + ":",
skin: "checkbox_black"
skin: "checkbox_black",
onafterchange: function(e) {
if (options.onchange)
options.onchange({ value: e.value, type: "checkbox" });
},
}),
new ui.spinner({
width: options.width || widths["checked-spinner"],
value: options.path
? createBind(options.path)
: (options.defaultValue || ""),
min: options.min,
max: options.max,
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1
min: options.min || 0,
max: options.max || 10,
realtime: typeof options.realtime !== "undefined" ? options.realtime : 1,
onafterchange: function(e) {
if (options.onchange)
options.onchange({ value: e.value, type: "spinner" });
},
})
];
break;
@ -275,7 +287,11 @@ define(function(require, exports, module) {
: (options.defaultValue || ""),
width: options.width || widths["checked-single"],
label: name,
skin: "checkbox_black"
skin: "checkbox_black",
onafterchange: function(e){
if (options.onchange)
options.onchange({ value: e.value });
}
})
];
break;
@ -421,8 +437,8 @@ define(function(require, exports, module) {
});
}
if (options.name) {
node.setAttribute("id", options.name);
if (options.id || options.name) {
node.setAttribute("id", options.id || options.name);
elements[node.name] = node;
}
@ -440,20 +456,25 @@ define(function(require, exports, module) {
case "dropdown":
var dropdown = el.lastChild;
var data = item.items.map(function(item) {
return "<item value='" + item.value
+ "'><![CDATA[" + item.caption + "]]></item>";
}).join("");
if (data) {
setTimeout(function(){
dropdown.$model.load("<items>" + data + "</items>");
if (item.items) {
var data = item.items.map(function(item) {
return "<item value='" + item.value
+ "'><![CDATA[" + item.caption + "]]></item>";
}).join("");
if (data) {
setTimeout(function(){
var value = item.value || dropdown.value;
dropdown.value = -999;
dropdown.setAttribute("value", value);
dropdown.$model.load("<items>" + data + "</items>");
setTimeout(function(){
var value = item.value || dropdown.value;
dropdown.value = -999;
dropdown.setAttribute("value", value);
});
});
});
}
}
else if (item.value) {
dropdown.setAttribute("value", item.value);
}
break;
default:

View File

@ -738,6 +738,8 @@ apf.menu = function(struct, tagName){
* @param {String} value The value of the item to select.
*/
this.select = function(group, value){
this.selectedValue = value;
var nodes = this.childNodes;
var i, l = nodes.length;
for (i = 0; i < l; i++) {
@ -1530,8 +1532,8 @@ apf.item = function(struct, tagName){
//@todo Anim effect here?
this.dispatchEvent("click", {
xmlContext : this.parentNode.xmlReference,
opener : this.parentNode.opener
xmlContext : (this.parentNode || 0).xmlReference,
opener : (this.parentNode || 0).opener
});

View File

@ -577,6 +577,7 @@ apf.vsplitbox = function(struct, tagName) {
if (isPercentage) {
fNode.$ext.style.height = "";
fNode.$ext.style.bottom = (100 - parseFloat(fNode.height)) + "%";
lNode.$ext.style.height = "";
}
if (this.$handle) {

View File

@ -33555,7 +33555,9 @@ apf.splitbutton = function(struct, tagName) {
var diff = apf.getAbsolutePosition(split.$button2.$ext)[0]
- apf.getAbsolutePosition(split.$button1.$ext)[0];
this.$ext.style.marginLeft = "-" + diff + "px";
this.$ext.style.marginLeft = ~this.$ext.className.indexOf("moveleft")
? 0
: "-" + diff + "px";
});
menu.$splitInited = true;
}
@ -33568,6 +33570,8 @@ apf.splitbutton = function(struct, tagName) {
var _self = this;
this.$ext = this.$pHtmlNode.appendChild(document.createElement("div"));
this.$ext.className = "splitbutton";
if (this.getAttribute("style"))
this.$ext.setAttribute("style", this.getAttribute("style"));
var skin = this["button-skin"] || this.getAttribute("skin") || this.localName;

View File

@ -942,6 +942,10 @@ define(function(require, exports, module) {
return item;
}
function remove(item){
aml.removeChild(item.aml);
}
function show(x, y) {
lastCoords = { x : x, y : y };
aml.display(x, y);
@ -951,6 +955,11 @@ define(function(require, exports, module) {
aml = new ui.menu({
id: options.id,
zindex: options.zindex,
visible: options.visible,
width: options.width,
height: options.height,
minWidth: options.minWidth,
minHeight: options.minHeight,
"onprop.visible" : function(e) {
emit(e.value ? "show" : "hide", lastCoords);
checkItems.call(this, e);
@ -1057,6 +1066,30 @@ define(function(require, exports, module) {
*/
get zindex(){ return aml && ui.getStyle(aml.$ext, "z-index"); },
set zindex(value) { aml && aml.setAttribute("zindex", value); },
/**
* Specifies the width of the menu
* @property {Number} width
*/
get width(){ return aml && aml.getWidth(); },
set width(value) { aml && aml.setAttribute("width", value); },
/**
* Specifies the height of the menu
* @property {Number} height
*/
get height(){ return aml && aml.getHeight(); },
set height(value) { aml && aml.setAttribute("height", value); },
/**
* Specifies the minimal width of the menu
* @property {Number} width
*/
get minWidth(){ return aml && aml.getAttribute("minwidth"); },
set minWidth(value) { aml && aml.setAttribute("minwidth", value); },
/**
* Specifies the minimal height of the menu
* @property {Number} height
*/
get minHeight(){ return aml && aml.getAttribute("minheight"); },
set minHeight(value) { aml && aml.setAttribute("minheight", value); },
/**
* The menu items appended to this menu
* @property {MenuItem[]} items
@ -1089,6 +1122,12 @@ define(function(require, exports, module) {
*/
append: append,
/**
* Remove a menu item from this menu
* @param {MenuItem} item The item to remove from this menu.
*/
remove: remove,
/**
* Show the menu at the specified position
* @param {Number} x The x coordinate specified in pixels from the left of the browser window.

View File

@ -16,8 +16,9 @@ define(function(require, exports, module) {
if (!options.baseName)
options.baseName = "tree";
if (!options.model) {
var model = new TreeModel();
var model = options.model;
if (!model) {
model = new TreeModel();
options.model = model;
}

View File

@ -13,7 +13,8 @@ function plugin(options, imports, register) {
register(null, {
"metrics": {
log: function() {},
increment: function() {}
increment: function() {},
timing: function() {}
}
});
}

View File

@ -60,9 +60,6 @@ EventEmitter.prototype.emit = function(type) {
if (!this._events)
return;
if (arguments[2] === true)
throw new Error("Please use emit.sticky() instead of passing sticky=true for event: " + type);
var handler = this._events[type];
if (!handler)
return;
@ -190,7 +187,7 @@ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
* ```
*/
EventEmitter.prototype.once = function(type, listener) {
EventEmitter.prototype.once = function(type, listener, plugin) {
var self = this;
var wrapped = function() {
@ -199,7 +196,7 @@ EventEmitter.prototype.once = function(type, listener) {
}
wrapped.listener = listener;
self.on(type, wrapped);
self.on(type, wrapped, plugin);
return this;
};

View File

@ -39,7 +39,13 @@ define(function(require, exports, module) {
session.ws = {};
req.projectSession = session.ws[ws];
if (!req.projectSession || !req.projectSession.expires || req.projectSession.expires <= Date.now()) {
if (
!req.projectSession ||
!req.projectSession.expires ||
req.projectSession.expires <= Date.now() ||
req.projectSession.uid != req.user.id
) {
req.projectSession = session.ws[ws] = {
expires: Date.now() + 10000
};
@ -77,6 +83,7 @@ define(function(require, exports, module) {
}
req.projectSession.role = role;
req.projectSession.pid = project.id;
req.projectSession.uid = req.user.id;
var type = project.scm;
req.projectSession.type = type;
@ -137,8 +144,8 @@ define(function(require, exports, module) {
var path = req.params.path;
var url = req.proxyUrl + path;
if (req.session.token)
url += "?access_token=" + encodeURIComponent(req.session.token.id || req.session.token);
if (req.user.code)
url += "?access_token=" + encodeURIComponent(req.user.code);
var parsedUrl = parseUrl(url);
var httpModule = parsedUrl.protocol == "https:" ? https : http;

View File

@ -5,7 +5,9 @@ define(function(require, exports, module) {
"session",
"db",
"c9.login",
"preview.handler"
"preview.handler",
"user-content.redirect",
"connect.remote-address"
];
main.provides = [];
return main;
@ -18,6 +20,7 @@ define(function(require, exports, module) {
var db = imports.db;
var ensureLoggedIn = imports["c9.login"].ensureLoggedIn();
var handler = imports["preview.handler"];
var userContent = imports["user-content.redirect"];
var frontdoor = require("frontdoor");
var error = require("http-error");
@ -34,6 +37,8 @@ define(function(require, exports, module) {
next();
});
api.use(userContent.redirectPreview());
session.use(api);
api.get("/:username/:projectname/:path*", {

View File

@ -44,6 +44,7 @@ define(function(require, exports, module) {
options.updateServers = false;
var strictRegion = query.region || options.strictRegion;
var ignoreProtocolVersion = options.ignoreProtocolVersion;
var region = strictRegion || options.region;
var servers;
@ -319,7 +320,7 @@ define(function(require, exports, module) {
return isBetaServer === isBetaClient;
});
servers = servers.filter(function(s) {
return s.version == undefined || s.version == version;
return ignoreProtocolVersion || s.version == undefined || s.version == version;
});
return servers.sort(function(a, b) {
if (a.region == b.region) {

View File

@ -246,6 +246,8 @@ define(function(require, exports, module) {
function showVfsError(err) {
switch (err.action) {
case "dashboard":
if (/Permission denied \(public key/.test(err.message))
err.message = "SSH permission denied. Please review your workspace configuration.";
return showAlert("Workspace Error", "Unable to access your workspace", err.message, function() {
window.location = dashboardUrl;
});

View File

@ -1,14 +1,18 @@
define(function(require, exports, module) {
"use strict";
main.consumes = ["Plugin", "vfs.connect"];
main.consumes = [
"Plugin",
"vfs.connect",
"metrics"
];
main.provides = ["vfs.cache"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var connectVfs = imports["vfs.connect"].connect;
var metrics = imports.metrics;
var async = require("async");
var uid = require("c9/uid");
@ -54,10 +58,12 @@ define(function(require, exports, module) {
if (err) return done(err);
entry.connectTime = Date.now() - entry.startTime;
metrics.timing("vfs.connect.time", entry.connectTime);
entry.emit("loaded");
cache[vfsid] = entry;
entry.keepalive();
vfs.on("destroy", function() {
remove(vfsid);
@ -126,7 +132,6 @@ define(function(require, exports, module) {
};
entry.keepalive = function() {
clearTimeout(timer);
startTimer();
};
@ -139,7 +144,6 @@ define(function(require, exports, module) {
}, maxAge);
}
startTimer();
return entry;
}

View File

@ -0,0 +1,106 @@
define(function(require, exports, module) {
"use strict";
main.consumes = ["Plugin", "vfs.cache", "connect"];
main.provides = ["vfs.fetchcache"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var cache = imports["vfs.cache"];
var error = require("http-error");
var Path = require("path");
var async = require("async");
/***** Initialization *****/
var plugin = new Plugin("Ajax.org", main.consumes);
var compress = imports.connect.getModule().compress();
cache.registerExtension(function(vfs, callback) {
var restful = vfs.restful.home;
vfs.restful.home = function(req, res, next) {
var path = unescape(req.uri.pathname);
if (req.method == "GET" && path.indexOf("/.c9/cache") === 0) {
compress(req, res, function(err) {
if (err) return next(err);
fetchcache(vfs.vfs, vfs.vfs.env.HOME, vfs.vfsOptions, req, res, next);
});
}
else
restful(req, res, next);
};
callback();
});
function readFile(vfs, path, callback) {
vfs.readfile(path, { encoding: "utf8" }, function(err, meta) {
if (err)
return callback(err);
var data = "";
meta.stream.on("data", function(d) {
data += d;
})
var done;
meta.stream.on("error", function(e) {
if (done) return;
done = true;
callback(e);
});
meta.stream.on("end", function() {
if (done) return;
done = true;
callback(null, data);
});
});
}
function fetchcache(vfs, root, vfsOptions, req, res, next) {
var path = unescape(req.uri.pathname);
// sandbox path to workspaceDir
path = Path.join(root, path);
// if (path.indexOf(root) !== 0)
// return next(new error.Forbidden("Can't list files outside of the workspace"));
// Fetch index
readFile(vfs, Path.join(path, "index"), function(err, list){
if (err) {
var httpErr = new error.NotFound(err.message);
return next(httpErr);
}
// Fetch each file in the index
async.mapLimit(list.split("\n"), 50, function(p, callback){
readFile(vfs, Path.join(path, p.replace(/\//g, "\\")), function(ignore, data){
var json;
try { json = JSON.parse(data); }
catch(e) { json = { type: "file", path: p } }
callback(null, json);
});
}, function(ignore, results){
res.writeHead(200, { "Content-Type": "text/json" });
res.write(JSON.stringify(results));
res.end();
});
});
}
plugin.freezePublicAPI({
// for testing only
fetchcache: fetchcache
});
register(null, { "vfs.fetchcache" : plugin });
}
});

View File

@ -36,7 +36,6 @@ function plugin(options, imports, register) {
var connect = imports.connect;
var render = imports["connect.render"];
var analytics = imports["analytics"];
var async = require("async");
var Types = require("frontdoor").Types;
var error = require("http-error");
@ -327,15 +326,6 @@ function plugin(options, imports, register) {
if (new Date(user.lastVfsAccess).getDate() != new Date().getDate() ||
Date.now() > user.lastVfsAccess + VFS_ACTIVITY_WINDOW) {
// Keeping this temporarily to be replaced by API request only
async.series([
analytics.aliasClean.bind(analytics, req.cookies.mixpanelAnonymousId, user.id),
analytics.identifyClean.bind(analytics, user, {}),
analytics.trackClean.bind(analytics, user, "VFS is active", { uid: user.id }),
], function(err) {
if (err) return console.log("Error logging activity", err.stack || err);
});
analytics.superagent && analytics.superagent
.post(options.apiBaseUrl + "/metric/usage/" + req.params.pid + "?access_token=" + req.query.access_token)
.end(function() {});

View File

@ -23,14 +23,13 @@ var DEFAULT_CONFIG = "s";
var DEFAULT_SETTINGS = getDefaultSettings();
var shortcuts = {
"dev" : ["ide", "preview", "vfs", "api", "sapi", "proxy", "redis", "profile", "oldclient", "homepage", "apps-proxy", "-s", "devel"],
"odev" : ["ide", "preview", "vfs", "api", "proxy", "oldclient", "homepage", "apps-proxy", "profile", "worker", "-s", "onlinedev"],
"bill" : ["ide", "preview", "vfs", "api", "proxy", "oldclient", "homepage", "apps-proxy", "profile", "-s", "billing"],
"beta" : ["ide", "preview", "vfs", "proxy", "-s", "beta"],
"ci" : ["ide", "preview", "vfs", "proxy", "-s", "ci"],
"s" : ["standalone", "-s", "standalone"]
"dev": ["ide", "preview", "user-content", "vfs", "api", "sapi", "proxy", "redis", "profile", "oldclient", "homepage", "apps-proxy", "-s", "devel"],
"onlinedev": ["ide", "preview", "user-content", "vfs", "api", "proxy", "oldclient", "homepage", "apps-proxy", "profile", "worker", "-s", "onlinedev"],
"beta": ["ide", "preview", "user-content", "vfs", "proxy", "-s", "beta"],
"s": ["standalone", "-s", "standalone"]
};
var delayLoadConfigs = ["preview", "api", "oldclient", "apps-proxy", "worker"];
shortcuts.odev = shortcuts.onlinedev; // For backwards compatibility, if you see this in 2016 remove this line
var delayLoadConfigs = ["preview", "user-content", "api", "oldclient", "apps-proxy", "worker"];
module.exports = main;
@ -42,6 +41,7 @@ function getDefaultSettings() {
var suffix = hostname.trim().split("-").pop() || "";
var modes = {
"workflowstaging": "workflow-staging",
"prod": "deploy",
"beta": "beta",
"dev": "devel",

View File

@ -47,9 +47,9 @@ module.exports = function(manifest, installPath, settingDir) {
// config.update.port = "8888"
// config.update.host = "http"
config.nodeBin = [process.platform == "win32"
? path.join(process.execPath, "..\\node.exe")
: path.join(installPath, "node/bin/node")];
// config.nodeBin = [process.platform == "win32"
// ? path.join(process.execPath, "..\\node.exe")
// : path.join(installPath, "node/bin/node")];
config.bashBin = process.platform == "win32"
? process.env.C9_BASH_BIN || "C:\\cygwin\\bin\\bash.exe"
: "/bin/bash";