diff --git a/README.md b/README.md index e04a3bd3..2698a145 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ https://groups.google.com/forum/#!forum/cloud9-sdk Follow these steps to install the SDK: - git clone git@github.com:c9/core.git c9sdk + git clone git://github.com/c9/core.git c9sdk cd c9sdk scripts/install-sdk.sh diff --git a/build/build-local.sh b/build/build-local.sh index 4f85a5f2..20779115 100755 --- a/build/build-local.sh +++ b/build/build-local.sh @@ -19,6 +19,7 @@ case "$uname" in FreeBSD\ *) os=freebsd ;; CYGWIN*) os=windows ;; MINGW*) os=windows ;; + MSYS_NT*) os=windows ;; esac case "$uname" in *x86_64*) arch=x64 ;; diff --git a/build/build-standalone.sh b/build/build-standalone.sh index bda190f1..59a058d2 100755 --- a/build/build-standalone.sh +++ b/build/build-standalone.sh @@ -19,6 +19,7 @@ case "$uname" in FreeBSD\ *) os=freebsd ;; CYGWIN*) os=windows ;; MINGW*) os=windows ;; + MSYS_NT*) os=windows ;; esac case "$uname" in *x86_64*) arch=x64 ;; diff --git a/local/server.js b/local/server.js index 707e8137..ed2ea053 100644 --- a/local/server.js +++ b/local/server.js @@ -9,7 +9,7 @@ if (process.platform == "win32") { if (!process.env.HOME) process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH; // add cloud9 cygwin to path - var msysBin = join(process.execPath, "/../../msys/bin"); + var msysBin = join(process.env.HOME, ".c9", "msys/bin"); process.env.Path = msysBin + ";" + process.env.path; process.env.C9_BASH_BIN = msysBin + "/bash.exe"; process.env.CYGWIN = "nodosfilewarning " + (process.env.CYGWIN || ""); @@ -34,7 +34,7 @@ if (installPath === "/Library/Application Support/Cloud9" installPath = join(process.env.HOME, installPath); var nodePath = process.platform == "win32" - ? join(process.execPath, "..\\node.exe") + ? join(installPath, "node.exe") : installPath + "/node/bin/node"; var logStream; diff --git a/node_modules/amd-loader/.gitignore b/node_modules/amd-loader/.gitignore new file mode 100644 index 00000000..69d39625 --- /dev/null +++ b/node_modules/amd-loader/.gitignore @@ -0,0 +1,3 @@ +.c9revisions/ +amd-loader-*.tgz +package/ diff --git a/node_modules/amd-loader/.npmignore b/node_modules/amd-loader/.npmignore new file mode 100644 index 00000000..a8a239c1 --- /dev/null +++ b/node_modules/amd-loader/.npmignore @@ -0,0 +1,4 @@ +.git/ +.c9revisions/ +package/ +amd-loader-*.tgz diff --git a/node_modules/amd-loader/.travis.yml b/node_modules/amd-loader/.travis.yml new file mode 100644 index 00000000..1cf67b79 --- /dev/null +++ b/node_modules/amd-loader/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 0.4 + - 0.5 + - 0.6 + - 0.10 \ No newline at end of file diff --git a/node_modules/amd-loader/LICENSE b/node_modules/amd-loader/LICENSE new file mode 100644 index 00000000..8b70a601 --- /dev/null +++ b/node_modules/amd-loader/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010 ajax.org B.V (Fabian Jakobs) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/amd-loader/README.md b/node_modules/amd-loader/README.md new file mode 100644 index 00000000..82d7c060 --- /dev/null +++ b/node_modules/amd-loader/README.md @@ -0,0 +1,73 @@ +AMD loader for node.js +====================== + +node-amd-loader adds the capability to load unmodified AMD (Asynchronous Module DefinitionAsynchronous Module Definition) from node.js applications. + +Installation +------------ + +`node-amd-loader` can be easily installed using [npm](http://npmjs.org). + + npm install amd-loader + +Before being able to load AMD modules the `amd-loader` module has to be required. + + require("amd-loader"); + +This needs to be done only once. + +Features +-------- + +### load modules which use AMD define() ### + +Load modules which are written using AMD [define](http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition#define.28.29_function) from node.js node. + +amd.js + +```javascript + define(function(require, exports, module) { + exports.B = "B"; + }); +``` + +main.js + +``` + require("amd-loader"); + var amd = require("./amd"); +``` + +### support requireJS asyncronous loading syntax ### + +From within an AMD modules the async require syntax introduced by [requireJS](http://requirejs.org) can be used. + +```javascript + require(["fs"], function(fs) { + fs.readFile(...); + }) +``` + +### support requireJS text plugin ### + +From within an AMD module the requireJS text plugin is supported. + +```javascript + var readme = require("text!./readme.md"); +``` + +Continuous Integration status +----------------------------- + +This project is tested with [Travis CI](http://travis-ci.org) +[![Build Status](https://secure.travis-ci.org/ajaxorg/node-amd-loader.png)](http://travis-ci.org/ajaxorg/node-amd-loader) + +Credits +------- + +[Kris Zip](https://github.com/kriszyp) came up the the initial [idea](https://gist.github.com/650000) how to hijack the node module loading. + +License +------- + +MIT license. See the LICENSE file for details. \ No newline at end of file diff --git a/node_modules/amd-loader/amd-loader.js b/node_modules/amd-loader/amd-loader.js new file mode 100644 index 00000000..1a8add0a --- /dev/null +++ b/node_modules/amd-loader/amd-loader.js @@ -0,0 +1,95 @@ +var fs = require("fs"); +var Module = require("module"); + +var moduleStack = []; +var defaultCompile = module.constructor.prototype._compile; + +module.constructor.prototype._compile = function(content, filename){ + moduleStack.push(this); + try { + return defaultCompile.call(this, content, filename); + } + finally { + moduleStack.pop(); + } +}; + +global.define = function (id, injects, factory) { + + // infere the module + var currentModule = moduleStack[moduleStack.length-1]; + var mod = currentModule || module.parent || require.main; + + // parse arguments + if (!factory) { + // two or less arguments + factory = injects; + if (factory) { + // two args + if (typeof id === "string") { + if (id !== mod.id) { + throw new Error("Can not assign module to a different id than the current file"); + } + // default injects + injects = []; + } + else{ + // anonymous, deps included + injects = id; + } + } + else { + // only one arg, just the factory + factory = id; + injects = []; + } + } + + var req = function(module, relativeId, callback) { + if (Array.isArray(relativeId)) { + // async require + return callback.apply(this, relativeId.map(req)) + } + + var chunks = relativeId.split("!"); + var prefix; + if (chunks.length >= 2) { + prefix = chunks[0]; + relativeId = chunks.slice(1).join("!"); + } + + var fileName = Module._resolveFilename(relativeId, module); + if (Array.isArray(fileName)) + fileName = fileName[0]; + + if (prefix && prefix.indexOf("text") !== -1) { + return fs.readFileSync(fileName, "utf8"); + } else + return require(fileName); + }.bind(this, mod); + + injects.unshift("require", "exports", "module"); + + id = mod.id; + if (typeof factory !== "function") { + // we can just provide a plain object + return mod.exports = factory; + } + + var returned = factory.apply(mod.exports, injects.map(function (injection) { + switch (injection) { + // check for CommonJS injection variables + case "require": return req; + case "exports": return mod.exports; + case "module": return mod; + default: + // a module dependency + return req(injection); + } + })); + + if (returned) { + // since AMD encapsulates a function/callback, it can allow the factory to return the exports. + mod.exports = returned; + } +}; \ No newline at end of file diff --git a/node_modules/amd-loader/package.json b/node_modules/amd-loader/package.json new file mode 100644 index 00000000..e70e29b5 --- /dev/null +++ b/node_modules/amd-loader/package.json @@ -0,0 +1,24 @@ +{ + "name" : "amd-loader", + "version" : "0.0.5", + "description" : "Add the capability to load AMD (Asynchronous Module Definition) modules to node.js", + "author": "ajax.org B.V. ", + "contributors": [ + { "name": "Fabian Jakobs", "email": "fabian@ajax.org" } + ], + "repository" : { + "type" : "git", + "url" : "http://github.com/ajaxorg/node-amd-loader.git" + }, + "main": "./amd-loader.js", + "scripts" : { + "test" : "node test/test.js && node test/test2.js" + }, + "engines" : { + "node" : ">= 0.4.11" + }, + "licenses" : [{ + "type" : "MIT", + "url" : "http://github.com/ajaxorg/node-amd-loader/raw/master/LICENSE" + }] +} \ No newline at end of file diff --git a/node_modules/amd-loader/test/node_modules/a.js b/node_modules/amd-loader/test/node_modules/a.js new file mode 100644 index 00000000..f199de8d --- /dev/null +++ b/node_modules/amd-loader/test/node_modules/a.js @@ -0,0 +1,8 @@ +define(function(require, exports, module) { + + exports.B = require("./b").B; + exports.D = require("d").D; + exports.A = "A"; + + exports.text = require("text!./c.txt"); +}); \ No newline at end of file diff --git a/node_modules/amd-loader/test/node_modules/b.js b/node_modules/amd-loader/test/node_modules/b.js new file mode 100644 index 00000000..e2a898ec --- /dev/null +++ b/node_modules/amd-loader/test/node_modules/b.js @@ -0,0 +1,3 @@ +define(function(require, exports, module) { + exports.B = "B"; +}); \ No newline at end of file diff --git a/node_modules/amd-loader/test/node_modules/c.txt b/node_modules/amd-loader/test/node_modules/c.txt new file mode 100644 index 00000000..95d09f2b --- /dev/null +++ b/node_modules/amd-loader/test/node_modules/c.txt @@ -0,0 +1 @@ +hello world \ No newline at end of file diff --git a/node_modules/amd-loader/test/node_modules/d.js b/node_modules/amd-loader/test/node_modules/d.js new file mode 100644 index 00000000..5bc470eb --- /dev/null +++ b/node_modules/amd-loader/test/node_modules/d.js @@ -0,0 +1,3 @@ +define(function(require, exports, module) { + exports.D = "D"; +}); \ No newline at end of file diff --git a/node_modules/amd-loader/test/node_modules/e.js b/node_modules/amd-loader/test/node_modules/e.js new file mode 100644 index 00000000..2fb486ac --- /dev/null +++ b/node_modules/amd-loader/test/node_modules/e.js @@ -0,0 +1,6 @@ +require("../.."); + +define(function(require, exports, module) { + exports.A = require("./a").A; + exports.E = "E"; +}); \ No newline at end of file diff --git a/node_modules/amd-loader/test/test.js b/node_modules/amd-loader/test/test.js new file mode 100644 index 00000000..79d578bf --- /dev/null +++ b/node_modules/amd-loader/test/test.js @@ -0,0 +1,34 @@ +require(".."); +var assert = require("assert"); + +console.log("Running amd-loader tests"); +console.log("========================\n"); + +console.log("resolve relative id"); +var a = require("./node_modules/a"); +var b = require("./node_modules/b"); + +assert.equal(a.A, "A"); +assert.equal(a.B, "B"); +assert.equal(a.text, "hello world"); +assert.equal(a.D, "D"); + +assert.equal(b.B, "B"); + +console.log("resolve fully qualified id"); +var a = require("a"); +var b = require("b"); + +assert.equal(a.A, "A"); +assert.equal(a.B, "B"); +assert.equal(a.text, "hello world"); +assert.equal(b.B, "B"); + +console.log("resolve from node_modules"); +var d = require("d"); + +assert.equal(d.D, "D"); + +// TODO +// node_modules + package +// async require diff --git a/node_modules/amd-loader/test/test2.js b/node_modules/amd-loader/test/test2.js new file mode 100644 index 00000000..92674deb --- /dev/null +++ b/node_modules/amd-loader/test/test2.js @@ -0,0 +1,4 @@ +// this tests the case where the AMD-loader is not loaded in the main module and +// the module using amd-loader uses define itself +console.log("require file with amd-loader and define") +require("e"); \ No newline at end of file diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 5296f882..ae1d3a02 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -85,8 +85,7 @@ module.exports = function setup(fsOptions) { } var TMUX = fsOptions.tmuxBin || "tmux"; - var BASH = fsOptions.bashBin || process.env.C9_BASH_BIN || - (process.platform == "win32" ? "C:\\cygwin\\bin\\bash.exe" : "bash"); + var BASH = fsOptions.bashBin || process.env.C9_BASH_BIN || (isWin ? "bash.exe" : "bash"); var METAPATH = fsOptions.metapath; var WSMETAPATH = fsOptions.wsmetapath; var TESTING = fsOptions.testing; diff --git a/package.json b/package.json index c71d92ee..55c527b4 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#ed89162aa7", "c9.ide.immediate": "#6845a93705", - "c9.ide.installer": "#19b25fc787", + "c9.ide.installer": "#36460d01e0", "c9.ide.mount": "#896ebf836e", "c9.ide.navigate": "#7c58c7f3d7", "c9.ide.newresource": "#f1f0624768", diff --git a/plugins/c9.core/settings.js b/plugins/c9.core/settings.js index e996648a..fdc5389a 100644 --- a/plugins/c9.core/settings.js +++ b/plugins/c9.core/settings.js @@ -425,10 +425,10 @@ define(function(require, exports, module) { if (query.indexOf("json()") == -1) json = json["json()"]; - if (typeof json == "object") + if (typeof json === "object") return JSON.parse(JSON.stringify(json)); - if (typeof json == "string") + if (typeof json !== "string") return json; try { diff --git a/scripts/install-sdk.sh b/scripts/install-sdk.sh index 2a7fda84..dddc8d03 100755 --- a/scripts/install-sdk.sh +++ b/scripts/install-sdk.sh @@ -13,6 +13,7 @@ case "$uname" in FreeBSD\ *) os=freebsd ;; CYGWIN*) os=windows ;; MINGW*) os=windows ;; + MSYS_NT*) os=windows ;; esac case "$uname" in *x86_64*) arch=x64 ;; diff --git a/scripts/setup-local-dev.sh b/scripts/setup-local-dev.sh index 64eec9d7..8a8ed448 100755 --- a/scripts/setup-local-dev.sh +++ b/scripts/setup-local-dev.sh @@ -19,6 +19,7 @@ case "$uname" in FreeBSD\ *) os=freebsd ;; CYGWIN*) os=windows ;; MINGW*) os=windows ;; + MSYS_NT*) os=windows ;; esac case "$uname" in *x86_64*) arch=x64 ;; @@ -69,24 +70,30 @@ if [ "$os" == "darwin" ]; then fi if [ "$os" == "windows" ]; then - NODE_VERSION=v0.10.25 - NW_VERSION=v0.9.2 + NODE_VERSION=v0.12.2 + NW_VERSION=v0.12.1 pushd build - if [ ! -f node.exe ]; then + if [ ! -f "$HOME/.c9/"node.exe ]; then echo "downloading node" + pushd "$HOME/.c9/" curl -OL http://nodejs.org/dist/$NODE_VERSION/node.exe + popd fi - if [ ! -f node-webkit-$NW_VERSION-win-ia32.zip ]; then + + NW_FILE_NAME=nwjs-$NW_VERSION-win-ia32 + if [ ! -f $NW_FILE_NAME.zip ]; then echo "downloading node-webkit" - curl -OL http://dl.node-webkit.org/$NW_VERSION/node-webkit-$NW_VERSION-win-ia32.zip + curl -OL http://dl.nwjs.io/$NW_VERSION/$NW_FILE_NAME.zip fi dest=win32-dev/bin mkdir -p $dest - unzip node-webkit-$NW_VERSION-win-ia32.zip -d $dest - cp node.exe $dest + unzip -uo $NW_FILE_NAME.zip -d win32-dev + rm -rf $dest + mv win32-dev/$NW_FILE_NAME $dest + # cp node.exe $dest mv $dest/nw.exe $dest/Cloud9.exe cp win32/icon.png $dest