Skip to content
Browse files

working on `crux patch`

  • Loading branch information...
1 parent acc14a0 commit c0db788c92cfeb9fedb9bd25b024e8d7568574ed @kbjr committed Mar 10, 2012
Showing with 95 additions and 1,634 deletions.
  1. +1 −0 .gitignore
  2. +92 −8 bin/crux.js
  3. +0 −1 node_modules/.bin/migrate
  4. +0 −4 node_modules/migrate/.gitignore
  5. +0 −3 node_modules/migrate/.gitmodules
  6. +0 −4 node_modules/migrate/.npmignore
  7. +0 −35 node_modules/migrate/History.md
  8. +0 −5 node_modules/migrate/Makefile
  9. +0 −134 node_modules/migrate/Readme.md
  10. +0 −243 node_modules/migrate/bin/migrate
  11. +0 −12 node_modules/migrate/examples/cli/migrations/000-add-pets.js
  12. +0 −10 node_modules/migrate/examples/cli/migrations/001-add-jane.js
  13. +0 −12 node_modules/migrate/examples/cli/migrations/002-add-owners.js
  14. +0 −10 node_modules/migrate/examples/cli/migrations/003-coolest-pet.js
  15. +0 −10 node_modules/migrate/examples/cli/migrations/db.js
  16. +0 −55 node_modules/migrate/examples/migrate.js
  17. +0 −2 node_modules/migrate/index.js
  18. +0 −41 node_modules/migrate/lib/migrate.js
  19. +0 −18 node_modules/migrate/lib/migration.js
  20. +0 −180 node_modules/migrate/lib/set.js
  21. +0 −14 node_modules/migrate/package.json
  22. +0 −217 node_modules/migrate/test/test.migrate.js
  23. +0 −1 node_modules/wrench/.gitignore
  24. +0 −21 node_modules/wrench/LICENSE
  25. +0 −396 node_modules/wrench/lib/wrench.js
  26. +0 −1 node_modules/wrench/lib/x.js
  27. +0 −42 node_modules/wrench/package.json
  28. +0 −64 node_modules/wrench/readme.md
  29. +0 −26 node_modules/wrench/tests/mkdir.js
  30. +0 −57 node_modules/wrench/tests/readdir.js
  31. 0 node_modules/wrench/tests/readdir/bar.txt
  32. 0 node_modules/wrench/tests/readdir/foo/bar/ipsum.js
  33. 0 node_modules/wrench/tests/readdir/foo/dolor.md
  34. 0 node_modules/wrench/tests/readdir/foo/lorem.txt
  35. +0 −7 node_modules/wrench/tests/runner.js
  36. +2 −1 package.json
View
1 .gitignore
@@ -0,0 +1 @@
+node_modules
View
100 bin/crux.js
@@ -2,17 +2,20 @@
var fs = require('fs');
var path = require('path');
+var git = require('gitjs');
var wrench = require('wrench');
var BASE_PATH = path.join(__dirname, '..');
var TEMPLATE_PATH = path.join(BASE_PATH, 'template');
var PID_FILE = '.server-pid';
+var PATCH_REMOTE = '__crux_patch';
+var GITHUB_REPO = 'git@github.com:kbjr/node-crux';
var args = process.argv.slice(2);
switch (args.shift()) {
- // builder init [directory]
+ // crux init [directory]
case 'init':
var creationPath = path.join(process.cwd(), (args[0] || '.'));
// Make sure the template exists
@@ -29,7 +32,7 @@ switch (args.shift()) {
});
break;
- // builder start [--quiet]
+ // crux start [--quiet]
case 'start':
var projectPath = findUpTree(process.cwd(), 'core/init.js');
process.chdir(projectPath);
@@ -41,7 +44,7 @@ switch (args.shift()) {
});
break;
- // builder migrate [up|down|create]
+ // crux migrate [up|down|create]
case 'migrate':
var migratePath = path.join(BASE_PATH, 'node_modules/migrate/bin/migrate');
var projectPath = findUpTree(process.cwd(), 'migrations', function(file) {
@@ -51,22 +54,103 @@ switch (args.shift()) {
require('./migrate').run(args, projectPath);
break;
- // builder npm [...]
+ // crux npm [...]
case 'npm':
- var projectPath = findUpTree(process.cwd(), 'core/init.js');
- process.chdir(projectPath);
+ changeDirectoryToProjectPath();
var quiet =!! (args[0] && args[0] === '--quiet' && args.shift());
args.unshift('npm');
runProcess('/usr/bin/env', args, quiet);
break;
- // builder [...]
+ // crux patch <commit-ish>
+ case 'patch':
+ changeDirectoryToProjectPath();
+ var quiet =!! (args[0] && args[0] === '--quiet' && args.shift());
+
+ if (! quiet) {
+ console.log('> Preparing to patch...');
+ }
+
+ // Open the git repo
+ git.open('.', true, throws(function(repo, autoCreated) {
+
+ // If the repo did not already exist, make sure we commit all the files
+ if (autoCreated) {
+ repo.add('*', throws(function() {
+ repo.commit('foo', throws(function() {
+ afterOpen();
+ }));
+ }));
+ } else {
+ afterOpen();
+ }
+
+ // After init-ing and possibily commiting, make sure we have a remote
+ function afterOpen() {
+ repo.remoteExists(PATCH_REMOTE, throws(function(exists) {
+ if (exists) {
+ return doCherrypick();
+ }
+ repo.run('remote add ? ?', [PATCH_REMOTE, GITHUB_REPO], throws(doCherrypick));
+ }));
+ }
+
+ // Once we are sure the remote exists, fetch and cherry-pick
+ function doCherrypick() {
+ if (! quiet) {
+ console.log('> Fetching patch data from repository...');
+ }
+ repo.run('fetch ?', [PATCH_REMOTE], throws(function() {
+ repo.run('cherry-pick ?', [args.join(' ')], throws(function() {
+
+ // If we created the repo, we can now destroy it
+ if (autoCreated) {
+ var _git = path.join(process.cwd(), '.git';
+ wrench.rmdirRecursive(_git, throws(done));
+ } else {
+ done();
+ }
+
+ function done() {
+ console.log('> Patching complete');
+ }
+
+ }));
+ }));
+ }
+
+ });
+ break;
+
+ // crux [...]
default:
console.log('Invalid use');
break;
}
+// ------------------------------------------------------------------
+// Internals
+
+// If a first parameter is given, throw it
+function throws(callback) {
+ return function(err) {
+ if (err) {throw err;}
+ if (typeof callback === 'function') {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return callback.apply(this, args);
+ }
+ }
+}
+
+// Change to the directory at the project root
+function changeDirectoryToProjectPath() {
+ process.chdir(
+ findUpTree(process.cwd(), 'core/init.js')
+ );
+}
+
+// Run a child process
function runProcess(cmd, args, quiet, logFile, onkill) {
var proc = require('child_process').spawn(cmd, args);
var toLogFile;
@@ -125,4 +209,4 @@ function findUpTree(findIn, find, otherTest) {
}
}
-/* End of file builder.js */
+/* End of file crux.js */
View
1 node_modules/.bin/migrate
View
4 node_modules/migrate/.gitignore
@@ -1,4 +0,0 @@
-.DS_Store
-node_modules
-*.sock
-.migrate
View
3 node_modules/migrate/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "support/should"]
- path = support/should
- url = git://github.com/visionmedia/should.js.git
View
4 node_modules/migrate/.npmignore
@@ -1,4 +0,0 @@
-support
-test
-examples
-*.sock
View
35 node_modules/migrate/History.md
@@ -1,35 +0,0 @@
-
-0.1.1 / 2011-12-04
-==================
-
- * Fixed a typo [kishorenc]
-
-0.1.0 / 2011-12-03
-==================
-
- * Added support for incremental migrations. [Kishore Nallan]
-
-0.0.5 / 2011-11-07
-==================
-
- * 0.6.0 support
-
-0.0.4 / 2011-09-12
-==================
-
- * Fixed: load js files only [aheckmann]
-
-0.0.3 / 2011-09-09
-==================
-
- * Fixed initial `create` support
-
-0.0.2 / 2011-09-09
-==================
-
- * Fixed `make test`
-
-0.0.1 / 2011-04-24
-==================
-
- * Initial release
View
5 node_modules/migrate/Makefile
@@ -1,5 +0,0 @@
-
-test:
- @node test/test.migrate.js
-
-.PHONY: test
View
134 node_modules/migrate/Readme.md
@@ -1,134 +0,0 @@
-
-# migrate
-
- Abstract migration framework for node
-
-## Installation
-
- $ npm install migrate
-
-## Usage
-
-```
-Usage: migrate [options] [command]
-
-Options:
-
- -c, --chdir <path> change the working directory
-
-Commands:
-
- down migrate down
- up migrate up (the default command)
- create [title] create a new migration file with optional [title]
-
-```
-
-## Creating Migrations
-
-To create a migration, execute `migrate create` with an optional title. `node-migrate` will create a node module within `./migrations/` which contains the following two exports:
-
- exports.up = function(next){
- next();
- };
-
- exports.down = function(next){
- next();
- };
-
-All you have to do is populate these, invoking `next()` when complete, and you are ready to migrate!
-
-For example:
-
- $ migrate create add-pets
- $ migrate create add-owners
-
-The first call creates `./migrations/000-add-pets.js`, which we can populate:
-
- var db = require('./db');
-
- exports.up = function(next){
- db.rpush('pets', 'tobi');
- db.rpush('pets', 'loki');
- db.rpush('pets', 'jane', next);
- };
-
- exports.down = function(next){
- db.rpop('pets');
- db.rpop('pets', next);
- };
-
-The second creates `./migrations/001-add-owners.js`, which we can populate:
-
- var db = require('./db');
-
- exports.up = function(next){
- db.rpush('owners', 'taylor');
- db.rpush('owners', 'tj', next);
- };
-
- exports.down = function(next){
- db.rpop('owners');
- db.rpop('owners', next);
- };
-
-## Running Migrations
-
-When first running the migrations, all will be executed in sequence.
-
- $ migrate
- up : migrations/000-add-pets.js
- up : migrations/001-add-jane.js
- up : migrations/002-add-owners.js
- up : migrations/003-coolest-pet.js
- migration : complete
-
-Subsequent attempts will simply output "complete", as they have already been executed in this machine. `node-migrate` knows this because it stores the current state in `./migrations/.migrate` which is typically a file that SCMs like GIT should ignore.
-
- $ migrate
- migration : complete
-
-If we were to create another migration using `migrate create`, and then execute migrations again, we would execute only those not previously executed:
-
- $ migrate
- up : migrates/004-coolest-owner.js
-
-You can also run migrations incrementally by specifying a migration.
-
- $ migrate up 002-coolest-pet.js
- up : migrations/000-add-pets.js
- up : migrations/001-add-jane.js
- up : migrations/002-add-owners.js
- migration : complete
-
-This will run up-migrations upto (and including) `002-coolest-pet.js`. Similarly you can run down-migrations upto (and including) a specific migration, instead of migrating all the way down.
-
- $ migrate down 001-add-jane.js
- down : migrations/002-add-owners.js
- down : migrations/001-add-jane.js
- migration : complete
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
243 node_modules/migrate/bin/migrate
@@ -1,243 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var migrate = require('../')
- , join = require('path').join
- , fs = require('fs');
-
-/**
- * Arguments.
- */
-
-var args = process.argv.slice(2);
-
-/**
- * Option defaults.
- */
-
-var options = { args: [] };
-
-/**
- * Current working directory.
- */
-
-var cwd;
-
-/**
- * Usage information.
- */
-
-var usage = [
- ''
- , ' Usage: migrate [options] [command]'
- , ''
- , ' Options:'
- , ''
- , ' -c, --chdir <path> change the working directory'
- , ''
- , ' Commands:'
- , ''
- , ' down [name] migrate down till given migration'
- , ' up [name] migrate up till given migration (the default command)'
- , ' create [title] create a new migration file with optional [title]'
- , ''
-].join('\n');
-
-/**
- * Migration template.
- */
-
-var template = [
- ''
- , 'exports.up = function(next) {'
- , ' next();'
- , '};'
- , ''
- , 'exports.down = function(next) {'
- , ' next();'
- , '};'
- , ''
-].join('\n');
-
-// require an argument
-
-function required() {
- if (args.length) return args.shift();
- abort(arg + ' requires an argument');
-}
-
-// abort with a message
-
-function abort(msg) {
- console.error(' %s', msg);
- process.exit(1);
-}
-
-// parse arguments
-
-var arg;
-while (args.length) {
- arg = args.shift();
- switch (arg) {
- case '-h':
- case '--help':
- case 'help':
- console.log(usage);
- process.exit();
- break;
- case '-c':
- case '--chdir':
- process.chdir(cwd = required());
- break;
- default:
- if (options.command) {
- options.args.push(arg);
- } else {
- options.command = arg;
- }
- }
-}
-
-/**
- * Load migrations.
- */
-
-function migrations() {
- return fs.readdirSync('migrations').filter(function(file){
- return file.match(/^\d+.*\.js$/);
- }).sort().map(function(file){
- return 'migrations/' + file;
- });
-}
-
-/**
- * Log a keyed message.
- */
-
-function log(key, msg) {
- console.log(' \033[90m%s :\033[0m \033[36m%s\033[0m', key, msg);
-}
-
-/**
- * Slugify the given `str`.
- */
-
-function slugify(str) {
- return str.replace(/\s+/g, '-');
-}
-
-// create ./migrations
-
-try {
- fs.mkdirSync('migrations', 0774);
-} catch (err) {
- // ignore
-}
-
-// commands
-
-var commands = {
-
- /**
- * up [name]
- */
-
- up: function(migrationName){
- performMigration('up', migrationName);
- },
-
- /**
- * down [name]
- */
-
- down: function(migrationName){
- performMigration('down', migrationName);
- },
-
- /**
- * create [title]
- */
-
- create: function(){
- var migrations = fs.readdirSync('migrations').filter(function(file){
- return file.match(/^\d+/);
- }).map(function(file){
- return parseInt(file.match(/^(\d+)/)[1], 10);
- }).sort(function(a, b){
- return a - b;
- });
-
- var curr = pad((migrations.pop() || 0) + 1)
- , title = slugify([].slice.call(arguments).join(' '));
- title = title ? curr + '-' + title : curr;
- create(title);
- }
-};
-
-/**
- * Pad the given number.
- *
- * @param {Number} n
- * @return {String}
- */
-
-function pad(n) {
- return Array(4 - n.toString().length).join('0') + n;
-}
-
-/**
- * Create a migration with the given `name`.
- *
- * @param {String} name
- */
-
-function create(name) {
- var path = 'migrations/' + name + '.js';
- log('create', join(cwd, path));
- fs.writeFileSync(path, template);
-}
-
-/**
- * Perform a migration in the given `direction`.
- *
- * @param {Number} direction
- */
-
-function performMigration(direction, migrationName) {
- migrate('migrations/.migrate');
- migrations().forEach(function(path){
- var mod = require(process.cwd() + '/' + path);
- migrate(path, mod.up, mod.down);
- });
-
- var set = migrate();
-
- set.on('migration', function(migration, direction){
- log(direction, migration.title);
- });
-
- set.on('save', function(){
- log('migration', 'complete');
- process.exit();
- });
-
- var migrationPath = migrationName
- ? join('migrations', migrationName)
- : migrationName;
-
- set[direction](null, migrationPath);
-}
-
-// invoke command
-
-// Load the core
-global._coreOnly_ = true;
-require('../core/init');
-
-var command = options.command || 'up';
-if (!(command in commands)) abort('unknown command "' + command + '"');
-command = commands[command];
-command.apply(this, options.args);
View
12 node_modules/migrate/examples/cli/migrations/000-add-pets.js
@@ -1,12 +0,0 @@
-
-var db = require('./db');
-
-exports.up = function(next){
- db.rpush('pets', 'tobi');
- db.rpush('pets', 'loki', next);
-};
-
-exports.down = function(next){
- db.rpop('pets');
- db.rpop('pets', next);
-};
View
10 node_modules/migrate/examples/cli/migrations/001-add-jane.js
@@ -1,10 +0,0 @@
-
-var db = require('./db');
-
-exports.up = function(next){
- db.rpush('pets', 'jane', next);
-};
-
-exports.down = function(next){
- db.rpop('pets', next);
-};
View
12 node_modules/migrate/examples/cli/migrations/002-add-owners.js
@@ -1,12 +0,0 @@
-
-var db = require('./db');
-
-exports.up = function(next){
- db.rpush('owners', 'taylor');
- db.rpush('owners', 'tj', next);
-};
-
-exports.down = function(next){
- db.rpop('owners');
- db.rpop('owners', next);
-};
View
10 node_modules/migrate/examples/cli/migrations/003-coolest-pet.js
@@ -1,10 +0,0 @@
-
-var db = require('./db');
-
-exports.up = function(next){
- db.set('pets:coolest', 'tobi', next);
-};
-
-exports.down = function(next){
- db.del('pets:coolest', next);
-};
View
10 node_modules/migrate/examples/cli/migrations/db.js
@@ -1,10 +0,0 @@
-
-// bad example, but you get the point ;)
-
-// $ npm install redis
-// $ redis-server
-
-var redis = require('redis')
- , db = redis.createClient();
-
-module.exports = db;
View
55 node_modules/migrate/examples/migrate.js
@@ -1,55 +0,0 @@
-
-// bad example, but you get the point ;)
-
-// $ npm install redis
-// $ redis-server
-
-var migrate = require('../')
- , redis = require('redis')
- , db = redis.createClient();
-
-migrate(__dirname + '/.migrate');
-
-migrate('add pets', function(next){
- db.rpush('pets', 'tobi');
- db.rpush('pets', 'loki', next);
-}, function(next){
- db.rpop('pets');
- db.rpop('pets', next);
-});
-
-migrate('add jane', function(next){
- db.rpush('pets', 'jane', next);
-}, function(next){
- db.rpop('pets', next);
-});
-
-migrate('add owners', function(next){
- db.rpush('owners', 'taylor');
- db.rpush('owners', 'tj', next);
-}, function(next){
- db.rpop('owners');
- db.rpop('owners', next);
-});
-
-migrate('coolest pet', function(next){
- db.set('pets:coolest', 'tobi', next);
-}, function(next){
- db.del('pets:coolest', next);
-});
-
-var set = migrate();
-
-console.log();
-set.on('save', function(){
- console.log();
-});
-
-set.on('migration', function(migration, direction){
- console.log(' \033[90m%s\033[0m \033[36m%s\033[0m', direction, migration.title);
-});
-
-set.up(function(err){
- if (err) throw err;
- process.exit();
-});
View
2 node_modules/migrate/index.js
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/migrate');
View
41 node_modules/migrate/lib/migrate.js
@@ -1,41 +0,0 @@
-
-/*!
- * migrate
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var Migration = require('./migration')
- , Set = require('./set');
-
-/**
- * Expose the migrate function.
- */
-
-exports = module.exports = migrate;
-
-/**
- * Library version.
- */
-
-exports.version = '0.1.1';
-
-function migrate(title, up, down) {
- // migration
- if ('string' == typeof title && up && down) {
- migrate.set.migrations.push(new Migration(title, up, down));
- // specify migration file
- } else if ('string' == typeof title) {
- migrate.set = new Set(title);
- // no migration path
- } else if (!migrate.set) {
- throw new Error('must invoke migrate(path) before running migrations');
- // run migrations
- } else {
- return migrate.set;
- }
-}
View
18 node_modules/migrate/lib/migration.js
@@ -1,18 +0,0 @@
-
-/*!
- * migrate - Migration
- * Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Expose `Migration`.
- */
-
-module.exports = Migration;
-
-function Migration(title, up, down) {
- this.title = title;
- this.up = up;
- this.down = down;
-}
View
180 node_modules/migrate/lib/set.js
@@ -1,180 +0,0 @@
-
-/*!
- * migrate - Set
- * Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter
- , fs = require('fs');
-
-/**
- * Expose `Set`.
- */
-
-module.exports = Set;
-
-/**
- * Initialize a new migration `Set` with the given `path`
- * which is used to store data between migrations.
- *
- * @param {String} path
- * @api private
- */
-
-function Set(path) {
- this.migrations = [];
- this.path = path;
- this.pos = 0;
-};
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-Set.prototype.__proto__ = EventEmitter.prototype;
-
-/**
- * Save the migration data and call `fn(err)`.
- *
- * @param {Function} fn
- * @api public
- */
-
-Set.prototype.save = function(fn){
- var self = this
- , json = JSON.stringify(this);
- fs.writeFile(this.path, json, function(err){
- self.emit('save');
- fn && fn(err);
- });
-};
-
-/**
- * Load the migration data and call `fn(err, obj)`.
- *
- * @param {Function} fn
- * @return {Type}
- * @api public
- */
-
-Set.prototype.load = function(fn){
- this.emit('load');
- fs.readFile(this.path, 'utf8', function(err, json){
- if (err) return fn(err);
- try {
- fn(null, JSON.parse(json));
- } catch (err) {
- fn(err);
- }
- });
-};
-
-/**
- * Run down migrations and call `fn(err)`.
- *
- * @param {Function} fn
- * @api public
- */
-
-Set.prototype.down = function(fn, migrationName){
- this.migrate('down', fn, migrationName);
-};
-
-/**
- * Run up migrations and call `fn(err)`.
- *
- * @param {Function} fn
- * @api public
- */
-
-Set.prototype.up = function(fn, migrationName){
- this.migrate('up', fn, migrationName);
-};
-
-/**
- * Migrate in the given `direction`, calling `fn(err)`.
- *
- * @param {String} direction
- * @param {Function} fn
- * @api public
- */
-
-Set.prototype.migrate = function(direction, fn, migrationName){
- var self = this;
- fn = fn || function(){};
- this.load(function(err, obj){
- if (err) {
- if ('ENOENT' != err.code) return fn(err);
- } else {
- self.pos = obj.pos;
- }
- self._migrate(direction, fn, migrationName);
- });
-};
-
-/**
- * Get index of given migration in list of migrations
- *
- * @api private
- */
-
- function positionOfMigration(migrations, filename) {
- for(var i=0; i < migrations.length; ++i) {
- if (migrations[i].title == filename) return i;
- }
- return -1;
- }
-
-/**
- * Perform migration.
- *
- * @api private
- */
-
-Set.prototype._migrate = function(direction, fn, migrationName){
- var self = this
- , migrations
- , migrationPos;
-
- if (!migrationName) {
- migrationPos = direction == 'up' ? this.migrations.length : 0;
- } else if ((migrationPos = positionOfMigration(this.migrations, migrationName)) == -1) {
- console.error("Could not find migration: " + migrationName);
- process.exit(1);
- }
-
- switch (direction) {
- case 'up':
- migrations = this.migrations.slice(this.pos, migrationPos+1);
- this.pos += migrations.length;
- break;
- case 'down':
- migrations = this.migrations.slice(migrationPos, this.pos).reverse();
- this.pos -= migrations.length;
- break;
- }
-
- function next(err, migration) {
- // error from previous migration
- if (err) return fn(err);
-
- // done
- if (!migration) {
- self.emit('complete');
- self.save(fn);
- return;
- }
-
- self.emit('migration', migration, direction);
- migration[direction](function(err){
- next(err, migrations.shift());
- });
- }
-
- next(null, migrations.shift());
-};
View
14 node_modules/migrate/package.json
@@ -1,14 +0,0 @@
-{
- "name": "migrate"
- , "version": "0.1.1"
- , "description": "Abstract migration framework for node"
- , "keywords": ["migrate", "migrations"]
- , "author": "TJ Holowaychuk <tj@vision-media.ca>"
- , "repository": "git://github.com/visionmedia/node-migrate"
- , "bin": { "migrate": "./bin/migrate" }
- , "devDependencies": {
- "should": ">= 0.0.1"
- }
- , "main": "index"
- , "engines": { "node": ">= 0.4.x < 0.7.0" }
-}
View
217 node_modules/migrate/test/test.migrate.js
@@ -1,217 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var migrate = require('../')
- , should = require('should')
- , fs = require('fs');
-
-// remove migration file
-
-try {
- fs.unlinkSync(__dirname + '/.migrate');
-} catch (err) {
- // ignore
-}
-
-// dummy db
-
-var db = { pets: [] };
-
-// dummy migrations
-
-migrate(__dirname + '/.migrate');
-
-migrate('add guy ferrets', function(next){
- db.pets.push({ name: 'tobi' });
- db.pets.push({ name: 'loki' });
- next();
-}, function(next){
- db.pets.pop();
- db.pets.pop();
- next();
-});
-
-migrate('add girl ferrets', function(next){
- db.pets.push({ name: 'jane' });
- next();
-}, function(next){
- db.pets.pop();
- next();
-});
-
-migrate('add emails', function(next){
- db.pets.forEach(function(pet){
- pet.email = pet.name + '@learnboost.com';
- });
- next();
-}, function(next){
- db.pets.forEach(function(pet){
- delete pet.email;
- });
- next();
-});
-
-// tests
-
-migrate.version.should.match(/^\d+\.\d+\.\d+$/);
-
-// test migrating up / down several times
-
-var set = migrate();
-
-set.up(function(){
- assertPets();
- set.up(function(){
- assertPets();
- set.down(function(){
- assertNoPets();
- set.down(function(){
- assertNoPets();
- set.up(function(){
- assertPets();
- testNewMigrations();
- });
- });
- });
- });
-});
-
-// test adding / running new migrations
-
-function testNewMigrations() {
- migrate('add dogs', function(next){
- db.pets.push({ name: 'simon' });
- db.pets.push({ name: 'suki' });
- next();
- }, function(next){
- db.pets.pop();
- db.pets.pop();
- next();
- });
-
- set.up(function(){
- assertPets.withDogs();
- set.up(function(){
- assertPets.withDogs();
- set.down(function(){
- assertNoPets();
- testMigrationEvents();
- });
- });
- });
-}
-
-// test events
-
-function testMigrationEvents() {
- migrate('adjust emails', function(next){
- db.pets.forEach(function(pet){
- if (pet.email)
- pet.email = pet.email.replace('learnboost.com', 'lb.com');
- });
- next();
- }, function(next){
- db.pets.forEach(function(pet){
- if (pet.email)
- pet.email = pet.email.replace('lb.com', 'learnboost.com');
- });
- next();
- });
-
- var migrations = []
- , completed = 0
- , expectedMigrations = [
- 'add guy ferrets'
- , 'add girl ferrets'
- , 'add emails'
- , 'add dogs'
- , 'adjust emails'];
-
- set.on('migration', function(migration, direction){
- migrations.push(migration.title);
- direction.should.be.a('string');
- });
-
- set.on('complete', function(){
- ++completed;
- });
-
- set.up(function(){
- db.pets[0].email.should.equal('tobi@lb.com');
- migrations.should.eql(expectedMigrations);
- completed.should.equal(1);
-
- migrations = [];
- set.down(function(){
- migrations.should.eql(expectedMigrations.reverse());
- completed.should.equal(2);
- assertNoPets();
- testNamedMigrations();
- });
- });
-}
-
-// test migrations when migration name is given
-
-function testNamedMigrations() {
- assertNoPets();
- set.up(function() {
- assertFirstMigration();
- set.up(function() {
- assertSecondMigration();
- set.down(function() {
- assertFirstMigration();
- set.up(function() {
- assertSecondMigration();
- set.down(function() {
- set.pos.should.equal(1);
- }, 'add girl ferrets');
- },'add girl ferrets');
- }, 'add girl ferrets');
- },'add girl ferrets');
- }, 'add guy ferrets');
-}
-
-// helpers
-
-function assertNoPets() {
- db.pets.should.be.empty;
- set.pos.should.equal(0);
-}
-
-function assertPets() {
- db.pets.should.have.length(3);
- db.pets[0].name.should.equal('tobi');
- db.pets[0].email.should.equal('tobi@learnboost.com');
- set.pos.should.equal(3);
-}
-
-function assertFirstMigration() {
- db.pets.should.have.length(2);
- db.pets[0].name.should.equal('tobi');
- db.pets[1].name.should.equal('loki');
- set.pos.should.equal(1);
-}
-
-function assertSecondMigration() {
- db.pets.should.have.length(3);
- db.pets[0].name.should.equal('tobi');
- db.pets[1].name.should.equal('loki');
- db.pets[2].name.should.equal('jane');
- set.pos.should.equal(2);
-}
-
-assertPets.withDogs = function(){
- db.pets.should.have.length(5);
- db.pets[0].name.should.equal('tobi');
- db.pets[0].email.should.equal('tobi@learnboost.com');
- db.pets[4].name.should.equal('suki');
-};
-
-// status
-
-process.on('exit', function(){
- console.log('\n ok\n');
-});
View
1 node_modules/wrench/.gitignore
@@ -1 +0,0 @@
-node_modules
View
21 node_modules/wrench/LICENSE
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2010 Ryan McGrath
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
View
396 node_modules/wrench/lib/wrench.js
@@ -1,396 +0,0 @@
-/* wrench.js
- *
- * A collection of various utility functions I've found myself in need of
- * for use with Node.js (http://nodejs.org/). This includes things like:
- *
- * - Recursively deleting directories in Node.js (Sync, not Async)
- * - Recursively copying directories in Node.js (Sync, not Async)
- * - Recursively chmoding a directory structure from Node.js (Sync, not Async)
- * - Other things that I'll add here as time goes on. Shhhh...
- *
- * ~ Ryan McGrath (ryan [at] venodesigns.net)
- */
-
-var fs = require("fs"),
- _path = require("path");
-
-
-/* wrench.readdirSyncRecursive("directory_path");
- *
- * Recursively dives through directories and read the contents of all the
- * children directories.
- */
-exports.readdirSyncRecursive = function(baseDir) {
- baseDir = baseDir.replace(/\/$/, '');
-
- var readdirSyncRecursive = function(baseDir) {
- var files = [],
- curFiles,
- nextDirs,
- isDir = function(fname){
- return fs.statSync( _path.join(baseDir, fname) ).isDirectory();
- },
- prependBaseDir = function(fname){
- return _path.join(baseDir, fname);
- };
-
- curFiles = fs.readdirSync(baseDir);
- nextDirs = curFiles.filter(isDir);
- curFiles = curFiles.map(prependBaseDir);
-
- files = files.concat( curFiles );
-
- while (nextDirs.length) {
- files = files.concat( readdirSyncRecursive( _path.join(baseDir, nextDirs.shift()) ) );
- }
-
- return files;
- };
-
- // convert absolute paths to relative
- var fileList = readdirSyncRecursive(baseDir).map(function(val){
- return val.replace(baseDir + '/', '');
- });
-
- return fileList;
-};
-
-/* wrench.readdirRecursive("directory_path", function(error, files) {});
- *
- * Recursively dives through directories and read the contents of all the
- * children directories.
- *
- * Asynchronous, so returns results/error in callback.
- * Callback receives the of files in currently recursed directory.
- * When no more directories are left, callback is called with null for all arguments.
- *
- */
-exports.readdirRecursive = function(baseDir, fn) {
- baseDir = baseDir.replace(/\/$/, '');
-
- var waitCount = 0;
-
- function readdirRecursive(curDir) {
- var files = [],
- curFiles,
- nextDirs,
- prependcurDir = function(fname){
- return _path.join(curDir, fname);
- };
-
- waitCount++;
- fs.readdir(curDir, function(e, curFiles) {
- waitCount--;
-
- curFiles = curFiles.map(prependcurDir);
-
- curFiles.forEach(function(it) {
- waitCount++;
-
- fs.stat(it, function(e, stat) {
- waitCount--;
-
- if (e) {
- fn(e);
- } else {
- if (stat.isDirectory()) {
- readdirRecursive(it);
- }
- }
-
- if (waitCount == 0) {
- fn(null, null);
- }
- });
- });
-
- fn(null, curFiles.map(function(val) {
- // convert absolute paths to relative
- return val.replace(baseDir + '/', '');
- }));
-
- if (waitCount == 0) {
- fn(null, null);
- }
- });
- };
-
- readdirRecursive(baseDir);
-};
-
-
-
-/* wrench.rmdirSyncRecursive("directory_path", forceDelete, failSilent);
- *
- * Recursively dives through directories and obliterates everything about it. This is a
- * Sync-function, which blocks things until it's done. No idea why anybody would want an
- * Asynchronous version. :\
- */
-exports.rmdirSyncRecursive = function(path, failSilent) {
- var files;
-
- try {
- files = fs.readdirSync(path);
- } catch (err) {
- if(failSilent) return;
- throw new Error(err.message);
- }
-
- /* Loop through and delete everything in the sub-tree after checking it */
- for(var i = 0; i < files.length; i++) {
- var currFile = fs.lstatSync(path + "/" + files[i]);
-
- if(currFile.isDirectory()) // Recursive function back to the beginning
- exports.rmdirSyncRecursive(path + "/" + files[i]);
-
- else if(currFile.isSymbolicLink()) // Unlink symlinks
- fs.unlinkSync(path + "/" + files[i]);
-
- else // Assume it's a file - perhaps a try/catch belongs here?
- fs.unlinkSync(path + "/" + files[i]);
- }
-
- /* Now that we know everything in the sub-tree has been deleted, we can delete the main
- directory. Huzzah for the shopkeep. */
- return fs.rmdirSync(path);
-};
-
-/* wrench.copyDirSyncRecursive("directory_to_copy", "new_directory_location", opts);
- *
- * Recursively dives through a directory and moves all its files to a new location. This is a
- * Synchronous function, which blocks things until it's done. If you need/want to do this in
- * an Asynchronous manner, look at wrench.copyDirRecursively() below.
- *
- * Note: Directories should be passed to this function without a trailing slash.
- */
-exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
-
- if (!opts || !opts.preserve) {
- try {
- if(fs.statSync(newDirLocation).isDirectory()) exports.rmdirSyncRecursive(newDirLocation);
- } catch(e) { }
- }
-
- /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
- var checkDir = fs.statSync(sourceDir);
- try {
- fs.mkdirSync(newDirLocation, checkDir.mode);
- } catch (e) {
- //if the directory already exists, that's okay
- if (e.code !== 'EEXIST') throw e;
- }
-
- var files = fs.readdirSync(sourceDir);
-
- for(var i = 0; i < files.length; i++) {
- var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
-
- if(currFile.isDirectory()) {
- /* recursion this thing right on back. */
- exports.copyDirSyncRecursive(sourceDir + "/" + files[i], newDirLocation + "/" + files[i], opts);
- } else if(currFile.isSymbolicLink()) {
- var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]);
- fs.symlinkSync(symlinkFull, newDirLocation + "/" + files[i]);
- } else {
- /* At this point, we've hit a file actually worth copying... so copy it on over. */
- var contents = fs.readFileSync(sourceDir + "/" + files[i]);
- fs.writeFileSync(newDirLocation + "/" + files[i], contents);
- }
- }
-};
-
-/* wrench.chmodSyncRecursive("directory", filemode);
- *
- * Recursively dives through a directory and chmods everything to the desired mode. This is a
- * Synchronous function, which blocks things until it's done.
- *
- * Note: Directories should be passed to this function without a trailing slash.
- */
-exports.chmodSyncRecursive = function(sourceDir, filemode) {
- var files = fs.readdirSync(sourceDir);
-
- for(var i = 0; i < files.length; i++) {
- var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
-
- if(currFile.isDirectory()) {
- /* ...and recursion this thing right on back. */
- exports.chmodSyncRecursive(sourceDir + "/" + files[i], filemode);
- } else {
- /* At this point, we've hit a file actually worth copying... so copy it on over. */
- fs.chmod(sourceDir + "/" + files[i], filemode);
- }
- }
-
- /* Finally, chmod the parent directory */
- fs.chmod(sourceDir, filemode);
-};
-
-
-/* wrench.chownSyncRecursive("directory", uid, gid);
- *
- * Recursively dives through a directory and chowns everything to the desired user and group. This is a
- * Synchronous function, which blocks things until it's done.
- *
- * Note: Directories should be passed to this function without a trailing slash.
- */
-exports.chownSyncRecursive = function(sourceDir, uid, gid) {
- var files = fs.readdirSync(sourceDir);
-
- for(var i = 0; i < files.length; i++) {
- var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
-
- if(currFile.isDirectory()) {
- /* ...and recursion this thing right on back. */
- exports.chownSyncRecursive(sourceDir + "/" + files[i], uid, gid);
- } else {
- /* At this point, we've hit a file actually worth chowning... so own it. */
- fs.chownSync(sourceDir + "/" + files[i], uid, gid);
- }
- }
-
- /* Finally, chown the parent directory */
- fs.chownSync(sourceDir, uid, gid);
-};
-
-
-
-/* wrench.rmdirRecursive("directory_path", callback);
- *
- * Recursively dives through directories and obliterates everything about it.
- */
-exports.rmdirRecursive = function rmdirRecursive(dir, clbk){
- fs.readdir(dir, function(err, files){
- if (err) return clbk(err);
- (function rmFile(err){
- if (err) return clbk(err);
-
- var filename = files.shift();
- if (filename === null || typeof filename == 'undefined')
- return fs.rmdir(dir, clbk);
-
- var file = dir+'/'+filename;
- fs.stat(file, function(err, stat){
- if (err) return clbk(err);
- if (stat.isDirectory())
- rmdirRecursive(file, rmFile);
- else
- fs.unlink(file, rmFile);
- });
- })();
- });
-};
-
-/* wrench.copyDirRecursive("directory_to_copy", "new_location", callback);
- *
- * Recursively dives through a directory and moves all its files to a new
- * location.
- *
- * Note: Directories should be passed to this function without a trailing slash.
- */
-exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, clbk) {
- fs.stat(newDir, function(err, newDirStat){
- if (!err) return exports.rmdirRecursive(newDir, function(err){
- copyDirRecursive(srcDir, newDir, clbk);
- });
-
- fs.stat(srcDir, function(err, srcDirStat){
- if (err) return clbk(err);
- fs.mkdir(newDir, srcDirStat.mode, function(err){
- if (err) return clbk(err);
- fs.readdir(srcDir, function(err, files){
- if (err) return clbk(err);
- (function copyFiles(err){
- if (err) return clbk(err);
-
- var filename = files.shift();
- if (filename === null || typeof filename == 'undefined')
- return clbk();
-
- var file = srcDir+'/'+filename,
- newFile = newDir+'/'+filename;
-
- fs.stat(file, function(err, fileStat){
- if (fileStat.isDirectory())
- copyDirRecursive(file, newFile, copyFiles);
- else if (fileStat.isSymbolicLink())
- fs.readlink(file, function(err, link){
- fs.symlink(link, newFile, copyFiles);
- });
- else
- fs.readFile(file, function(err, data){
- fs.writeFile(newFile, data, copyFiles);
- });
- });
- })();
- });
- });
- });
- });
-};
-
-var mkdirSyncRecursive = function(path, mode) {
- var self = this;
-
- try {
- fs.mkdirSync(path, mode);
- } catch(err) {
- if(err.code == "ENOENT") {
- var slashIdx = path.lastIndexOf("/");
- if(slashIdx < 0) {
- slashIdx = path.lastIndexOf("\\");
- }
-
- if(slashIdx > 0) {
- var parentPath = path.substring(0, slashIdx);
- mkdirSyncRecursive(parentPath, mode);
- mkdirSyncRecursive(path, mode);
- } else {
- throw err;
- }
- } else if(err.code == "EEXIST") {
- return;
- } else {
- throw err;
- }
- }
-};
-exports.mkdirSyncRecursive = mkdirSyncRecursive;
-
-exports.LineReader = function(filename, bufferSize) {
- this.bufferSize = bufferSize || 8192;
- this.buffer = "";
- this.fd = fs.openSync(filename, "r");
- this.currentPosition = 0;
-};
-
-exports.LineReader.prototype = {
- getBufferAndSetCurrentPosition: function(position) {
- var res = fs.readSync(this.fd, this.bufferSize, position, "ascii");
-
- this.buffer += res[0];
- if(res[1] === 0) return -1;
-
- this.currentPosition = position + res[1];
- return this.currentPosition;
- },
-
- hasNextLine: function() {
- while(this.buffer.indexOf('\n') === -1) {
- this.getBufferAndSetCurrentPosition(this.currentPosition);
- if(this.currentPosition === -1) return false;
- }
-
- if(this.buffer.indexOf("\n") > -1) return true;
- return false;
- },
-
- getNextLine: function() {
- var lineEnd = this.buffer.indexOf("\n"),
- result = this.buffer.substring(0, lineEnd);
-
- this.buffer = this.buffer.substring(result.length + 1, this.buffer.length);
- return result;
- }
-};
-
-// vim: et ts=4 sw=4
View
1 node_modules/wrench/lib/x.js
@@ -1 +0,0 @@
-require('./wrench').mkdirsSyncRecursive('x/lol/b', 777);
View
42 node_modules/wrench/package.json
@@ -1,42 +0,0 @@
-{
- "name": "wrench",
- "description": "Recursive filesystem (and other) operations that Node *should* have.",
- "version": "1.3.6",
- "author": "Ryan McGrath <ryan@venodesigns.net>",
-
- "repository": {
- "type" : "git",
- "url": "https://ryanmcgrath@github.com/ryanmcgrath/wrench-js.git"
- },
-
- "bugs": {
- "url": "http://github.com/ryanmcgrath/wrench-js/issues"
- },
-
- "os": [ "linux", "darwin", "freebsd" ],
-
- "directories": {
- "lib": "./lib/"
- },
-
- "dependencies": {
- },
-
- "devDependencies": {
- "nodeunit": ">= 0.6.4",
- "underscore": ">= 1.3.1"
- },
-
- "main": "./lib/wrench",
-
- "engines": {
- "node": ">=0.1.97"
- },
-
- "scripts": { "test": "./node_modules/nodeunit/bin/nodeunit tests/runner.js" },
-
- "licenses": [{
- "type" : "MIT",
- "url" : "http://github.com/ryanmcgrath/wrench-js/raw/master/LICENSE"
- }]
-}
View
64 node_modules/wrench/readme.md
@@ -1,64 +0,0 @@
-wrench.js - Recursive file operations in Node.js
-----------------------------------------------------------------------------
-While I love Node.js, I've found myself missing some functions. Things like
-recursively deleting/chmodding a directory (or even deep copying a directory),
-or even a basic line reader, shouldn't need to be re-invented time and time again.
-
-That said, here's my attempt at a re-usable solution, at least until something
-more formalized gets integrated into Node.js (*hint hint*). wrench.js is fairly simple
-to use - check out the documentation/examples below:
-
-Installation
------------------------------------------------------------------------------
-
- npm install wrench
-
-Usage
------------------------------------------------------------------------------
-``` javascript
-var wrench = require('wrench'),
- util = require('util');
-```
-
-### Synchronous operations
-``` javascript
-// Recursively create directories, sub-trees and all.
-wrench.mkdirSyncRecursive(dir, 0777);
-
-// Recursively delete the entire sub-tree of a directory, then kill the directory
-wrench.rmdirSyncRecursive('my_directory_name', failSilently);
-
-// Recursively read directories contents.
-wrench.readdirSyncRecursive('my_directory_name');
-
-// Recursively chmod the entire sub-tree of a directory
-wrench.chmodSyncRecursive('my_directory_name', 0755);
-
-// Recursively chown the entire sub-tree of a directory
-wrench.chownSyncRecursive("directory", uid, gid);
-
-// Deep-copy an existing directory
-wrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up');
-
-// Read lines in from a file until you hit the end
-var f = new wrench.LineReader('x.txt');
-while(f.hasNextLine()) {
- util.puts(x.getNextLine());
-}
-```
-
-### Asynchronous operations
-``` javascript
-// Recursively read directories contents
-var files = [];
-wrench.readdirRecursive('my_directory_name', function(error, curFiles) {
- if (files) {
- files = files.concat(curFiles);
- } else {
- // files list contains all the directory contents now
- }
-});
-
-```
-
-Questions, comments? Hit me up. (ryan [at] venodesigns.net | http://twitter.com/ryanmcgrath)
View
26 node_modules/wrench/tests/mkdir.js
@@ -1,26 +0,0 @@
-var testCase = require('nodeunit').testCase;
-var fs = require('fs');
-var wrench = require('../lib/wrench');
-var path = require('path');
-
-module.exports = testCase({
- test_mkdirSyncRecursive: function(test) {
- var dir = __dirname + '/_tmp/foo/bar';
-
- test.equals(path.existsSync(dir), false, 'Dir shouldn\'t exist - clean it up manually?');
-
- wrench.mkdirSyncRecursive(dir, 0777);
-
- test.equals(path.existsSync(dir), true, 'Dir should exist now');
-
- // clean up
- while (dir != __dirname) {
- fs.rmdirSync(dir);
- dir = path.dirname(dir);
- }
-
- test.done();
- },
-});
-
-// vim: et ts=4 sw=4
View
57 node_modules/wrench/tests/readdir.js
@@ -1,57 +0,0 @@
-var testCase = require('nodeunit').testCase;
-var fs = require('fs');
-var wrench = require('../lib/wrench');
-var path = require('path');
-var _und = require("underscore");
-
-
-function checkResult(test, files) {
- var check = [
- 'bar.txt',
- 'foo',
- 'foo/bar',
- 'foo/dolor.md',
- 'foo/lorem.txt',
- 'foo/bar/ipsum.js'
- ];
-
- test.equals(files.length, check.length, 'number of paths is correct');
-
- _und.each(check, function(it) {
- test.ok(_und.include(files, it), 'path ' + it + ' should be returned');
- });
-
- test.done();
-}
-
-module.exports = testCase({
- test_readdirSyncRecursive: function(test) {
- var dir = __dirname + '/readdir';
-
- test.ok(path.existsSync(dir), 'Folders should exist');
-
- var files = wrench.readdirSyncRecursive(dir);
-
- checkResult(test, files);
- },
-
- test_readdirRecursive: function(test) {
- var dir = __dirname + '/readdir';
-
- test.ok(path.existsSync(dir), 'Folders should exist');
-
- var allFiles = [];
-
- wrench.readdirRecursive(dir, function(e, files) {
- if (e) throw e;
-
- if (files) {
- allFiles = allFiles.concat(files);
- } else {
- checkResult(test, allFiles);
- }
- });
- }
-});
-
-// vim: et ts=4 sw=4
View
0 node_modules/wrench/tests/readdir/bar.txt
No changes.
View
0 node_modules/wrench/tests/readdir/foo/bar/ipsum.js
No changes.
View
0 node_modules/wrench/tests/readdir/foo/dolor.md
No changes.
View
0 node_modules/wrench/tests/readdir/foo/lorem.txt
No changes.
View
7 node_modules/wrench/tests/runner.js
@@ -1,7 +0,0 @@
-// `nodeunit tests/runner`
-// will run all the tests
-
-module.exports = {
- group_mkdir: require('./mkdir'),
- group_readdir: require('./readdir')
-};
View
3 package.json
@@ -14,7 +14,8 @@
},
"dependencies": {
"wrench": "1.3.6",
- "migrate": "0.1.1"
+ "migrate": "0.1.1",
+ "gitjs": "0.0.4"
},
"devDependencies": {}
}

0 comments on commit c0db788

Please sign in to comment.
Something went wrong with that request. Please try again.