Merge pull request +7252 from c9/sdk

More tweaking of sdk
pull/85/head^2
Harutyun Amirjanyan 2015-05-10 22:46:22 +04:00
commit d7ab6da51f
23 zmienionych plików z 309 dodań i 15 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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 ;;

Wyświetl plik

@ -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 ;;

Wyświetl plik

@ -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;

3
node_modules/amd-loader/.gitignore wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
.c9revisions/
amd-loader-*.tgz
package/

4
node_modules/amd-loader/.npmignore wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,4 @@
.git/
.c9revisions/
package/
amd-loader-*.tgz

6
node_modules/amd-loader/.travis.yml wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,6 @@
language: node_js
node_js:
- 0.4
- 0.5
- 0.6
- 0.10

21
node_modules/amd-loader/LICENSE wygenerowano vendored 100644
Wyświetl plik

@ -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.

73
node_modules/amd-loader/README.md wygenerowano vendored 100644
Wyświetl plik

@ -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.

95
node_modules/amd-loader/amd-loader.js wygenerowano vendored 100644
Wyświetl plik

@ -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;
}
};

24
node_modules/amd-loader/package.json wygenerowano vendored 100644
Wyświetl plik

@ -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. <info@ajax.org>",
"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"
}]
}

8
node_modules/amd-loader/test/node_modules/a.js wygenerowano vendored 100644
Wyświetl plik

@ -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");
});

3
node_modules/amd-loader/test/node_modules/b.js wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
define(function(require, exports, module) {
exports.B = "B";
});

1
node_modules/amd-loader/test/node_modules/c.txt wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1 @@
hello world

3
node_modules/amd-loader/test/node_modules/d.js wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
define(function(require, exports, module) {
exports.D = "D";
});

6
node_modules/amd-loader/test/node_modules/e.js wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,6 @@
require("../..");
define(function(require, exports, module) {
exports.A = require("./a").A;
exports.E = "E";
});

34
node_modules/amd-loader/test/test.js wygenerowano vendored 100644
Wyświetl plik

@ -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

4
node_modules/amd-loader/test/test2.js wygenerowano vendored 100644
Wyświetl plik

@ -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");

3
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -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;

Wyświetl plik

@ -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",

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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 ;;

Wyświetl plik

@ -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