%{?nodejs_find_provides_and_requires} %global packagename tad %global enable_tests 1 Name: nodejs-tad Version: 0.2.4 Release: 3%{?dist} Summary: JavaScript test suite License: MIT URL: https://github.com/medikoo/tad.git Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz BuildArch: noarch %if 0%{?fedora} >= 19 ExclusiveArch: %{nodejs_arches} noarch %else ExclusiveArch: %{ix86} x86_64 %{arm} noarch %endif BuildRequires: nodejs-packaging BuildRequires: npm(cli-color) BuildRequires: npm(duration) BuildRequires: npm(fs2) BuildRequires: npm(next) BuildRequires: npm(path2) BuildRequires: npm(test) %if 0%{?enable_tests} BuildRequires: npm(optimist) %endif Requires: nodejs %description JavaScript test suite %prep %setup -q -n package # tad expects there to be a test file for every regular file in the main dir, # but the tests obviously haven't kept up with development. Create empty files # to match the main files, so that the tests don't error out. touch test/lib/fix-test-utils.js touch test/lib/tad-ignore-mode.js mkdir test/lib/utils touch test/lib/utils/factory.js touch test/lib/utils/index-test.js %nodejs_fixdep d files=$(find . -name \*.js -executable | xargs grep -vrl '^#!/.*node') for file in $files do echo "Adding shebang line to $file" sed -i '1i #!/usr/bin/node' $file done # fix she-bang line in bin/tad sed -i '1!b;s/env node/node/' bin/tad %build # nothing to do! %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} cp -pr package.json *.js lib/ \ %{buildroot}%{nodejs_sitelib}/%{packagename} mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}/bin install -p -D -m0755 bin/tad %{buildroot}%{nodejs_sitelib}/%{packagename}/bin/ mkdir -p %{buildroot}%{_bindir} ln -sf %{nodejs_sitelib}/%{packagename}/bin/tad \ %{buildroot}%{_bindir}/tad %nodejs_symlink_deps %check %nodejs_symlink_deps --check %{__nodejs} -e 'require("./")' %if 0%{?enable_tests} %__nodejs ./bin/tad %else %{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" %endif %files %{!?_licensedir:%global license %doc} %doc *.md %license LICENSE %{nodejs_sitelib}/%{packagename} %{_bindir}/tad %changelog * Fri Aug 05 2016 Jared Smith - 0.2.4-3 - Add or fix script interpreter in executable scripts * Thu Nov 12 2015 Jared Smith - 0.2.4-2 - Initial packaging