From ad9413cbbb28ac9974e5583b6d568bf5fc429a1c Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 9 Mar 2017 00:05:36 +0400 Subject: [PATCH] add example of a custom vfs implementation --- configs/ide/default.js | 2 +- .../build_support/mini_require.js | 2 +- plugins/c9.fs/fs.streams.js | 6 +- .../c9.vfs.standalone/www/ide.offline.html | 473 ++++++++++++++++++ plugins/c9.vfs.standalone/www/places.html | 4 +- 5 files changed, 481 insertions(+), 6 deletions(-) create mode 100644 plugins/c9.vfs.standalone/www/ide.offline.html diff --git a/configs/ide/default.js b/configs/ide/default.js index 623564c7..14c381eb 100644 --- a/configs/ide/default.js +++ b/configs/ide/default.js @@ -32,7 +32,7 @@ module.exports = function(options) { var runners = options.runners || {}; var builders = options.builders || {}; - var hosted = !options.local && !options.dev; + var hosted = !options.local && !options.standalone && !options.dev; var devel = options.standalone && !options.local || options.mode === "devel" || options.mode == "onlinedev" || options.dev; var localExtendFiles = options.localExtend || options.standalone; diff --git a/node_modules/architect-build/build_support/mini_require.js b/node_modules/architect-build/build_support/mini_require.js index ab5db0ac..e25ccf6c 100644 --- a/node_modules/architect-build/build_support/mini_require.js +++ b/node_modules/architect-build/build_support/mini_require.js @@ -455,7 +455,7 @@ var loadCached = function(path, cb) { var m = cb(e, val); } catch(err) { ideCache.delete(path); - e = err; + throw err; } if (!e) { var ETAG = xhr.getResponseHeader("ETAG"); diff --git a/plugins/c9.fs/fs.streams.js b/plugins/c9.fs/fs.streams.js index 111dea26..d2d8e609 100644 --- a/plugins/c9.fs/fs.streams.js +++ b/plugins/c9.fs/fs.streams.js @@ -7,7 +7,7 @@ return function(vfs, base, baseProc, cli) { var resolvePath = function(path, basePath) { if (path.charAt(0) == "~") { - if (cli) + if (cli && typeof process != "undefined") return process.env.HOME + "/" + path.substr(1); return path; } @@ -254,7 +254,9 @@ return function(vfs, base, baseProc, cli) { symlink: symlink, watch: watch, unwatch: unwatch, - vfs: vfs + vfs: vfs, + metadata: vfs.metadata, + readFileWithMetadata: vfs.readFileWithMetadata }; }; diff --git a/plugins/c9.vfs.standalone/www/ide.offline.html b/plugins/c9.vfs.standalone/www/ide.offline.html new file mode 100644 index 00000000..17dac5e0 --- /dev/null +++ b/plugins/c9.vfs.standalone/www/ide.offline.html @@ -0,0 +1,473 @@ + + + + + Cloud9 + + + + + +
+
+
+ + +
+
+ +
+
+ + + + + + diff --git a/plugins/c9.vfs.standalone/www/places.html b/plugins/c9.vfs.standalone/www/places.html index b5545828..23c40d66 100644 --- a/plugins/c9.vfs.standalone/www/places.html +++ b/plugins/c9.vfs.standalone/www/places.html @@ -12,9 +12,9 @@ var places = { IDE: ["/ide.html", "?devel=1", "?reset=state", "?reset=settings", "?reset=1", "?noworker=1", "?packed=1", "?collab=0"], VFS: "/vfs", Preview: "/preview", + StaticIde: ["/static/ide.html", "/static/ide.offline.html"], Test: "/static/test.html", List_of_tests: "/static/test.html?", - testsuite: "/static/testsuite.html?" }, Collab: { main: "/static/plugins/c9.ide.collab/collab_test.html", @@ -53,7 +53,7 @@ for (var i in places) { if (subPaths) { html.push("       ("); subPaths.forEach(function(x, i) { - html.push("", x, ""); + html.push("", x, ""); if (i != subPaths.length - 1) html.push(",   "); });