diff --git a/.gitignore b/.gitignore index e69de29..7ee18b4 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/grunt-simple-mocha-0.4.1.tgz diff --git a/nodejs-grunt-simple-mocha.spec b/nodejs-grunt-simple-mocha.spec new file mode 100644 index 0000000..de438db --- /dev/null +++ b/nodejs-grunt-simple-mocha.spec @@ -0,0 +1,79 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename grunt-simple-mocha + +# Tests disabled because they fail in mock, even if they pass locally +%global enable_tests 0 + +Name: nodejs-grunt-simple-mocha +Version: 0.4.1 +Release: 3%{?dist} +Summary: A simple wrapper for running tests with Mocha + +License: MIT +URL: https://github.com/yaymukund/grunt-simple-mocha.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +# Fix a path in the test file +Patch0: nodejs-grunt-simple-mocha_fix-tests.patch + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging +BuildRequires: mocha + +%if 0%{?enable_tests} +BuildRequires: npm(grunt) +BuildRequires: npm(grunt-cli) +BuildRequires: npm(grunt-contrib-jshint) +%endif + +%description +A simple wrapper for running tests with Mocha. + + +%prep +%autosetup -n package -p1 + +# fix she-bang line in grunt-simple-mocha +sed -i '1!b;s/env node/node/' bin/grunt-simple-mocha + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json *.js bin/ tasks/ \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +ln -s %{nodejs_sitelib}/grunt-cli node_modules/grunt-cli +%if 0%{?enable_tests} +%{_bindir}/grunt +NODE_ENV=test %{_bindir}/mocha -R spec tests/acceptance-tests.js +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license LICENSE-MIT +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Aug 08 2016 Jared Smith - 0.4.1-3 +- Fix interpreter in bin/grunt-simple-mocha + +* Mon Jul 25 2016 Jared Smith - 0.4.1-2 +- Do not forget the tasks/ directory + +* Sat Jul 23 2016 Jared Smith - 0.4.1-1 +- Initial packaging diff --git a/nodejs-grunt-simple-mocha_fix-tests.patch b/nodejs-grunt-simple-mocha_fix-tests.patch new file mode 100644 index 0000000..14c13bf --- /dev/null +++ b/nodejs-grunt-simple-mocha_fix-tests.patch @@ -0,0 +1,24 @@ +diff --git a/package.json b/package.json +index cd0c735..92c6765 100644 +--- a/package.json ++++ b/package.json +@@ -30,7 +30,6 @@ + "test": "node_modules/mocha/bin/mocha tests/acceptance-tests.js" + }, + "dependencies": { +- "mocha": "*" + }, + "devDependencies": { + "grunt": "0.4.x", +diff --git a/tests/acceptance-tests.js b/tests/acceptance-tests.js +index 724e84c..23e9951 100644 +--- a/tests/acceptance-tests.js ++++ b/tests/acceptance-tests.js +@@ -1,6 +1,6 @@ + var assert = require('assert'), + exec = require('child_process').exec, +- GRUNT = 'node_modules/grunt-cli/bin/grunt'; ++ GRUNT = '/usr/bin/grunt'; + + function grunt(gruntfile, done) { + exec(GRUNT+' --gruntfile tests/fixtures/'+gruntfile+'.gruntfile.js', done); diff --git a/sources b/sources index e69de29..0c8277f 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +1ea451f82c26ed5de1cf434c6019b545 grunt-simple-mocha-0.4.1.tgz