Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Plug: variable refactoring to match module name.

  • Loading branch information...
commit 345049b08070ac0a6b57a729d5aba01eb2c8231f 1 parent 108ae63
@espadrine authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 lib/plug.js
View
17 lib/plug.js
@@ -5,7 +5,7 @@
var fs = require('./fs'),
driver = require('./driver'),
nodepath = require('path'),
- makeLookup = require('./lookup');
+ lookup = require('./lookup');
// We need Camp's socket.io object here. We get it at initialization.
@@ -68,8 +68,7 @@ exports.resolve = function (query, path, endres, ask) {
var data = {};
// Environment variable lookup mechanism.
- var lookup = makeLookup(file, query);
- data.lookup = lookup;
+ data.lookup = lookup(file, query);
// File info.
data.file = file;
@@ -91,7 +90,7 @@ exports.resolve = function (query, path, endres, ask) {
data.nav.push({name: decodeURI(crumbs[i]), path: subpath});
}
- findPlug(file, path, data, lookup, end);
+ findPlug(file, path, data, end);
});
};
@@ -99,8 +98,8 @@ exports.resolve = function (query, path, endres, ask) {
//
// 1. Look for the non-inherited `plug` metadata.
// 2. Look for the inherited `plugs.<file type>` metadata.
-function findPlug(file, path, data, lookup, end) {
- var plug = lookup('plug');
+function findPlug(file, path, data, end) {
+ var plug = data.lookup('plug');
if (plug === 'none') {
end(); // no plug
@@ -128,7 +127,7 @@ function findPlug(file, path, data, lookup, end) {
///console.log('server:root: data sent from dir is', data);
if (plug == null) {
- lookup('plugs.dir', function(plug) {
+ data.lookup('plugs.dir', function(plug) {
end(err, plug || 'gateway.html', data);
});
} else {
@@ -140,7 +139,7 @@ function findPlug(file, path, data, lookup, end) {
file.ot(camp.io, function(err) {
if (plug == null) {
- lookup('plugs.text', function(plug) {
+ data.lookup('plugs.text', function(plug) {
end(err, plug || 'pencil.html', data);
});
} else {
@@ -151,7 +150,7 @@ function findPlug(file, path, data, lookup, end) {
} else if (file.isOfType('binary')) {
if (plug == null) {
- lookup('plugs.binary', function(plug) {
+ data.lookup('plugs.binary', function(plug) {
end(null, plug || 'none', data);
});
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.