From 28e93f79ee7cb49ee8e1656bc554276ec7407d19 Mon Sep 17 00:00:00 2001 From: Simon Boudrias Date: Sun, 14 Feb 2016 14:56:04 -0800 Subject: [PATCH] Update dependencies --- lib/run-context.js | 5 +++- package.json | 8 +++--- .../custom-generator-simple/package.json | 12 -------- .../main.js => generator-simple/app/index.js} | 0 test/helpers.js | 12 ++++---- test/run-context.js | 28 ++++++++++--------- 6 files changed, 30 insertions(+), 35 deletions(-) delete mode 100644 test/fixtures/custom-generator-simple/package.json rename test/fixtures/{custom-generator-simple/main.js => generator-simple/app/index.js} (100%) diff --git a/lib/run-context.js b/lib/run-context.js index 69adb55..fe23b2f 100644 --- a/lib/run-context.js +++ b/lib/run-context.js @@ -118,7 +118,10 @@ RunContext.prototype._run = function () { RunContext.prototype.inDir = function (dirPath, cb) { this.inDirSet = true; var release = this.async(); - var callBackThenRelease = _.compose(release, (cb || _.noop).bind(this, path.resolve(dirPath))); + var callBackThenRelease = _.flowRight( + release, + (cb || _.noop).bind(this, path.resolve(dirPath)) + ); helpers.testDirectory(dirPath, callBackThenRelease); return this; }; diff --git a/package.json b/package.json index 12c29bb..47564e5 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,12 @@ }, "license": "MIT", "dependencies": { - "inquirer": "^0.11.0", - "lodash": "^3.10.1", + "inquirer": "^0.12.0", + "lodash": "^4.3.0", "mkdirp": "^0.5.1", "rimraf": "^2.4.4", "sinon": "^1.17.2", - "yeoman-environment": "^1.3.0", - "yeoman-generator": "^0.21.1" + "yeoman-environment": "^1.5.2", + "yeoman-generator": "^0.22.5" } } diff --git a/test/fixtures/custom-generator-simple/package.json b/test/fixtures/custom-generator-simple/package.json deleted file mode 100644 index f7f5a6b..0000000 --- a/test/fixtures/custom-generator-simple/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "author": "", - "name": "custom-generator-simple", - "version": "0.0.0", - "main": "main.js", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - } -} diff --git a/test/fixtures/custom-generator-simple/main.js b/test/fixtures/generator-simple/app/index.js similarity index 100% rename from test/fixtures/custom-generator-simple/main.js rename to test/fixtures/generator-simple/app/index.js diff --git a/test/helpers.js b/test/helpers.js index 6a8c009..443e222 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -1,13 +1,13 @@ -/*global it, describe, before, beforeEach, afterEach */ 'use strict'; var util = require('util'); var path = require('path'); var assert = require('assert'); var sinon = require('sinon'); var RunContext = require('../lib/run-context'); -var yeoman = require('yeoman-generator'); +var yeoman = require('yeoman-environment'); +var generators = require('yeoman-generator'); var helpers = require('../lib'); -var env = yeoman(); +var env = yeoman.createEnv(); describe('yeoman-test', function () { beforeEach(function () { @@ -19,12 +19,14 @@ describe('yeoman-test', function () { self.options = options; }; - util.inherits(this.StubGenerator, yeoman.Base); + util.inherits(this.StubGenerator, generators.Base); }); describe('.registerDependencies()', function () { it('accepts dependency as a path', function () { - helpers.registerDependencies(env, ['./custom-generator-simple']); + helpers.registerDependencies(env, [ + require.resolve('./fixtures/generator-simple/app') + ]); assert(env.get('simple:app')); }); diff --git a/test/run-context.js b/test/run-context.js index b399b66..b3eef39 100644 --- a/test/run-context.js +++ b/test/run-context.js @@ -1,4 +1,3 @@ -/*global it, describe, before, beforeEach, afterEach */ 'use strict'; var os = require('os'); var fs = require('fs'); @@ -37,7 +36,9 @@ describe('RunContext', function () { describe('constructor', function () { it('accept path parameter', function (done) { - var ctx = new RunContext(path.join(__dirname, './fixtures/custom-generator-simple')); + var ctx = new RunContext( + require.resolve('./fixtures/generator-simple/app') + ); ctx .on('ready', function () { @@ -211,16 +212,17 @@ describe('RunContext', function () { it('optional `cb` can use `this.async()` to delay execution', function (done) { var ctx = new RunContext(this.Dummy); var delayed = false; - var cb = sinon.spy(function () { - var release = this.async(); - - setTimeout(function () { - delayed = true; - release(); - }, 1); - }); - ctx.inDir(this.tmp, cb) + ctx + .inDir(this.tmp, function () { + console.log('inDir callback'); + var release = this.async(); + + setTimeout(function () { + delayed = true; + release(); + }, 1); + }) .on('ready', function () { assert(delayed); }) @@ -394,7 +396,7 @@ describe('RunContext', function () { describe('#withGenerators()', function () { it('register paths', function (done) { this.ctx.withGenerators([ - path.join(__dirname, './fixtures/custom-generator-simple') + require.resolve('./fixtures/generator-simple/app') ]).on('ready', function () { assert(this.ctx.env.get('simple:app')); done(); @@ -412,7 +414,7 @@ describe('RunContext', function () { it('allow multiple calls', function (done) { this.ctx.withGenerators([ - path.join(__dirname, './fixtures/custom-generator-simple') + require.resolve('./fixtures/generator-simple/app') ]).withGenerators([ [helpers.createDummyGenerator(), 'dummy:gen'] ]).on('ready', function () {