updated test-app

This commit is contained in:
Ritchie Martori
2012-08-09 09:14:35 -07:00
parent 9f8485fb6e
commit cb21917621
5 changed files with 42 additions and 31 deletions

View File

@@ -78,7 +78,16 @@ Script.prototype.run = function (ctx, domain, fn) {
domain.dpd = ctx.dpd;
if(domain) wrapAsyncFunctions(domain, scriptContext, events, done);
if(fn) {
// if a callback is expected, count callbacks
// and manually merge the domain
wrapAsyncFunctions(domain, scriptContext, events, done);
} else {
// otherwise just merge the domain
Object.keys(domain).forEach(function (key) {
scriptContext[key] = domain[key];
})
}
scriptContext.this = scriptContext._this = domain.data;
}

View File

@@ -6,16 +6,17 @@ var Resource = require('deployd/lib/resource')
, util = require('util')
, request = require('request');
function Proxy(settings) {
function Proxy(name, options) {
Resource.apply(this, arguments);
this.remote = settings.remote;
this.remote = this.config.remote;
}
util.inherits(Proxy, Resource);
module.exports = Proxy;
Proxy.prototype.handle = function (ctx, next) {
if(ctx.req && ctx.req.method !== 'GET') return next();
request.get(this.remote + ctx.url).pipe(ctx.res);
var remote = this.remote;
request.get(remote + ctx.url).pipe(ctx.res);
}
Proxy.label = 'HTTP Proxy';

View File

@@ -1,6 +1,6 @@
{
"path": "/proxy",
"order": 7,
"remote": "http://yahoo.com",
"remote": "http://www.yahoo.com",
"type": "Proxy"
}

View File

@@ -0,0 +1 @@
console.log('bar');

View File

@@ -1,13 +1,12 @@
{
"properties": {
"message": {
"tags": {
"required": false,
"type": "string",
"typeLabel": "string",
"id": "message",
"name": "message",
"order": 0,
"$renameFrom": "messages"
"type": "array",
"typeLabel": "array",
"id": "tags",
"name": "tags",
"order": 0
},
"people": {
"required": false,
@@ -17,38 +16,31 @@
"name": "people",
"order": 1
},
"tags": {
"required": false,
"type": "array",
"typeLabel": "array",
"id": "tags",
"name": "tags",
"order": 2
},
"owner": {
"required": false,
"type": "string",
"typeLabel": "string",
"id": "owner",
"name": "owner",
"order": 3,
"order": 2,
"$renameFrom": "ownerssss"
},
"done": {
"required": false,
"type": "boolean",
"typeLabel": "string",
"id": "done",
"name": "done",
"order": 4
},
"order": {
"required": false,
"type": "number",
"typeLabel": "string",
"id": "order",
"name": "order",
"order": 5
"order": 3
},
"message": {
"required": false,
"type": "string",
"typeLabel": "string",
"id": "message",
"name": "message",
"order": 4,
"$renameFrom": "messages"
},
"title": {
"required": false,
@@ -56,8 +48,16 @@
"typeLabel": "string",
"id": "title",
"name": "title",
"order": 6,
"order": 5,
"$renameFrom": "titlesss"
},
"done": {
"required": false,
"type": "boolean",
"typeLabel": "string",
"id": "done",
"name": "done",
"order": 6
}
},
"path": "/todos",