Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global packagename jsonm
%global enable_tests 1

Name:		nodejs-jsonm
Version:	1.0.9
Release:	2%{?dist}
Summary:	JSON compressor for packing messages with memoization

License:	MIT
URL:		https://github.com/lennartcl/jsonm
Source0:	https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz

ExclusiveArch:	%{nodejs_arches} noarch
BuildArch:	noarch

BuildRequires:	nodejs-packaging
%if 0%{?enable_tests}
BuildRequires:	mocha
%endif

%description
JSON compressor for packing messages with memoization


%prep
%autosetup -n package

sed -i '1s/env //' bin/cli.js

%build
# nothing to do!

%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json build/ \
	%{buildroot}%{nodejs_sitelib}/%{packagename}

mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}/bin
install -p -D -m0755 bin/cli.js %{buildroot}%{nodejs_sitelib}/%{packagename}/bin/

mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/%{packagename}/bin/cli.js \
    %{buildroot}%{_bindir}/%{packagename}

%nodejs_symlink_deps

%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%{_bindir}/mocha -R spec
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif

%files
%doc *.md
%license LICENSE
%{nodejs_sitelib}/%{packagename}
%{_bindir}/%{packagename}

%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Mar 29 2017 Jared Smith <jsmith@fedoraproject.org> - 1.0.9-1
- Initial packaging