diff --git a/.gitignore b/.gitignore index e69de29..c6a6216 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/raw-body-1.1.3.tgz +/tests-1.1.3.tar.bz2 diff --git a/dl-tests.sh b/dl-tests.sh new file mode 100644 index 0000000..8bb5677 --- /dev/null +++ b/dl-tests.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +tag=1.1.3 + +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/stream-utils/raw-body.git +cd raw-body +git archive --prefix="test/" --format=tar tags/${tag}:test/ \ + | bzip2 > "$pwd"/tests-${tag}.tar.bz2 +popd diff --git a/nodejs-raw-body.spec b/nodejs-raw-body.spec new file mode 100644 index 0000000..cb8dac9 --- /dev/null +++ b/nodejs-raw-body.spec @@ -0,0 +1,78 @@ +%{?nodejs_find_provides_and_requires} + +%global enable_tests 0 + +Name: nodejs-raw-body +Version: 1.1.3 +Release: 1%{?dist} +Summary: Get and validate the raw body of a readable stream +License: MIT +Group: System Environment/Libraries +URL: https://github.com/stream-utils/raw-body +Source0: http://registry.npmjs.org/raw-body/-/raw-body-%{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: npm(assert-tap) +BuildRequires: npm(bytes) +#BuildRequires: npm(co) +#BuildRequires: npm(gnode) +#BuildRequires: npm(readable-stream) +BuildRequires: npm(request) +#BuildRequires: npm(through2) +%endif + +%description +This module gets the entire buffer of a stream either as a buffer or a string. +It validates the stream's length against an expected length and maximum limit. +It is ideal for parsing request bodies. + + +%prep +%setup -q -n package +%setup -q -T -D -a 1 -n package + + +%build +#nothing to do + + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/raw-body +cp -pr package.json index.js \ + %{buildroot}%{nodejs_sitelib}/raw-body + +%nodejs_symlink_deps + + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +# gnode required to access generators on Node < 0.11 +NODE=node_modules/gnode/bin/gnode \ + /usr/bin/mocha --reporter spec --bail test/index.js +%endif + + +%files +%doc README.md +%{nodejs_sitelib}/raw-body + + +%changelog +* Mon Mar 10 2014 Jamie Nguyen - 1.1.3-1 +- initial package diff --git a/sources b/sources index e69de29..570488e 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +8322411cc640718ce0ccf14a5fdccb13 raw-body-1.1.3.tgz +3b804a05120593237390c56133f5711c tests-1.1.3.tar.bz2