Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
fjakobs committed May 10, 2012
0 parents commit 43df3d6
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 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 changes: 27 additions & 0 deletions 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 changes: 12 additions & 0 deletions 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 changes: 14 additions & 0 deletions 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 changes: 12 additions & 0 deletions 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 changes: 10 additions & 0 deletions local/package.json
@@ -0,0 +1,10 @@
{
"name": "vfs.local",
"version": "0.0.1",
"main": "local-ext.js",
"private": true,

"plugin": {
"provides": ["vfs"]
}
}
20 changes: 20 additions & 0 deletions 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 changes: 17 additions & 0 deletions 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 changes: 10 additions & 0 deletions ssh/package.json
@@ -0,0 +1,10 @@
{
"name": "vfs.ssh",
"version": "0.0.1",
"main": "ssh-ext.js",
"private": true,

"plugin": {
"provides": ["vfs"]
}
}
26 changes: 26 additions & 0 deletions 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
});
})
}

0 comments on commit 43df3d6

Please sign in to comment.