%{?nodejs_find_provides_and_requires}
%global packagename commonmark
%global enable_tests 1
Name: nodejs-commonmark
Version: 0.22.1
Release: 3%{?dist}
Summary: A strongly specified, highly compatible variant of Markdown
License: BSD and MIT and Creative Commons
# Most of the files in this packages are BSD licensed. The exceptions are:
#
# lib/normalize-reference.js is a slightly modified version of
# https://github.com/dmoscrop/fold-case and licensed under the MIT license
#
# lib/from-code-point.js is derived from a polyfill
# Copyright Mathias Bynens , and is licensed under
# the MIT license
#
# With the exception of `bench/samples/README.md`, the samples in
# `bench/samples` are taken from https://github.com/markdown-it/markdown-it
# and licensed under the MIT license
#
# The CommonMark spec (spec.txt) in test/ is Copyright (C) 2014-15 John
# MacFarlane and licensed under the Creative Commons CC-BY-SA 4.0 license
#
# More details, including the license text, is in the LICENSE file
URL: https://github.com/jgm/commonmark.js.git
Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# The test files are not included in the npm tarball.
# Source{1,2} is generated by running Source10, which pulls from the upstream
# version control repository.
Source1: tests-%{version}.tar.bz2
Source2: tools-%{version}.tar.bz2
Source10: dl-tests.sh
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(entities)
BuildRequires: npm(mdurl)
BuildRequires: npm(string.prototype.repeat)
%endif
Requires: nodejs
%description
A strongly specified, highly compatible variant of Markdown
%prep
%setup -q -n package
# setup the tests
%setup -q -T -D -a 1 -n package
# setup the tools
%setup -q -T -D -a 2 -n package
# remove executable permission from lib/index.js
chmod -x ./lib/index.js
%build
# nothing to do!
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json lib/ tools/ \
%{buildroot}%{nodejs_sitelib}/%{packagename}
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}/bin
install -p -D -m0755 bin/commonmark %{buildroot}%{nodejs_sitelib}/%{packagename}/bin/commonmark
mkdir -p %{buildroot}%{_bindir}
ln -sf %{nodejs_sitelib}/%{packagename}/bin/commonmark \
%{buildroot}%{_bindir}/commonmark
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%{__nodejs} ./test/test.js
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE
%{nodejs_sitelib}/%{packagename}
%{_bindir}/commonmark
%changelog
* Wed Dec 23 2015 Jared Smith - 0.22.1-3
- Add more license detail
- fix permissions on a script
* Sat Dec 19 2015 Jared Smith - 0.22.1-2
- Add missing build requirement
* Tue Dec 15 2015 Jared Smith 0.22.1-1
- Initial packaging