Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial import

  • Loading branch information...
commit 43df3d62bdf40b1baa2563bf8a054105700204e4 0 parents
@fjakobs fjakobs authored
30 configs/default.js
@@ -0,0 +1,30 @@
+var path = require("path");
+var port = process.env.PORT || 5656;
+
+module.exports = {
+ name: "VFS",
+ tmpdir: __dirname + "/../.architect",
+ basePath: __dirname + "/..",
+ containers: {
+ master: {
+ title: "VFS",
+ plugins: [{
+ packagePath: "connect-architect/connect",
+ port: port
+ }, {
+ packagePath: "./local",
+ uid: process.getuid(),
+ gid: process.getgid(),
+ umask: 0750,
+ root: path.normalize(__dirname + "/../"),
+ skipSearchCheck: false,
+ httpRoot: "http://localhost:" + port + "/"
+ }, {
+ packagePath: "./http-adapter",
+ mount: "/vfs"
+ }, {
+ packagePath: "architect/plugins/architect.log"
+ }]
+ }
+ }
+};
27 configs/ssh.js
@@ -0,0 +1,27 @@
+var port = process.env.PORT || 5656;
+
+module.exports = {
+ name: "VFS SSH",
+ tmpdir: __dirname + "/../.architect",
+ basePath: __dirname + "/..",
+ containers: {
+ master: {
+ title: "VFS SSH",
+ plugins: [{
+ packagePath: "connect-architect/connect",
+ port: port
+ }, {
+ packagePath: "./ssh",
+ host: "localhost",
+ root: process.env.HOME + "/",
+ nodePath: process.execPath,
+ httpRoot: "http://localhost:" + port + "/"
+ }, {
+ packagePath: "./http-adapter",
+ mount: "/"
+ }, {
+ packagePath: "architect/plugins/architect.log"
+ }]
+ }
+ }
+};
12 http-adapter/http-adapter-ext.js
@@ -0,0 +1,12 @@
+var assert = require("assert");
+
+module.exports = function setup(options, imports, register) {
+
+ assert(options.mount, "option 'mount' is required");
+
+ imports.connect.useMain(require("vfs/http-adapter/restful")(options.mount, imports.vfs));
+
+ register(null, {
+ "vfs-rest": {}
+ });
+}
14 http-adapter/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "vfs.http-adapter",
+ "version": "0.0.1",
+ "main": "http-adapter-ext.js",
+ "private": true,
+
+ "plugin": {
+ "provides": ["vfs-rest"],
+ "consumes" : [
+ "vfs",
+ "connect"
+ ]
+ }
+}
12 local/local-ext.js
@@ -0,0 +1,12 @@
+var assert = require("assert");
+
+module.exports = function setup(options, imports, register) {
+
+ assert.equal(typeof options.uid, "number", "option 'uid' is required");
+ assert.equal(typeof options.gid, "number", "option 'gid' is required");
+ assert(options.root, "option 'root' is required");
+
+ register(null, {
+ "vfs": require("vfs/local")(options)
+ });
+}
10 local/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "vfs.local",
+ "version": "0.0.1",
+ "main": "local-ext.js",
+ "private": true,
+
+ "plugin": {
+ "provides": ["vfs"]
+ }
+}
20 package.json
@@ -0,0 +1,20 @@
+{
+ "name": "vfs-architect",
+ "description": "architect plugins for vfs",
+ "version": "0.0.1",
+
+ "author": "ajax.org B.V. <info@ajax.org>",
+ "contributors": [
+ { "name": "Fabian Jakobs", "email": "fabian@c9.io" }
+ ],
+
+ "dependencies": {
+ "architect": "~0.0.3",
+ "vfs": "~0.0.1"
+ },
+
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/c9/vfs-architect.git"
+ }
+}
17 server.js
@@ -0,0 +1,17 @@
+#!/usr/bin/env node
+
+var path = require('path');
+var architect = require("architect");
+
+var configName = process.argv[2] || "default";
+
+var configPath = path.resolve(__dirname, "./configs/", configName);
+var config = require(configPath);
+
+architect.createApp(config, function (err, app) {
+ if (err) {
+ console.error("While starting the '%s':", configPath);
+ throw err;
+ }
+ console.log("Started '%s'!", configPath);
+});
10 ssh/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "vfs.ssh",
+ "version": "0.0.1",
+ "main": "ssh-ext.js",
+ "private": true,
+
+ "plugin": {
+ "provides": ["vfs"]
+ }
+}
26 ssh/ssh-ext.js
@@ -0,0 +1,26 @@
+var assert = require("assert");
+
+module.exports = function setup(options, imports, register) {
+
+ assert(options.root, "option 'root' is required");
+ assert(options.host, "option 'host' is required");
+ assert(options.nodePath, "option 'nodePath' is required");
+
+ require("vfs/ssh")({
+ pingInterval: options.pingInterval || 5000, //ms
+ serverAliveInterval: options.serverAliveInterval || 10, //sec
+ nodePath: options.nodePath,
+ host: options.host,
+ key: options.keyFile || null,
+ umask: options.umask || 0750,
+ uid: options.uid || process.getuid(),
+ gid: options.uid || process.getgid(),
+ skipSearchCheck: options.skipSearchCheck || false,
+ root: options.root,
+ httpRoot: options.httpRoot || null
+ }, function(err, vfs) {
+ register(err, {
+ "vfs": vfs
+ });
+ })
+}
Please sign in to comment.
Something went wrong with that request. Please try again.