Blob Blame History Raw
# This macro is needed at the start for building on EL6
%{?nodejs_find_provides_and_requires}

%global enable_tests 1

%global barename supports-color

Name:               nodejs-supports-color
Version:            1.2.0
Release:            4%{?dist}
Summary:            Detect whether a terminal supports color

Group:              Development/Libraries
License:            MIT
URL:                https://www.npmjs.org/package/supports-color
Source0:            http://registry.npmjs.org/%{barename}/-/%{barename}-%{version}.tgz

# The license is MIT, but it is not included in the tarball.
# I have asked the author before if he would include the license with other
# projects, and he declined.  I don't want to pester him again...
# https://github.com/sindresorhus/supports-color/blob/master/license#L12-L13
#Source1:            https://raw.githubusercontent.com/sindresorhus/supports-color/master/license
Source1:            license

#Source2:            https://raw.githubusercontent.com/sindresorhus/supports-color/master/test.js
Source2:            test.js

BuildArch:          noarch
%if 0%{?fedora} >= 19
ExclusiveArch:      %{nodejs_arches} noarch
%else
ExclusiveArch:      %{ix86} x86_64 %{arm} noarch
%endif

BuildRequires:      nodejs-packaging >= 6

%if 0%{?enable_tests}
BuildRequires:      npm(require-uncached)
BuildRequires:      npm(mocha)
%endif


%description
Detect whether a terminal supports color

%prep
%setup -q -n package
cp %{SOURCE1} .
cp %{SOURCE2} .

# Remove bundled node_modules if there are any..
rm -rf node_modules/

%nodejs_fixdep --caret

%build
# This causes warnings when running the tests
#%nodejs_symlink_deps --build

%install
mkdir -p %{buildroot}%{nodejs_sitelib}/supports-color
cp -pr package.json index.js cli.js \
    %{buildroot}%{nodejs_sitelib}/supports-color

mkdir -p %{buildroot}/%{_bindir}/
ln -s %{nodejs_sitelib}/supports-color/cli.js \
    %{buildroot}/%{_bindir}/supports-color

%nodejs_symlink_deps

%check
%if 0%{?enable_tests}
%nodejs_symlink_deps --check
mocha
%endif

%files
%license license
%doc readme.md
%{nodejs_sitelib}/supports-color/
%{_bindir}/supports-color

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Feb 10 2015 Ralph Bean <rbean@redhat.com> - 1.2.0-2
- Include license from github.
- Enable tests.
- Make cli.js into a symlink.
- Comment out nodejs_symlink_deps --build, as per review.

* Tue Dec 02 2014 Ralph Bean <rbean@redhat.com> - 1.2.0-1
- Initial packaging for Fedora.