Skip to content

Instantly share code, notes, and snippets.

@bmatusiak
Last active December 16, 2015 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmatusiak/5462526 to your computer and use it in GitHub Desktop.
Save bmatusiak/5462526 to your computer and use it in GitHub Desktop.

for node-webkit to start cloud9..

  • webkitApp/package.json
  • webkitApp/nw-cloud9.html
  • webkitApp/cloud9/Built Files

edit htmt file to change workspace dir.. defaults to process.HOME

Dont package the node-webkit app.. a full build of cloud9 is +300mb and node-webkit unpacks this before running this if its built.. so run this as a Folder

nw  ~/cloud9-nw
<html>
<head>
</head>
<body>
<script>
var gui = require('nw.gui');
var win;
var spawn = require('child_process').spawn;
var c9Proc = spawn('node', ['cloud9/server.js','-w', process.env.HOME]);
c9Proc.stdout.on('data', function (data) {
console.log('stdout: ' + data);
if(data.toString().indexOf("IDE server initialized") >= 0){
openCloud9();
}
});
c9Proc.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
gui.Window.get().on('close', function() {
c9Proc.kill();
if (win != null)
win.close(true);
this.close(true);
});
c9Proc.on('close', function (code) {
console.log('child process exited with code ' + code);
//process.kill(process.pid);
});
process.on('exit', function() {
c9Proc.kill();
console.log("node-webkit Exit!")
});
//start cloud9 process
function openCloud9(){
win = gui.Window.open('http://localhost:3131/',{
"toolbar": false
});
win.on("close",function(){
gui.Window.get().close();
})
}
</script>
</body>
</html>
{
"name": "nw-test",
"main": "nw-cloud9.html",
"window": {
"title": "Cloud9 Start Window",
"toolbar": true,
"show": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment