%global enable_tests 0
Name: carto
Version: 0.9.4
Release: 1%{?dist}
Summary: Mapnik style sheet compiler
License: ASL 2.0
URL: https://github.com/mapbox/carto
Source0: http://registry.npmjs.org/carto/-/carto-%{version}.tgz
# The test files are not included in the npm tarball.
# Source1 is generated using Source10, which pulls from the upstream
# version control repository.
Source1: carto-tests-v%{version}.tar.bz2
# Accepted upstream - see https://github.com/mapbox/carto/pull/257
Source2: carto-%{version}-manpage.1
Source10: carto-dl-tests.sh
# Accepted upstream - see https://github.com/mapbox/carto/pull/250
Patch0: carto-xml2js.patch
# Already changed upstream in 43073fa1e89f916e0290a38a5071355c284467f7
Patch1: carto-underscore.patch
BuildArch: noarch
Requires: npm(millstone)
BuildRequires: nodejs-devel
%if 0%{?enable_tests}
BuildRequires: npm(mocha)
BuildRequires: npm(mapnik-reference)
BuildRequires: npm(sax)
BuildRequires: npm(underscore)
%endif
%description
Carto is a style sheet compiler for Mapnik. It's an evolution of
the Cascadenik idea and language, with an emphasis on speed and
flexibility.
%prep
%setup -q -n package
%setup -T -D -a 1 -q -n package
%patch0 -p1
%patch1 -p0 -b .carto
rm -rf node_modules
%build
%if 0%{?enable_tests}
%check
ln -s %{nodejs_sitelib} .
NODE_PATH=lib %{nodejs_sitelib}/mocha/bin/mocha -R spec test/*.test.js
%endif
%install
mkdir -p %{buildroot}/%{nodejs_sitelib}/carto
cp -pr package.json bin lib %{buildroot}/%{nodejs_sitelib}/carto
mkdir -p %{buildroot}/%{nodejs_sitelib}/carto/bin
mkdir -p %{buildroot}/%{_bindir}
ln -s %{nodejs_sitelib}/carto/bin/carto %{buildroot}/%{_bindir}/carto
mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/carto.1
%nodejs_symlink_deps
%files
%doc LICENSE README.md CHANGELOG.md
%{nodejs_sitelib}/carto
%{_bindir}/carto
%{_mandir}/man1/carto.1*
%changelog
* Sun Feb 10 2013 Tom Hughes <tom@compton.nu> - 0.9.4-1
- Initial build of 0.9.4