Skip to content

Commit

Permalink
cleaning up directories, creating BUILD script
Browse files Browse the repository at this point in the history
  • Loading branch information
Marak committed May 15, 2010
1 parent d37111d commit adabe82
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 11 deletions.
4 changes: 0 additions & 4 deletions BUILD.js

This file was deleted.

45 changes: 45 additions & 0 deletions BUILD/BUILD.js
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;
}

4 changes: 4 additions & 0 deletions BUILD/main.js
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";
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Faker.Company = require('./lib/company');
Faker.Lorem = require('./lib/lorem');


var Helper = require('helper');;
var Helper = require('./lib/helper');;

sys.puts(JSON.stringify(Faker.Name.first_name()));
sys.puts(JSON.stringify(Faker.Name.findName()));
Expand Down
2 changes: 1 addition & 1 deletion lib/address.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('../lib/definitions');

exports.zipCode = function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/company.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('../lib/definitions');

exports.companyName = function() {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/internet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('./definitions');

exports.email = function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/lorem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('../lib/definitions');

exports.words = function(num){
Expand Down
2 changes: 1 addition & 1 deletion lib/name.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('./definitions');

exports.first_name = function(){
Expand Down
2 changes: 1 addition & 1 deletion lib/phone_number.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Helper = require('../helper');
var Helper = require('./helper');
var definitions = require('./definitions');

exports.phoneNumber = function(){
Expand Down
File renamed without changes.

0 comments on commit adabe82

Please sign in to comment.