From 0cd9517a8f5f1fd88371cc099c9d86210a8314eb Mon Sep 17 00:00:00 2001 From: Jared K. Smith Date: May 24 2017 22:33:34 +0000 Subject: Initial packaging --- diff --git a/.gitignore b/.gitignore index e69de29..aaa0962 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/is-text-path-1.0.1.tgz diff --git a/nodejs-is-text-path.spec b/nodejs-is-text-path.spec new file mode 100644 index 0000000..d107798 --- /dev/null +++ b/nodejs-is-text-path.spec @@ -0,0 +1,62 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename is-text-path + +# tests missing due to missing npm(ava) +%global enable_tests 0 + +Name: nodejs-is-text-path +Version: 1.0.1 +Release: 1%{?dist} +Summary: Check if a filepath is a text file + +License: MIT +URL: https://github.com/sindresorhus/is-text-path +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +Source1: https://raw.githubusercontent.com/sindresorhus/is-text-path/%{version}/test.js + +ExclusiveArch: %{nodejs_arches} noarch +BuildArch: noarch + +BuildRequires: nodejs-packaging +BuildRequires: npm(text-extensions) +%if 0%{?enable_tests} +BuildRequires: npm(ava) +%endif + +%description +Check if a filepath is a text file + + +%prep +%autosetup -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 + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +%{_bindir}/ava +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc readme.md +%license license +%{nodejs_sitelib}/%{packagename} + +%changelog +* Sat May 6 2017 Jared Smith - 1.0.1-1 +- Initial packaging diff --git a/sources b/sources index e69de29..05358ad 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (is-text-path-1.0.1.tgz) = c45b89a677bda05cf9a836a87709a61b4f1edc26b01ffd9957c42acdad4aa3b4a4f0f3966e445dc08a0059586abead17794cc034484aa369f4217506066ec0ff diff --git a/test.js b/test.js new file mode 100644 index 0000000..29fb08d --- /dev/null +++ b/test.js @@ -0,0 +1,13 @@ +'use strict'; +var test = require('ava'); +var isTextPath = require('./'); + +test(function (t) { + t.assert(isTextPath('unicorn.txt')); + t.assert(isTextPath('unicorn.md')); + t.assert(isTextPath('unicorn.MD')); + t.assert(!isTextPath('unicorn.png')); + t.assert(!isTextPath('unicorn.zip')); + t.assert(!isTextPath('unicornzip')); + t.end(); +});