forked from Geertvdc/faker.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaning up directories, creating BUILD script
- Loading branch information
Showing
12 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var sys = require('sys') | ||
, fs = require('fs'); | ||
|
||
var code = ''; | ||
|
||
// read in the the main.js file as our main boilerplate code | ||
code += fs.readFileSync('./main.js', encoding='utf8'); | ||
|
||
// parse entire lib directory and concat it into one file for the browser | ||
var lib = paths('./lib'); | ||
|
||
sys.puts(JSON.stringify(lib)); | ||
|
||
// generate some samples sets (move this code to another section) | ||
|
||
/*********************** BUILD HELPER METHODS *********************/ | ||
|
||
// Recursively traverse a hierarchy, returning a list of all relevant .js files. | ||
function paths(dir) { | ||
var paths = []; | ||
|
||
try { fs.statSync(dir) } | ||
catch (e) { return e } | ||
|
||
(function traverse(dir, stack) { | ||
stack.push(dir); | ||
fs.readdirSync(stack.join('/')).forEach(function (file) { | ||
var path = stack.concat([file]).join('/'), | ||
stat = fs.statSync(path); | ||
|
||
if (file[0] == '.' || file === 'vendor') { | ||
return; | ||
} else if (stat.isFile() && /\.js$/.test(file)) { | ||
paths.push(path); | ||
} else if (stat.isDirectory()) { | ||
paths.push(path); | ||
traverse(file, stack); | ||
} | ||
}); | ||
stack.pop(); | ||
})(dir || '.', []); | ||
|
||
return paths; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// this is just boilerplate code for generating the actual mustache-rides.js file, do not use this outside of node_builder.js | ||
var Faker = {}; | ||
|
||
Faker.version = "0.0.1"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.