commit nodejs-promzard for openSUSE:Factory

Hello community, here is the log from the commit of package nodejs-promzard for openSUSE:Factory checked in at 2015-07-02 22:39:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-promzard (Old) and /work/SRC/openSUSE:Factory/.nodejs-promzard.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nodejs-promzard" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-promzard/nodejs-promzard.changes 2015-04-27 13:03:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-promzard.new/nodejs-promzard.changes 2015-07-02 22:39:36.000000000 +0200 @@ -1,0 +2,5 @@ +Sat Jun 6 11:35:42 UTC 2015 - i@marguerite.su + +- update version 0.3.0 + +------------------------------------------------------------------- Old: ---- promzard-0.2.2.tgz New: ---- promzard-0.3.0.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-promzard.spec ++++++ --- /var/tmp/diff_new_pack.KBjZma/_old 2015-07-02 22:39:36.000000000 +0200 +++ /var/tmp/diff_new_pack.KBjZma/_new 2015-07-02 22:39:36.000000000 +0200 @@ -19,7 +19,7 @@ %define base_name promzard Name: nodejs-promzard -Version: 0.2.2 +Version: 0.3.0 Release: 0 Summary: Node.js prompting wizard License: ISC ++++++ promzard-0.2.2.tgz -> promzard-0.3.0.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/example/buffer.js new/package/example/buffer.js --- old/package/example/buffer.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/example/buffer.js 2015-03-14 21:39:03.000000000 +0100 @@ -0,0 +1,12 @@ +var pz = require('../promzard') + +var path = require('path') +var file = path.resolve(__dirname, 'substack-input.js') +var buf = require('fs').readFileSync(file) +var ctx = { basename: path.basename(path.dirname(file)) } + +pz.fromBuffer(buf, ctx, function (er, res) { + if (er) + throw er + console.error(JSON.stringify(res, null, 2)) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2014-05-08 20:07:56.000000000 +0200 +++ new/package/package.json 2015-03-14 21:40:42.000000000 +0100 @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", "name": "promzard", "description": "prompting wizardly", - "version": "0.2.2", + "version": "0.3.0", "repository": { "url": "git://github.com/isaacs/promzard" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/promzard.js new/package/promzard.js --- old/package/promzard.js 2014-05-08 19:46:16.000000000 +0200 +++ new/package/promzard.js 2015-03-14 21:40:30.000000000 +0100 @@ -21,6 +21,16 @@ cb(null, data) }) } +promzard.fromBuffer = function (buf, ctx, cb) { + var filename = 0 + do { + filename = '\0' + Math.random(); + } while (files[filename]) + files[filename] = buf + var ret = promzard(filename, ctx, cb) + delete files[filename] + return ret +} function PromZard (file, ctx) { if (!(this instanceof PromZard)) @@ -175,8 +185,14 @@ prompt[1] = this.ctx[k] return this.prompt(prompt, function (er, res) { - if (er) - return this.emit('error', this.error = er); + if (er) { + if (!er.notValid) { + return this.emit('error', this.error = er); + } + console.log(er.message) + i -- + return L.call(this) + } o[k] = res L.call(this) }.bind(this)) @@ -206,7 +222,13 @@ if (tx) { cb = function (cb) { return function (er, data) { - try { return cb(er, tx(data)) } + try { + var res = tx(data) + if (!er && res instanceof Error && !!res.notValid) { + return cb(res, null) + } + return cb(er, res) + } catch (er) { this.emit('error', er) } }}(cb).bind(this) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/buffer.js new/package/test/buffer.js --- old/package/test/buffer.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/buffer.js 2015-03-14 21:39:19.000000000 +0100 @@ -0,0 +1,84 @@ +var tap = require('tap') +var pz = require('../promzard.js') +var spawn = require('child_process').spawn + +tap.test('run the example using a buffer', function (t) { + + var example = require.resolve('../example/buffer.js') + var node = process.execPath + + var expect = { + "name": "example", + "version": "0.0.0", + "description": "testing description", + "main": "test-entry.js", + "directories": { + "example": "example", + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.2.5" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/example.git" + }, + "homepage": "https://github.com/substack/example", + "keywords": [ + "fugazi", + "function", + "waiting", + "room" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "engine": { + "node": ">=0.6" + } + } + + var c = spawn(node, [example], { customFds: [-1,-1,-1] }) + var output = '' + c.stdout.on('data', function (d) { + output += d + respond() + }) + + var actual = '' + c.stderr.on('data', function (d) { + actual += d + }) + + function respond () { + if (output.match(/description: $/)) { + c.stdin.write('testing description\n') + return + } + if (output.match(/entry point: \(index\.js\) $/)) { + c.stdin.write('test-entry.js\n') + return + } + if (output.match(/keywords: $/)) { + c.stdin.write('fugazi function waiting room\n') + // "read" module is weird on node >= 0.10 when not a TTY + // requires explicit ending for reasons. + // could dig in, but really just wanna make tests pass, whatever. + c.stdin.end() + return + } + } + + c.on('close', function () { + actual = JSON.parse(actual) + t.deepEqual(actual, expect) + t.end() + }) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/validate.input new/package/test/validate.input --- old/package/test/validate.input 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/validate.input 2015-03-14 21:40:30.000000000 +0100 @@ -0,0 +1,8 @@ +module.exports = { + "name": prompt("name", function (data) { + if (data === 'cool') return data + var er = new Error('not cool') + er.notValid = true + return er + }) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/validate.js new/package/test/validate.js --- old/package/test/validate.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/validate.js 2015-03-14 21:40:30.000000000 +0100 @@ -0,0 +1,20 @@ + +var promzard = require('../') +var test = require('tap').test + +test('validate', function (t) { + t.plan(2) + var ctx = { tmpdir : '/tmp' } + var file = __dirname + '/validate.input' + promzard(file, ctx, function (er, found) { + t.ok(!er) + var wanted = { name: 'cool' } + t.same(found, wanted) + }) + setTimeout(function () { + process.stdin.emit('data', 'not cool\n') + }, 100) + setTimeout(function () { + process.stdin.emit('data', 'cool\n') + }, 200) +})
participants (1)
-
root@hilbert.suse.de