|
1 |
| -/*jshint node:true*/ |
| 1 | +/* jshint node:true */ |
2 | 2 | "use strict";
|
3 |
| -var |
4 |
| - stub = { |
5 |
| - logbook: function (log) { |
6 |
| - this.logs.push(log); |
7 |
| - }, |
8 |
| - readLogs: function () { |
9 |
| - return this.logs.slice(); |
10 |
| - }, |
11 | 3 |
|
12 |
| - getFullPath: function (path) { |
13 |
| - return path; |
14 |
| - }, |
15 |
| - getFiles: function (dir) { |
16 |
| - var |
17 |
| - filesobj = this.fakedFs[dir], |
18 |
| - fileix, |
19 |
| - out = []; |
20 |
| - for (fileix in filesobj) { |
21 |
| - if ( filesobj.hasOwnProperty(fileix) && /\.css$/.test(fileix) ) { |
22 |
| - out.push(dir + "/" + fileix); |
23 |
| - } |
24 |
| - } |
25 |
| - return out; |
26 |
| - }, |
27 |
| - readFile: function (path) { |
28 |
| - var |
29 |
| - spath = path.split("/"), |
30 |
| - spathLen = spath.length, |
31 |
| - i, |
32 |
| - out = this.fakedFs; |
| 4 | +var stub = { |
| 5 | + logbook: function (log) { |
| 6 | + this.logs.push(log); |
| 7 | + }, |
| 8 | + readLogs: function () { |
| 9 | + return this.logs.slice(); |
| 10 | + }, |
33 | 11 |
|
34 |
| - for (i = 0; i < spathLen; i += 1) { |
35 |
| - out = out[spath[i]]; |
| 12 | + getFullPath: function (path) { |
| 13 | + return path; |
| 14 | + }, |
| 15 | + getFiles: function (dir) { |
| 16 | + var filesobj = this.fakedFs[dir], |
| 17 | + fileix, |
| 18 | + out = []; |
| 19 | + for (fileix in filesobj) { |
| 20 | + if (filesobj.hasOwnProperty(fileix) && /\.css$/.test(fileix)) { |
| 21 | + out.push(dir + "/" + fileix); |
36 | 22 | }
|
| 23 | + } |
| 24 | + return out; |
| 25 | + }, |
| 26 | + readFile: function (path) { |
| 27 | + var spath = path.split("/"), |
| 28 | + spathLen = spath.length, |
| 29 | + i, |
| 30 | + out = this.fakedFs; |
37 | 31 |
|
38 |
| - return out; |
39 |
| - }, |
40 |
| - isDirectory: function (checkit) { |
41 |
| - var |
42 |
| - result = this.fakedFs[checkit]; |
43 |
| - return typeof result === "object"; |
44 |
| - }, |
45 |
| - print: function (msg) { |
46 |
| - this.logbook(msg); |
47 |
| - }, |
48 |
| - quit: function (signal) { |
49 |
| - this.logbook(signal); |
| 32 | + for (i = 0; i < spathLen; i += 1) { |
| 33 | + out = out[spath[i]]; |
50 | 34 | }
|
51 |
| - }; |
| 35 | + |
| 36 | + return out; |
| 37 | + }, |
| 38 | + isDirectory: function (checkit) { |
| 39 | + var result = this.fakedFs[checkit]; |
| 40 | + return typeof result === "object"; |
| 41 | + }, |
| 42 | + print: function (msg) { |
| 43 | + this.logbook(msg); |
| 44 | + }, |
| 45 | + quit: function (signal) { |
| 46 | + this.logbook(signal); |
| 47 | + } |
| 48 | +}; |
52 | 49 |
|
53 | 50 | module.exports = function (setup) {
|
54 |
| - var |
55 |
| - api, |
| 51 | + var api, |
56 | 52 | setix;
|
57 | 53 |
|
58 | 54 | api = Object.create(stub);
|
|
0 commit comments