%{?nodejs_find_provides_and_requires}
%global packagename base64-url
%global enable_tests 1
Name: nodejs-base64-url
Version: 1.2.1
Release: 3%{?dist}
Summary: Base64 encode, decode, escape and unescape for URL applications
License: ISC
URL: https://github.com/joaquimserafim/base64-url.git
Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# The test files are not included in the npm tarball.
# And the 1.2.1 release was not tagged in GitHub yet, so I'm grabbing the test from 1.2
Source1: https://raw.githubusercontent.com/joaquimserafim/base64-url/v%{version}/test.js
BuildArch: noarch
%if 0%{?fedora} >= 19
ExclusiveArch: %{nodejs_arches} noarch
%else
ExclusiveArch: %{ix86} x86_64 %{arm} noarch
%endif
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: npm(tape)
%endif
Requires: nodejs
%description
Base64 encode, decode, escape and unescape for URL applications
%prep
%setup -q -n package
# setup the tests
cp -p %{SOURCE1} .
%build
# nothing to do!
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json index.js \
%{buildroot}%{nodejs_sitelib}/%{packagename}
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
tape test.js
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE
%{nodejs_sitelib}/%{packagename}
%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Nov 09 2015 Jared Smith <jsmith@fedoraproject.org> - 1.2.1-2
- Use versioned test instead of hash, and remove test.js from installed files
* Wed Nov 4 2015 Jared Smith <jsmith@fedoraproject.org> - 1.2.1-1
- Initial packaging