diff --git a/.gitignore b/.gitignore index 8ef1d46..da8da17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /gaze-0.3.3.tgz /gaze-0.3.4.tgz /gaze-0.4.1.tgz +/gaze-0.5.1.tgz +/tests-0.5.1.tar.bz2 diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..a2d3378 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,39 @@ +module.exports = function(grunt) { + 'use strict'; + grunt.initConfig({ + benchmark: { + all: { + src: ['benchmarks/*.js'], + options: { times: 10 } + } + }, + nodeunit: { + files: ['test/*_test.js'], + }, + jshint: { + options: { + jshintrc: '.jshintrc' + }, + gruntfile: { + src: 'Gruntfile.js' + }, + lib: { + src: ['lib/**/*.js'] + }, + test: { + src: ['test/**/*_test.js'] + }, + }, + }); + + // Dynamic alias task to nodeunit. Run individual tests with: grunt test:events + grunt.registerTask('test', function(file) { + grunt.config('nodeunit.files', String(grunt.config('nodeunit.files')).replace('*', file || '*')); + grunt.task.run('nodeunit'); + }); + + grunt.loadNpmTasks('grunt-benchmark'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-nodeunit'); + grunt.registerTask('default', ['jshint', 'nodeunit']); +}; diff --git a/dl-tests.sh b/dl-tests.sh new file mode 100644 index 0000000..c886185 --- /dev/null +++ b/dl-tests.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +version=0.5.1 +commit=dad5345a2876346fe49a68ee6e4db34205680798 + +set -e + +tmp=$(mktemp -d) + +trap cleanup EXIT +cleanup() { + set +e + [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp" +} + +unset CDPATH +pwd=$(pwd) + +pushd "$tmp" +git clone git://github.com/shama/gaze.git +cd gaze +git archive --prefix="test/" --format=tar ${commit}:test/ \ + | bzip2 > "$pwd"/tests-${version}.tar.bz2 +popd diff --git a/nodejs-gaze.spec b/nodejs-gaze.spec index 5fd50fa..2c9f632 100644 --- a/nodejs-gaze.spec +++ b/nodejs-gaze.spec @@ -1,15 +1,20 @@ %{?nodejs_find_provides_and_requires} -%global enable_tests 0 +%global enable_tests 1 Name: nodejs-gaze -Version: 0.4.1 +Version: 0.5.1 Release: 1%{?dist} Summary: A globbing fs.watch wrapper built from parts of other watch libraries License: MIT Group: System Environment/Libraries URL: https://github.com/shama/gaze Source0: http://registry.npmjs.org/gaze/-/gaze-%{version}.tgz +# Source1 is generated by running Source10, which pulls from the upstream +# version control repository. +Source1: tests-%{version}.tar.bz2 +Source2: https://raw.githubusercontent.com/shama/gaze/dad5345a2876346fe49a68ee6e4db34205680798/Gruntfile.js +Source10: dl-tests.sh BuildArch: noarch %if 0%{?fedora} >= 19 @@ -21,11 +26,13 @@ ExclusiveArch: %{ix86} x86_64 %{arm} noarch BuildRequires: nodejs-packaging %if 0%{?enable_tests} -BuildRequires: npm(fileset) +BuildRequires: npm(async) BuildRequires: npm(globule) BuildRequires: npm(grunt) -BuildRequires: npm(minimatch) +BuildRequires: npm(grunt-cli) +BuildRequires: npm(grunt-contrib-nodeunit) BuildRequires: npm(nodeunit) +BuildRequires: npm(rimraf) %endif %description @@ -36,6 +43,8 @@ API interface from watch, and file globbing using glob. %prep %setup -q -n package +%setup -q -T -D -a 1 -n package +cp -p %{SOURCE2} . %build @@ -53,16 +62,20 @@ cp -pr package.json lib/ \ %if 0%{?enable_tests} %check %nodejs_symlink_deps --check -%{nodejs_sitelib}/nodeunit/bin/nodeunit test +grunt nodeunit -v %endif %files -%doc AUTHORS LICENSE-MIT README.md +%doc LICENSE-MIT README.md %{nodejs_sitelib}/gaze %changelog +* Sat Mar 29 2014 Jamie Nguyen - 0.5.1-1 +- update to upstream release 0.5.1 +- enable tests + * Mon Aug 26 2013 Jamie Nguyen - 0.4.1-1 - update to upstream release 0.4.1 diff --git a/sources b/sources index 628c510..33545b4 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -57e3a06a0205f5b792c32bba646a5543 gaze-0.4.1.tgz +965516244bb95f9cde92d3a94790fc3b gaze-0.5.1.tgz +31686dfca5e8180495fd8481d4d98275 tests-0.5.1.tar.bz2