diff --git a/.gitignore b/.gitignore index e69de29..947d966 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/tests-3.0.0.tar.bz2 +/with-3.0.0.tgz diff --git a/dl-tests.sh b/dl-tests.sh new file mode 100644 index 0000000..846ad2e --- /dev/null +++ b/dl-tests.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +tag=3.0.0 + +set -e + +tmp=$(mktemp -d) + +trap cleanup EXIT +cleanup() { + set +e + [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp" +} + +unset CDPATH +pwd=$(pwd) + +pushd "$tmp" +git clone git://github.com/ForbesLindesay/with.git +cd with +git archive --prefix="test/" --format=tar tags/${tag}:test/ \ + | bzip2 > "$pwd"/tests-${tag}.tar.bz2 +popd diff --git a/nodejs-with.spec b/nodejs-with.spec new file mode 100644 index 0000000..e852af0 --- /dev/null +++ b/nodejs-with.spec @@ -0,0 +1,73 @@ +%{?nodejs_find_provides_and_requires} + +%global enable_tests 1 + +Name: nodejs-with +Version: 3.0.0 +Release: 1%{?dist} +Summary: Compile time `with` for strict mode JavaScript +License: MIT +Group: System Environment/Libraries +URL: https://github.com/ForbesLindesay/with +Source0: http://registry.npmjs.org/with/-/with-%{version}.tgz +# The test files are not included in the npm tarball. +# Source1 is generated by running Source10, which pulls from the upstream +# version control repository. +Source1: tests-%{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: mocha +BuildRequires: uglify-js +%endif + +%description +%{summary}. + +%prep +%setup -q -n package +find . -type f -exec chmod -x '{}' \; +for i in LICENSE README.md; do + sed -i -e 's/\r$//' "${i}" +done +%setup -q -T -D -a 1 -n package + +%nodejs_fixdep uglify-js '~2.2' + + +%build +#nothing to do + + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/with +cp -pr package.json index.js vars.js \ + %{buildroot}%{nodejs_sitelib}/with + +%nodejs_symlink_deps + + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +/usr/bin/mocha -R spec +%endif + + +%files +%doc LICENSE README.md +%{nodejs_sitelib}/with + + +%changelog +* Sun Mar 02 2014 Jamie Nguyen - 3.0.0-1 +- initial package diff --git a/sources b/sources index e69de29..91c25e7 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +3db5c657984ccb7ce1a99fb31451e04a tests-3.0.0.tar.bz2 +7f9cd9561bf893e3868267d0187e0504 with-3.0.0.tgz