From 39ae5a3dbf4be92c420451d29b23a219cea11d9c Mon Sep 17 00:00:00 2001 From: Jared K. Smith Date: Dec 22 2015 19:42:47 +0000 Subject: Initial packaging --- diff --git a/.gitignore b/.gitignore index e69de29..cc1723b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/is-unc-path-0.1.1.tgz diff --git a/nodejs-is-unc-path.spec b/nodejs-is-unc-path.spec new file mode 100644 index 0000000..907686a --- /dev/null +++ b/nodejs-is-unc-path.spec @@ -0,0 +1,75 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename is-unc-path +%global enable_tests 1 + +Name: nodejs-is-unc-path +Version: 0.1.1 +Release: 3%{?dist} +Summary: Returns true if a filepath is a windows UNC file path + +License: MIT +URL: https://github.com/jonschlinkert/is-unc-path.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +# The test files are not included in the npm tarball. The releases aren't +# tagged in GitHub either, so we'll pull from "master" +Source1: https://raw.githubusercontent.com/jonschlinkert/is-unc-path/master/test.js + + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging +BuildRequires: npm(unc-path-regex) +%if 0%{?enable_tests} +BuildRequires: mocha +%endif + +%description +Returns true if a filepath is a windows UNC file path. + + +%prep +%setup -q -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} +/usr/bin/mocha -R spec +%endif + + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license LICENSE +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Dec 21 2015 Jared Smith - 0.1.1-3 +- Include proper test.js file + +* Sat Dec 19 2015 Jared Smith - 0.1.1-2 +- Add missing build requirement + +* Wed Dec 16 2015 Jared Smith - 0.1.1-1 +- Initial packaging diff --git a/sources b/sources index e69de29..a41b74e 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +ec5b2c89b049300cf045e3d2f4d2a681 is-unc-path-0.1.1.tgz diff --git a/test.js b/test.js new file mode 100644 index 0000000..b9351a7 --- /dev/null +++ b/test.js @@ -0,0 +1,30 @@ +'use strict'; + +/* deps:mocha */ +var assert = require('assert'); +var unc = require('./'); + +describe('is-unc-path', function () { + it('should return true for UNC paths', function () { + assert.equal(unc('\\/foo/bar'), true); + assert.equal(unc('\\\\foo/bar'), true); + assert.equal(unc('\\\\foo\\admin$'), true); + assert.equal(unc('\\\\foo\\admin$\\system32'), true); + assert.equal(unc('\\\\foo\\temp'), true); + assert.equal(unc('\\\\/foo/bar'), true); + assert.equal(unc('\\\\\\/foo/bar'), true); + }); + + it('should return false for non-UNC paths', function () { + assert.equal(unc('/foo/bar'), false); + assert.equal(unc('/'), false); + assert.equal(unc('/foo'), false); + assert.equal(unc('/foo/'), false); + assert.equal(unc('c:'), false); + assert.equal(unc('c:.'), false); + assert.equal(unc('c:./'), false); + assert.equal(unc('c:./file'), false); + assert.equal(unc('c:/'), false); + assert.equal(unc('c:/file'), false); + }); +});