diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..d2f2c25 --- /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/gaze-0.5.1.tgz b/gaze-0.5.1.tgz new file mode 100644 index 0000000..6f845d7 Binary files /dev/null and b/gaze-0.5.1.tgz differ diff --git a/nodejs-gaze.spec b/nodejs-gaze.spec new file mode 100644 index 0000000..8d74075 --- /dev/null +++ b/nodejs-gaze.spec @@ -0,0 +1,47 @@ +%global enable_tests 1 +Name: nodejs-gaze +Version: 0.5.1 +Release: 1 +Summary: A globbing fs.watch wrapper built from parts of other watch libraries +License: MIT +URL: https://github.com/shama/gaze +Source0: http://registry.npmjs.org/gaze/-/gaze-%{version}.tgz +Source1: tests-%{version}.tar.bz2 +Source2: https://raw.githubusercontent.com/shama/gaze/dad5345a2876346fe49a68ee6e4db34205680798/Gruntfile.js +Source10: dl-tests.sh +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(async) npm(globule) npm(grunt) npm(grunt-cli) npm(grunt-contrib-nodeunit) +BuildRequires: npm(nodeunit) npm(rimraf) +%endif +%description +This Node.js module provides a globbing fs.watch wrapper built from the best +parts of other fine watch libraries: speedy data behavior from chokidar, the +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 + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/gaze +cp -pr package.json lib/ \ + %{buildroot}%{nodejs_sitelib}/gaze +%if 0%{?enable_tests} + +%check +/usr/bin/grunt nodeunit -v +%endif + +%files +%doc LICENSE-MIT README.md +%{nodejs_sitelib}/gaze + +%changelog +* Thu Aug 20 2020 yaokai - 0.5.1-1 +- Package init diff --git a/nodejs-gaze.yaml b/nodejs-gaze.yaml new file mode 100644 index 0000000..23ff88c --- /dev/null +++ b/nodejs-gaze.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: shama/gaze +tag_pattern: "^v" +seperator: "." diff --git a/tests-0.5.1.tar.bz2 b/tests-0.5.1.tar.bz2 new file mode 100644 index 0000000..fe9efb4 Binary files /dev/null and b/tests-0.5.1.tar.bz2 differ