Merge pull request +6765 from c9/sdk

New installer that manages dependencies for plugins
pull/64/head
Harutyun Amirjanyan 2015-04-09 20:10:00 +04:00
commit b56e28cc3a
24 zmienionych plików z 294 dodań i 82 usunięć

Wyświetl plik

@ -1,6 +1,5 @@
var assert = require("assert");
module.exports = function(options) {
assert(options.staticPrefix, "Option 'staticPrefix' must be set");
assert(options.workspaceDir, "Option 'workspaceDir' must be set");
@ -47,6 +46,7 @@ module.exports = function(options) {
env: options.env || "devel",
home: options.home,
platform: options.platform,
arch: options.arch,
installed: options.installed,
projectId: options.project.id,
projectName: options.projectName || "Project",
@ -92,7 +92,6 @@ module.exports = function(options) {
"plugins/c9.vfs.client/vfs.ping",
{
packagePath: "plugins/c9.vfs.client/vfs_client",
withInstall: false,
debug: debug,
installPath: options.installPath,
dashboardUrl: options.dashboardUrl,
@ -223,7 +222,10 @@ module.exports = function(options) {
autoInit: !options.local
},
"plugins/c9.ide.ui/forms",
"plugins/c9.ide.ui/widgets.list",
{
packagePath: "plugins/c9.ide.ui/widgets.list",
staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic"
},
"plugins/c9.ide.ui/widgets.tree",
"plugins/c9.ide.ui/widgets.datagrid",
"plugins/c9.ide.ui/focus",
@ -495,7 +497,28 @@ module.exports = function(options) {
},
"plugins/c9.ide.panels/panel",
"plugins/c9.ide.panels/area",
"plugins/c9.ide.installer/installer_mock",
// Installer
{
packagePath: "plugins/c9.ide.installer/gui",
staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic",
},
"plugins/c9.automate/automate",
"plugins/c9.ide.installer/commands/centos",
"plugins/c9.ide.installer/commands/bash",
"plugins/c9.ide.installer/commands/npm",
"plugins/c9.ide.installer/commands/symlink",
{
packagePath: "plugins/c9.ide.installer/commands/tar.gz",
bashBin: options.bashBin
},
"plugins/c9.ide.installer/commands/ubuntu",
{
packagePath: "plugins/c9.ide.installer/installer",
homeDir: options.homeDir,
installSelfCheck: true,
installPath: options.installPath
},
// Previewer
{

Wyświetl plik

@ -139,6 +139,7 @@ module.exports = function(config, optimist) {
whitelist: {
"c9.core": true,
"c9.fs": true,
"c9.automate": true,
"c9.login.client": true,
"c9.vfs.client": true,
"c9.cli.bridge": true,

Wyświetl plik

@ -319,7 +319,6 @@ var DataProvider = function(root) {
index = Math.min(Math.max(0, index), this.visibleItems.length - 1);
return this.visibleItems[index];
};
this.getIconHTML = function(node) {
return "";
};

Wyświetl plik

@ -98,6 +98,7 @@ var Cells = function(parentEl) {
? (provider.isOpen(datarow) ? "open" : "closed")
: "empty")
+ "'></span>"
+ (provider.getCheckboxHTML ? provider.getCheckboxHTML(datarow) : "")
+ provider.getIconHTML(datarow)
+ ( provider.getContentHTML ? provider.getContentHTML(datarow)
: "<span class='caption' style='width: " + hsize + "px;height: " + vsize + "px'>"

Wyświetl plik

@ -136,6 +136,14 @@ function DefaultHandlers(mouseHandler) {
}
}
this.$clickNode = null;
} else if (dom.hasCssClass(target, "checkbox")) {
node.isChecked = !node.isChecked;
if (inSelection) {
var nodes = editor.selection.getSelectedNodes();
nodes.forEach(function(n){ n.isChecked = node.isChecked });
}
provider._signal(node.isChecked ? "check" : "uncheck", inSelection ? nodes : [node]);
provider._signal("change")
} else if (dom.hasCssClass(target, "icon-ok")) {
if (ev.getShiftKey()) {
editor.selection.expandSelection(node, null, true);

Wyświetl plik

@ -60,9 +60,9 @@
"c9.ide.language.javascript.tern": "#7aab8b0b6a",
"c9.ide.language.javascript.infer": "#ebb2daf81a",
"c9.ide.language.jsonalyzer": "#efa4426f1f",
"c9.ide.collab": "#7009f69cb0",
"c9.ide.collab": "#12f18e8225",
"c9.ide.local": "#2bfd7ff051",
"c9.ide.find": "#989c06e6a7",
"c9.ide.find": "#9fc6f4cfa5",
"c9.ide.find.infiles": "#1b83cf12f1",
"c9.ide.find.replace": "#e4daf722b8",
"c9.ide.run.debug": "#638e6b00b3",
@ -77,13 +77,13 @@
"c9.ide.behaviors": "#6aad7006a0",
"c9.ide.closeconfirmation": "#a28bfd8272",
"c9.ide.configuration": "#b8470f4107",
"c9.ide.dialog.wizard": "#a588b64050",
"c9.ide.dialog.wizard": "#c6401bdd13",
"c9.ide.fontawesome": "#781602c5d8",
"c9.ide.format": "#f51451ac57",
"c9.ide.help.support": "#60e88f5680",
"c9.ide.imgeditor": "#08bbc53578",
"c9.ide.immediate": "#6845a93705",
"c9.ide.installer": "#24e7d6f399",
"c9.ide.installer": "#0225321789",
"c9.ide.mount": "#32e79866ee",
"c9.ide.navigate": "#64156c7f4a",
"c9.ide.newresource": "#9a7464cc47",

Wyświetl plik

@ -740,10 +740,29 @@ define(function(require, exports, module) {
var err = code !== 0
? new Error("Failed to unpack package")
: null;
if (err) return callback(err);
// Done
callback(err, {
version: version
proc.spawn(join(process.env.HOME, ".c9/node/bin/npm"), {
args: ["install"],
cwd: packagePath
}, function(err, p){
if (err) return callback(err);
if (verbose) {
p.stdout.on("data", function(c){
process.stdout.write(c.toString("utf8"));
});
p.stderr.on("data", function(c){
process.stderr.write(c.toString("utf8"));
});
}
p.on("exit", function(code){
// Done
callback(err, {
version: version
});
});
});
});
});

Wyświetl plik

@ -24,6 +24,7 @@ define(function(require, module, exports) {
var loaded = false;
var loggedIn = false;
var isReady = false;
var state = 0;
var STORAGE = 1 << 1;
@ -109,6 +110,7 @@ define(function(require, module, exports) {
}
function ready(){
isReady = true;
emit.sticky("ready");
}
@ -284,6 +286,10 @@ define(function(require, module, exports) {
*/
get startLoadTime(){ return startLoadTime; },
set startLoadTime(v){ startLoadTime = v; },
/**
*
*/
get isReady(){ return isReady; },
_events: [
/**

Wyświetl plik

@ -7,11 +7,14 @@ define(function(require, exports, module) {
var vfs = imports.vfs;
var Plugin = imports.Plugin;
var ProcessToPty = require("./proc2pty");
/***** Initialization *****/
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var installMode;
var tmuxName = options.tmuxName;
/***** Register and define API *****/
@ -171,6 +174,15 @@ define(function(require, exports, module) {
* @singleton
**/
plugin.freezePublicAPI({
/**
* @ignore
*/
get installMode(){ return installMode; },
set installMode(_vfs) {
vfs = _vfs || imports.vfs;
installMode = _vfs ? true : false;
},
_events: [
/**
* @event beforeSpawn Fires right before a file is executed
@ -334,6 +346,14 @@ define(function(require, exports, module) {
* @fires afterPty
*/
pty: function(path, options, callback) {
if (installMode) {
plugin.spawn(path, options, function(err, process){
if (err) return callback(err);
callback(null, new ProcessToPty(process));
});
return;
}
emit("beforePty", {path: path, options: options});
if (!options.encoding)

Wyświetl plik

@ -0,0 +1,27 @@
define(function(require, exports, module) {
var EventEmitter = require("events").EventEmitter;
module.exports = function(process){
var pty = new EventEmitter();
pty.write = function(data){
process.stdin.write(data);
};
pty.resize = function(){};
pty.destroy =
pty.end = function(){
process.kill();
};
process.stdout.on("data", function(chunk){
pty.emit("data", chunk);
});
process.stderr.on("data", function(chunk){
pty.emit("data", chunk);
});
process.on("exit", function(code){
pty.emit("exit", code);
});
return pty;
}
});

Wyświetl plik

@ -67,26 +67,21 @@ define(function(require, module, exports) {
var left = options.left;
var top = options.top;
var width = options.width || 512;
var height = options.height;
var title = options.title;
var heading = options.heading;
var body = options.body;
var custom = options.custom;
var className = options.class;
var modal = options.modal;
var zindex = options.zindex;
var allowClose = options.allowClose;
var elements = options.elements || [];
var resizable = options.resizable || false;
var resizable = false;
var widths = options.widths || {};
var count = 0;
var dialog, buttons, titles;
var loaded;
function load(){
if (loaded) return;
loaded = true;
}
var drawn = false;
function draw(htmlNode) {
if (drawn) return;
@ -101,9 +96,13 @@ define(function(require, module, exports) {
modal: modal,
buttons: allowClose ? "close" : "",
width: width,
height: height,
zindex: zindex || "",
skin: "bk-window2",
class: "relative" + (options.dark ? " dark" : ""),
class: "dialog "
+ (height ? "" : "relative")
+ (options.dark ? " dark" : "")
+ (className ? " " + className : ""),
childNodes: [
new ui.vbox({
id: "titles",
@ -162,8 +161,8 @@ define(function(require, module, exports) {
html: titles.$int
});
if (resizable)
plugin.resizable = resizable;
if (options.resizable)
plugin.resizable = options.resizable;
}
/***** Method *****/
@ -359,6 +358,11 @@ define(function(require, module, exports) {
return node;
}
plugin.on("unload", function(){
drawn = false;
resizable = false;
});
/***** Register and define API *****/
plugin.freezePublicAPI.baseclass();
@ -437,13 +441,20 @@ define(function(require, module, exports) {
resizable = v;
if (!dialog) return;
dialog.setAttribute("height", v ? dialog.getHeight() : "");
dialog.setAttribute("width", v ? dialog.getWidth() : "");
dialog.setAttribute("class", v ? "" : "relative");
titles.setAttribute("anchors", v ? "0 0 46 0" : "");
buttons.setAttribute("bottom", v ? "0" : "");
buttons.setAttribute("left", v ? "0" : "");
buttons.setAttribute("right", v ? "0" : "");
if (!height)
dialog.setAttribute("height", v ? dialog.getHeight() : "");
if (!width)
dialog.setAttribute("width", v ? dialog.getWidth() : "");
dialog.setAttribute("class", "dialog "
+ (v ? "" : "relative")
+ (options.dark ? " dark" : "")
+ (className ? " " + className : ""));
// titles.setAttribute("anchors", v ? "0 0 46 0" : "");
// buttons.setAttribute("bottom", v ? "0" : "");
// buttons.setAttribute("left", v ? "0" : "");
// buttons.setAttribute("right", v ? "0" : "");
dialog.setAttribute("resizable", v);
},
/**
@ -465,6 +476,11 @@ define(function(require, module, exports) {
* @readonly
*/
get modal(){ return modal; },
/**
* @property {Boolean} visible
* @readonly
*/
get visible(){ return dialog && dialog.visible; },
/**
* @property {Boolean} allowClose
*/

Wyświetl plik

@ -129,4 +129,21 @@
right: 20px;
top: 25px;
}
.bk-window.dialog .bk-container{
display: flex;
flex-direction: column;
}
.bk-window.dialog .bk-container > div:first-child{
flex: 1;
position: relative;
}
.bk-window.wizard .bk-container > div:first-child > div{
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
padding: 20px;
}

Wyświetl plik

@ -1599,11 +1599,11 @@
// Installer
@installer-font-smoothing: true;
@installer-background: #272727;
@installer-border-top: 1px solid rgba(255, 255, 255, 0.1);
@installer-box-shadow: 0 -1px black;
@installer-color: rgb(182, 182, 182);
@installer-text-shadow: 1px 1px 0 rgb(10, 10, 10);
@installer-background: transparent;
@installer-border-top: 0;
@installer-box-shadow: none;
@installer-color: #333;
@installer-text-shadow: none;
@installer-font-family: Arial;
@installer-log-color: #fff;
@ -1612,7 +1612,7 @@
@installer-log-border-color: rgba(255,255,255,0.06) rgba(0,0,0,0.3) rgba(0,0,0,0.3) rgba(255,255,255,0.06);
@installer-log-border-radius: 0;
@installer-log-box-shadow: 1px 0 0 rgba(255,255,255,0.06), 0 1px 0 rgba(255,255,255,0.06), -1px 0 0 rgba(0,0,0,0.3), 0 -1px 0 rgba(0,0,0,0.3);
@installer-log-checkbox-color: #f1f1f1;
@installer-log-checkbox-color: #333;
@installer-log-progress-color: white;
// Notification

Wyświetl plik

@ -1599,11 +1599,11 @@
// Installer
@installer-font-smoothing: true;
@installer-background: #272727;
@installer-border-top: 1px solid rgba(255, 255, 255, 0.1);
@installer-box-shadow: 0 -1px black;
@installer-color: rgb(182, 182, 182);
@installer-text-shadow: 1px 1px 0 rgb(10, 10, 10);
@installer-background: transparent;
@installer-border-top: 0;
@installer-box-shadow: none;
@installer-color: #333;
@installer-text-shadow: none;
@installer-font-family: Arial;
@installer-log-color: #fff;
@ -1612,7 +1612,7 @@
@installer-log-border-color: rgba(255,255,255,0.06) rgba(0,0,0,0.3) rgba(0,0,0,0.3) rgba(255,255,255,0.06);
@installer-log-border-radius: 0;
@installer-log-box-shadow: 1px 0 0 rgba(255,255,255,0.06), 0 1px 0 rgba(255,255,255,0.06), -1px 0 0 rgba(0,0,0,0.3), 0 -1px 0 rgba(0,0,0,0.3);
@installer-log-checkbox-color: #f1f1f1;
@installer-log-checkbox-color: #333;
@installer-log-progress-color: white;
// Notification

Wyświetl plik

@ -390,6 +390,27 @@
padding : 5px 3px 1px 5px;
}
.ace_tree .tree-row .checkbox{
outline: 1px solid rgba(0, 0, 0, 0.16);
background: white;
width: 13px;
height: 13px;
margin: -2px 5px 0 0px;
display: inline-block;
vertical-align: middle;
pointer-events: auto;
}
.ace_tree .tree-row .checkbox.checked{
background-position: -2px -2px;
}
.ace_tree .tree-row .checkbox.half-checked{
background-color: #DDDDDD;
background-position: -2px -2px;
}
.installer .execute .progress{
bottom: -44px;
}
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 1.25dppx) {
.listBP .checked .checkbox {
background-position: 0px -61px !important;

@ -1 +0,0 @@
Subproject commit 35a5dedaeb20cf6f8a9f1021de23d8dd96860f11

Wyświetl plik

@ -778,7 +778,7 @@ define(function(require, exports, module) {
+ "installed. Would you like to open the installer "
+ "to update to the latest version?",
function(){ // Yes
installer.show();
installer.reinstall("Cloud9 IDE");
},
function(){ // No
// Do nothing

Wyświetl plik

@ -16,9 +16,10 @@ define(function(require, exports, module) {
if (!options) throw new Error("options are required");
if (!options.baseName)
options.baseName = "tree";
options.baseName = "datagrid";
if (!options.theme)
options.theme = "blackdg";
options.theme = "blackdg ace-tree-" + (options.baseName || "datagrid");
var model = new TreeModel();
model.columns = options.columns;

Wyświetl plik

@ -1,7 +1,7 @@
.custom-tree.ace_tree {
background: transparent;
border: none;
font: 11px Tahoma, Arial;
// font: @general-font-size @general-font-family;
.font-smoothing(@tree-font-smoothing)
}
@ -43,6 +43,25 @@
line-height: 1.5em;
}
.ace_tree .tree-row .checkbox{
outline: 1px solid rgba(255, 255, 255, 0.35);
background: #2D2D2D;
width: 13px;
height: 13px;
margin: 1px 5px 0 0px;
display: inline-block;
vertical-align: middle;
pointer-events: auto;
}
.ace_tree .tree-row .checkbox.checked{
background-image: url("@{image-path}/@{menu-check}");
background-position: -2px -18px;
}
.ace_tree .tree-row .checkbox.half-checked{
background-color: #565656;
background-position: -2px -18px;
}
.custom-tree.ace_tree .tree-row .toggler{
.image-2x("@{tree-arrow}", 20px, 10px);
margin: 0 1px 0 0;

Wyświetl plik

@ -19,7 +19,7 @@ define(function(require, exports, module) {
};
ui.on("load", function(){
ui.insertCss(require("text!./widgets.less"), ui);
ui.insertCss(require("text!./widgets.less"), options.staticPrefix, ui);
});
/***** Constructors *****/
@ -56,6 +56,7 @@ define(function(require, exports, module) {
? new TreeModel()
: new ListModel());
model.filterCaseInsensitive = true;
model.$sortNodes = false;
if (!options.rowHeight)
options.rowHeight = 23;
@ -80,12 +81,14 @@ define(function(require, exports, module) {
scrollbarVisibilityChanged: acetree.renderer,
resize: acetree.renderer,
expand: model,
collapse: model
collapse: model,
check: model,
uncheck: model
};
emit.sticky("draw");
}
plugin.on("load", function(){
if (options.container)
plugin.attachTo(options.container);
@ -254,6 +257,35 @@ define(function(require, exports, module) {
? new AceTreeEditor(acetree)
: null;
},
/**
*
*/
get enableCheckboxes(){ return model.getCheckboxHTML ? true : false; },
set enableCheckboxes(value){
model.getCheckboxHTML = value
? function(node){
return "<span class='checkbox "
+ (node.isChecked == -1
? "half-checked "
: (node.isChecked ? "checked " : ""))
+ "'></span>";
}
: null;
if (value) {
acetree.commands.bindKey("Space", function(e) {
var nodes = acetree.selection.getSelectedNodes();
var node = acetree.selection.getCursor();
node.isChecked = !node.isChecked;
nodes.forEach(function(n){ n.isChecked = node.isChecked });
model._signal(node.isChecked ? "check" : "uncheck", nodes);
model._signal("change");
});
}
else {
acetree.commands.bindKey("Space", null);
}
},
/**
*
*/
@ -339,11 +371,16 @@ define(function(require, exports, module) {
*/
get getIconHTML(){ return model.getIconHTML; },
set getIconHTML(fn){ model.getIconHTML = fn; },
/**
*
*/
get getCheckboxHTML(){ return model.getCheckboxHTML; },
set getCheckboxHTML(fn){ model.getCheckboxHTML = fn; },
/**
*
*/
get sort(){ return model.sort; },
set sort(fn){
set sort(fn){ debugger;
model.$sortNodes = fn ? true : false;
model.$sorted = fn ? true : false;
model.sort = fn;
@ -417,6 +454,14 @@ define(function(require, exports, module) {
* @event afterRename Fires
*/
"afterRename",
/**
* @event check Fires
*/
"check",
/**
* @event uncheck Fires
*/
"uncheck",
/**
* @event select Fires
*/
@ -494,6 +539,22 @@ define(function(require, exports, module) {
disable: function(){
return acetree.enable();
},
/**
*
*/
check: function(node, half){
node.isChecked = half ? -1 : true;
model._signal("check", node);
model._signal("change");
},
/**
*
*/
uncheck: function(node){
node.isChecked = false;
model._signal("uncheck", node);
model._signal("change");
},
/**
*
*/

Wyświetl plik

@ -1,9 +1,3 @@
/**
* Smith.io client
*
* @copyright 2013, Ajax.org B.V.
*/
define(function(require, exports, module) {
"use strict";
@ -58,7 +52,6 @@ define(function(require, exports, module) {
errorDialog.vfs = plugin;
var buffer = [];
var installChecked = false;
var withInstall = options.withInstall;
var dashboardUrl = options.dashboardUrl;
var region, vfsBaseUrl, homeUrl, projectUrl, pingUrl, serviceUrl;
@ -287,13 +280,8 @@ define(function(require, exports, module) {
return;
}
if (!installChecked) {
checkInstall(_vfs, callback);
installChecked = true;
}
else {
if (emit("beforeConnect", { done: callback, vfs: _vfs }) !== false)
callback();
}
function callback(shouldReconnect) {
if (shouldReconnect) {
@ -320,19 +308,6 @@ define(function(require, exports, module) {
});
}
function checkInstall(vfs, callback) {
if (!withInstall)
return callback(false);
vfs.stat(options.installPath + "/installed", {}, function(err, stat) {
if (err && err.code == "ENOENT") {
emit.sticky("install", { callback: callback, vfs: vfs });
}
else
callback();
});
}
var bufferedVfsCalls = [];
function vfsCall(method, path, options, callback) {
if (Array.isArray(method))
@ -354,7 +329,6 @@ define(function(require, exports, module) {
id = null;
buffer = [];
installChecked = false;
region = null;
vfsBaseUrl = null;
homeUrl = null;

Wyświetl plik

@ -35,6 +35,7 @@
app.on("ready", function(){
// if (app.services.c9.debug)
window.app = app.services;
app.services.c9.ready();
});
});
});

Wyświetl plik

@ -400,6 +400,7 @@ require([
console.warn(msg);
}
},
"installer": { createSession : function(){}, reinstall: function(){} },
"run.gui": { getElement : function(){} },
"debugger": {debug: function() {}, stop: function(){}},
"focusManager": {
@ -412,9 +413,6 @@ require([
getLastest: function() { throw Error("Not implemented"); },
},
error_handler: {reportError: function(){}},
installer: {
show: function(){}
},
proc: {
execFile: function() {},
spawn: function() {}

Wyświetl plik

@ -44,6 +44,7 @@ module.exports = function(manifest, installPath) {
host: process.env.IP || "0.0.0.0",
testing: false,
platform: process.platform,
arch: process.arch,
tmux: path.join(installPath, "bin/tmux"),
nakBin: path.join(__dirname, "../node_modules/nak/bin/nak"),
bashBin: "bash",