diff --git a/plugins/c9.cli.publish/publish.js b/plugins/c9.cli.publish/publish.js index af65de81..1b6b953f 100644 --- a/plugins/c9.cli.publish/publish.js +++ b/plugins/c9.cli.publish/publish.js @@ -551,6 +551,14 @@ define(function(require, exports, module) { }); } + if (json.installer) { + extraCode.push({ + type: "installer", + filename: json.installer.main, + data: json.installer.version + }); + } + if (!extraCode.length) return next(); @@ -602,7 +610,6 @@ define(function(require, exports, module) { var additional = []; var packedConfig = config.slice(); if (staticPlugin) { - console.log(packedConfig) additional.push(staticPlugin); packedConfig.push(staticPlugin.id); } diff --git a/plugins/c9.ide.plugins/debug.js b/plugins/c9.ide.plugins/debug.js index 92456944..adcb4f33 100644 --- a/plugins/c9.ide.plugins/debug.js +++ b/plugins/c9.ide.plugins/debug.js @@ -123,6 +123,7 @@ define(function(require, exports, module) { return; } + var resourceHolder = new Plugin(); // Fetch package.json async.parallel([ function(next){ @@ -142,17 +143,6 @@ define(function(require, exports, module) { var host = vfs.baseUrl + "/"; var base = join(String(c9.projectId), "plugins", auth.accessToken); - - // Start the installer if one is included - if (options.installer) { - var version = options.installer.version; - var url = host + join(base, name, options.installer.main); - installer.createVersion(name, version, function(v, o){ - require([url], function(fn){ - fn(v, o); - }); - }); - } var pathConfig = {}; @@ -173,6 +163,12 @@ define(function(require, exports, module) { requirejs.config({paths: pathConfig}); + // Start the installer if one is included + if (options.installer) { + addStaticPlugin("installer", name, options.installer.main, + options.installer.version, resourceHolder); + } + next(); }); }, @@ -191,7 +187,7 @@ define(function(require, exports, module) { data = data.replace(rePath, ""); // Process all the submodules - var parallel = processModules(path, data); + var parallel = processModules(path, data, resourceHolder); async.parallel(parallel, function(err, data){ if (err) return next(err); @@ -228,11 +224,9 @@ define(function(require, exports, module) { list.forEach(next); } - function processModules(path, data){ + function processModules(path, data, plugin){ var parallel = []; - var placeholder = new Plugin(); - data.split("\n").forEach(function(line){ if (!line.match(reParts)) return; @@ -250,7 +244,7 @@ define(function(require, exports, module) { return next(err); } - addStaticPlugin(type, path, filename, data, placeholder); + addStaticPlugin(type, path, filename, data, plugin); next(); }); @@ -312,6 +306,12 @@ define(function(require, exports, module) { case "templates": services.newresource.addFileTemplate(data, plugin); break; + case "installer": + installer.createSession(pluginName, data, function(v, o){ + require([path], function(fn){ + fn(v, o); + }); + }); } } diff --git a/plugins/c9.ide.plugins/mock/c9.ide.example3/install.js b/plugins/c9.ide.plugins/mock/c9.ide.example3/install.js new file mode 100644 index 00000000..c8fbc352 --- /dev/null +++ b/plugins/c9.ide.plugins/mock/c9.ide.example3/install.js @@ -0,0 +1,57 @@ +define(function(require, exports, module) { + +module.exports = function(session, options){ + // Dependencies for the collaboration features of Cloud9 + + session.install({ + "name": "SQLite", + "description": "SQLite Database and NPM module", + "cwd": "~/.c9", + "optional": true + }, [ + { + "npm": ["sqlite3@2.1.18"] + }, + { + "tar.gz": { + "url": "https://raw.githubusercontent.com/c9/install/master/packages/sqlite3/linux/sqlite3.tar.gz", + "target": "~/.c9/lib/sqlite3", + "dir": "sqlite3" + } + }, + { + "symlink": { + "source": "~/.c9/lib/sqlite3/sqlite3", + "target": "~/.c9/bin/sqlite3" + } + } + ]); + + session.install({ + "name": "Sequalize", + "description": "Sequalize NPM module", + "cwd": "~/.c9", + "optional": true + }, { + "npm": ["sequelize@2.0.0-beta.0"] + }); + + session.install({ + "name": "Collab Server", + "description": "A small Node.js collaboration server", + "cwd": "~/.c9", + "optional": true + }, { + "tar.gz": { + "url": "https://raw.githubusercontent.com/c9/install/master/packages/extend/c9-vfs-extend.tar.gz", + "target": "~/.c9" + } + }); + + // Show the installation screen + session.start(); +}; + +module.exports.version = 1; + +}); \ No newline at end of file diff --git a/plugins/c9.ide.plugins/mock/c9.ide.example3/package.json b/plugins/c9.ide.plugins/mock/c9.ide.example3/package.json new file mode 100644 index 00000000..4560bfb3 --- /dev/null +++ b/plugins/c9.ide.plugins/mock/c9.ide.example3/package.json @@ -0,0 +1,27 @@ +{ + "name": "c9.ide.example3", + "description": "Cloud9 Custom Example Plguin", + "version": "1.3.0", + "author": "Ajax.org B.V. ", + "contributors": [ + { + "name": "Ruben Daniels", + "email": "ruben@c9.io" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/c9/newclient.git" + }, + "plugins": { + "example": {} + }, + "installer": { + "main": "install.js", + "version": 1 + }, + "categories": [ + "misc" + ], + "licenses": [] +} \ No newline at end of file