[nodejs-vows] Initial import
Jamie Nguyen
jamielinux at fedoraproject.org
Thu Apr 18 18:59:06 UTC 2013
commit bc15ff915fb362bf3f04df54fc856bd0faf8bdea
Author: Jamie Nguyen <j at jamielinux.com>
Date: Thu Apr 18 19:58:50 2013 +0100
Initial import
.gitignore | 1 +
...s-0.7.0-use-node-glob-instead-of-wildcard.patch | 180 ++++++++++++++++++++
nodejs-vows.spec | 92 ++++++++++
sources | 1 +
vows.1 | 71 ++++++++
5 files changed, 345 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..0c4fc76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/vows-0.7.0.tgz
diff --git a/nodejs-vows-0.7.0-use-node-glob-instead-of-wildcard.patch b/nodejs-vows-0.7.0-use-node-glob-instead-of-wildcard.patch
new file mode 100644
index 0000000..221d4c8
--- /dev/null
+++ b/nodejs-vows-0.7.0-use-node-glob-instead-of-wildcard.patch
@@ -0,0 +1,180 @@
+From 8e4c8b84b1fa98bf5b240b13a26ed8ae00c290ed Mon Sep 17 00:00:00 2001
+From: "J. Lee Coltrane" <lee at projectmastermind.com>
+Date: Mon, 25 Feb 2013 15:54:38 -0500
+Subject: [PATCH] use node-glob instead of wildcard for better pattern support
+
+node-glob is located here: <https://github.com/isaacs/node-glob>
+It supports common filename glob patterns, including patterns
+like: `'**/*.js'`. This commit allows vows to be called, for
+example, like this: `vows --spec '**/test-*.js'`.
+---
+ bin/vows | 10 ++---
+ lib/utils/wildcard.js | 114 --------------------------------------------------
+ package.json | 2 +-
+ 3 files changed, 4 insertions(+), 122 deletions(-)
+ delete mode 100644 lib/utils/wildcard.js
+
+diff --git a/bin/vows b/bin/vows
+index 253157e..e7040c1 100755
+--- a/bin/vows
++++ b/bin/vows
+@@ -4,7 +4,7 @@
+ var path = require('path'),
+ fs = require('fs'),
+ util = require('util'),
+- wildcard = require('../lib/utils/wildcard').wildcard,
++ glob = require('glob'),
+ events = require('events');
+
+ //
+@@ -270,12 +270,8 @@ if (! options.watch) {
+ // preprocess the list of files for any wildcards. win32 does not handle wildcards before calling vows
+ // any paths not containing wildcards are simple returned by wildcard()
+ files.forEach(function(a) {
+- if(a.indexOf('*') !== -1) {
+- wildcardFiles = wildcardFiles.concat(wildcard(a));
+- } else {
+- wildcardFiles.push(a);
+- }
+- });
++ wildcardFiles = wildcardFiles.concat(glob.sync(a));
++ });
+
+ // now set up the file list for vows including all the wildcard files
+ files = wildcardFiles.map(function (a) {
+diff --git a/lib/utils/wildcard.js b/lib/utils/wildcard.js
+deleted file mode 100644
+index 5356723..0000000
+--- a/lib/utils/wildcard.js
++++ /dev/null
+@@ -1,114 +0,0 @@
+-/**
+- * (C) Microsoft Open Technologies, Inc. All rights reserved.
+- *
+- * Licensed under the Apache License, Version 2.0 (the "License");
+- * you may not use this file except in compliance with the License.
+- * You may obtain a copy of the License at
+- * http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing, software
+- * distributed under the License is distributed on an "AS IS" BASIS,
+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+- * See the License for the specific language governing permissions and
+- * limitations under the License.
+- */
+-
+-var PATH = require('path');
+-var fs = require('fs');
+-
+-/**
+- * @type {Function} wildcard(pattern)
+- * wildcard searches for files matching pattern.
+- *
+- * @pattern {String} search pattern with optional * wildcards
+- * @return an array containing the paths to the matching files
+- */
+-var wildcard = exports.wildcard = function(pattern) {
+-
+- // process pattern string for * wildcard
+- var matchers = [],
+- tokens,
+- path;
+-
+- var index = pattern.indexOf('*');
+- if(index === -1) {
+- return [pattern];
+- }
+-
+- path = pattern.substr(0, index-1);
+- pattern = pattern.substr(index);
+- pattern = pattern.replace(/\*/g, '(?=.*)');
+- tokens = pattern.split(PATH.sep);
+-
+- // create matcher regex for each path component in pattern
+- tokens.forEach(function(token, index, array) {
+- var matcher = {};
+- matcher.index = index;
+- matcher.isDir = index < array.length -1;
+- matcher.regex = new RegExp(token);
+- matchers.push(matcher);
+- });
+-
+- return process(path, matchers);
+-};
+-
+-// searches starting from the path directory and returns files matching wildcard pattern
+-// search only proceeds to directory depth equal to the numbe rof matchers.
+-var process = function(path, matchers) {
+-
+- var files = [];
+- var traverse = function(path, level) {
+- var dirs,
+- matcher;
+-
+- // check we have not exceeded search directory depth
+- if(level >= matchers.length) {
+- return;
+- }
+-
+- // read the dirs and files from the current path
+- dirs = fs.readdirSync(path);
+- matcher = matchers[level];
+-
+- // check if each dir or file matches the matcher for the current directory level
+- for(var i = 0; i < dirs.length; i++) {
+- var dir = dirs[i];
+-
+- if(dir.match(matcher.regex) === null) {
+- continue;
+- }
+-
+- var pathName = PATH.join(path,dir);
+-
+- var stats = fs.statSync(pathName);
+- if(stats.isDirectory()) {
+- if(matcher.isDir) {
+- traverse(pathName, level + 1);
+- } else {
+- continue;
+- }
+- }
+- else if(level === matchers.length - 1) {
+- // found a matching file
+- if(stats.isFile()) {
+- files.push(pathName);
+- }
+- }
+- }
+- };
+-
+- traverse(path, 0);
+- return files;
+-};
+-
+-
+-
+-//var pattern = '/Users/stammen/dev/microsoft/pkgcloud/test/*/*/*-test.js';
+-//
+-//var result = wildcard(pattern);
+-//console.log(result);
+-//console.log(result.length);
+-
+-
+-
+-
+diff --git a/package.json b/package.json
+index bd16063..75f90dd 100644
+--- a/package.json
++++ b/package.json
+@@ -5,7 +5,7 @@
+ "keywords" : ["testing", "spec", "test", "BDD"],
+ "author" : "Alexis Sellier <self at cloudhead.net>",
+ "contributors" : [{ "name": "Charlie Robbins", "email": "charlie.robbins at gmail.com" }],
+- "dependencies" : {"eyes": ">=0.1.6", "diff": "~1.0.3"},
++ "dependencies" : {"eyes": ">=0.1.6", "diff": "~1.0.3", "glob": "3.1.x"},
+ "main" : "./lib/vows",
+ "bin" : {"vows": "./bin/vows"},
+ "directories" : {"test": "./test", "bin": "./bin"},
+--
+1.8.1.4
+
diff --git a/nodejs-vows.spec b/nodejs-vows.spec
new file mode 100644
index 0000000..253153d
--- /dev/null
+++ b/nodejs-vows.spec
@@ -0,0 +1,92 @@
+%global enable_tests 1
+
+Name: nodejs-vows
+Version: 0.7.0
+Release: 4%{?dist}
+Summary: Asynchronous behavior-driven development (BDD) and continuous integration
+License: MIT
+Group: System Environment/Libraries
+URL: https://github.com/cloudhead/vows
+Source0: http://registry.npmjs.org/vows/-/vows-%{version}.tgz
+# Custom man page.
+Source1: vows.1
+BuildArch: noarch
+
+# wildcard.js is bundled from unknown origins, but upstream have patched to
+# use node-glob instead. We'll apply the patch while waiting for next release.
+Patch0: %{name}-0.7.0-use-node-glob-instead-of-wildcard.patch
+
+BuildRequires: nodejs-devel
+
+%if 0%{?enable_tests}
+BuildRequires: coffee-script
+BuildRequires: npm(diff)
+BuildRequires: npm(eyes)
+BuildRequires: npm(glob)
+%endif
+
+%description
+Vows is an asynchronous behavior-driven development (BDD) framework for
+Node.js.
+
+Vows was built from the ground up to test asynchronous code. It
+executes your tests in parallel when it makes sense, and sequentially
+when there are dependencies. Emphasis was put on speed of execution,
+clarity and user experience.
+
+
+%prep
+%setup -q -n package
+%patch0 -p1
+
+
+%build
+#nothing to do
+
+
+%install
+mkdir -p %{buildroot}%{nodejs_sitelib}/vows
+cp -pr package.json lib/ \
+ %{buildroot}%{nodejs_sitelib}/vows
+mkdir -p %{buildroot}%{nodejs_sitelib}/vows/bin
+install -p -D -m0755 bin/vows %{buildroot}%{nodejs_sitelib}/vows/bin/vows
+
+mkdir -p %{buildroot}%{_bindir}
+ln -sf %{nodejs_sitelib}/vows/bin/vows %{buildroot}%{_bindir}/vows
+
+mkdir -p %{buildroot}%{_mandir}/man1
+install -p -D -m0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/vows.1
+
+%nodejs_symlink_deps
+
+
+%if 0%{?enable_tests}
+%check
+ln -sf %{nodejs_sitelib} .
+./bin/vows test/*.js
+%endif
+
+
+%files
+%doc LICENSE README.md
+%{nodejs_sitelib}/vows
+%{_bindir}/vows
+%{_mandir}/man1/vows.1*
+
+
+%changelog
+* Sun Apr 07 2013 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.7.0-4
+- use node-glob instead of wildcard.js, which is bundled from unknown origins
+- add a more detailed %%description
+- add /usr/bin/vows
+- add custom man page
+
+* Sun Mar 10 2013 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.7.0-3
+- fix typo in %%summary
+
+* Sat Mar 02 2013 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.7.0-2
+- add ASL 2.0 to License tag
+- remove /usr/bin/vows symlink
+
+* Thu Feb 14 2013 Jamie Nguyen <jamielinux at fedoraproject.org> - 0.7.0-1
+- initial package
diff --git a/sources b/sources
index e69de29..b85c82b 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+41f1f7614cda910620e044ab25ff5795 vows-0.7.0.tgz
diff --git a/vows.1 b/vows.1
new file mode 100644
index 0000000..37bb900
--- /dev/null
+++ b/vows.1
@@ -0,0 +1,71 @@
+.TH VOWS "1" "April 2013" "vows 0.7.0" "User Commands"
+.SH NAME
+vows \- Asynchronous behavior-driven development (BDD) framework
+.SH SYNOPSIS
+Usage: vows [FILE, ...] [options]
+.SH DESCRIPTION
+Vows is an asynchronous behavior-driven development (BDD) framework for
+Node.js.
+
+Vows was built from the ground up to test asynchronous code. It
+executes your tests in parallel when it makes sense, and sequentially
+when there are dependencies. Emphasis was put on speed of execution,
+clarity and user experience.
+.SH OPTIONS
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Enable verbose output
+.TP
+\fB\-w\fR, \fB\-\-watch\fR
+Watch mode
+.TP
+\fB\-s\fR, \fB\-\-silent\fR
+Don't report
+.TP
+\fB\-i\fR, \fB\-\-isolate\fR
+Run each test in it's own vows process
+.TP
+\fB\-m\fR
+PATTERN Only run tests matching the PATTERN string
+.TP
+\fB\-r\fR
+PATTERN Only run tests matching the PATTERN regexp
+.TP
+\fB\-\-json\fR
+Use JSON reporter
+.TP
+\fB\-\-spec\fR
+Use Spec reporter
+.TP
+\fB\-\-tap\fR
+Use TAP reporter
+.TP
+\fB\-\-dot\-matrix\fR
+Use Dot\-Matrix reporter
+.TP
+\fB\-\-xunit\fR
+Use xUnit reporter
+.TP
+\fB\-\-cover\-plain\fR
+Print plain coverage map if detected
+.TP
+\fB\-\-cover\-html\fR
+Write coverage map to "coverage.html"
+.TP
+\fB\-\-cover\-json\fR
+Write unified coverage map to "coverage.json"
+.TP
+\fB\-\-cover\-xml\fR
+Write coverage map to "coverage.xml" in Emma xml
+.TP
+\fB\-\-no\-color\fR
+Don't use terminal colors
+.TP
+\fB\-\-version\fR
+Show version
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+You're staring at it
+.SH REPORTING BUGS
+Please report bugs on the GitHub issue tracker:
+<\fBhttps://github.com/cloudhead/vows/issues\fR>
More information about the scm-commits
mailing list