1 |
joequant |
737925 |
%{?nodejs_find_provides_and_requires} |
2 |
|
|
|
3 |
tv |
802491 |
%global enable_tests 1 |
4 |
joequant |
737925 |
|
5 |
|
|
# This package requires the grunt stack, but grunt also requires this package. |
6 |
|
|
# Before grunt is available, this will need to be built manually. |
7 |
|
|
%global enable_grunt 0 |
8 |
|
|
|
9 |
|
|
Name: nodejs-hooker |
10 |
|
|
Version: 0.2.3 |
11 |
tv |
802491 |
Release: %mkrel 3 |
12 |
joequant |
737925 |
Summary: Monkey-patch (hook) functions for debugging |
13 |
|
|
License: MIT |
14 |
joequant |
737927 |
Group: Development/Other |
15 |
joequant |
737925 |
URL: https://github.com/cowboy/javascript-hooker |
16 |
|
|
Source0: http://registry.npmjs.org/hooker/-/hooker-%{version}.tgz |
17 |
|
|
|
18 |
|
|
# This is taken from the upstream version control repository. |
19 |
|
|
Patch0: %{name}-0.2.3-Updating-gruntfile-to-grunt-0.3.0-format.patch |
20 |
|
|
# These two patches update grunt.js for use with grunt 0.4.0. |
21 |
|
|
# Pull request sent: https://github.com/cowboy/javascript-hooker/pull/3 |
22 |
|
|
Patch1: %{name}-0.2.3-Rename-grunt.js-to-Gruntfile.js.patch |
23 |
|
|
Patch2: %{name}-0.2.3-Update-Gruntfile.js-for-use-with-grunt-0.4.0.patch |
24 |
|
|
|
25 |
|
|
BuildArch: noarch |
26 |
|
|
|
27 |
|
|
BuildRequires: nodejs-packaging |
28 |
|
|
BuildRequires: uglify-js |
29 |
|
|
|
30 |
|
|
%if 0%{?enable_tests} |
31 |
|
|
BuildRequires: npm(nodeunit) |
32 |
|
|
%endif |
33 |
|
|
|
34 |
|
|
%if 0%{?enable_grunt} |
35 |
|
|
BuildRequires: npm(grunt-cli) |
36 |
|
|
BuildRequires: npm(grunt-contrib-nodeunit) |
37 |
|
|
BuildRequires: npm(grunt-contrib-uglify) |
38 |
|
|
%endif |
39 |
|
|
|
40 |
|
|
%description |
41 |
|
|
%{summary}. |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
%prep |
45 |
|
|
%setup -q -n package |
46 |
|
|
%patch0 -p1 |
47 |
|
|
%patch1 -p1 |
48 |
|
|
%patch2 -p1 |
49 |
|
|
%nodejs_symlink_deps --check |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
%build |
53 |
|
|
%if 0%{?enable_grunt} |
54 |
|
|
grunt uglify |
55 |
|
|
%else |
56 |
|
|
# Add copyright header to the minified script. |
57 |
|
|
head -n 8 lib/hooker.js > dist/ba-hooker.min.js.new |
58 |
|
|
# Minify and preserve timestamp. |
59 |
|
|
/usr/bin/uglifyjs dist/ba-hooker.js -m -c >> dist/ba-hooker.min.js.new |
60 |
|
|
touch -r dist/ba-hooker.min.js dist/ba-hooker.min.js.new |
61 |
|
|
mv dist/ba-hooker.min.js{.new,} |
62 |
|
|
%endif |
63 |
|
|
|
64 |
|
|
|
65 |
|
|
%install |
66 |
|
|
mkdir -p %{buildroot}%{nodejs_sitelib}/hooker |
67 |
|
|
cp -pr package.json child.js dist/ lib/ parent.js \ |
68 |
|
|
%{buildroot}%{nodejs_sitelib}/hooker |
69 |
|
|
|
70 |
|
|
%nodejs_symlink_deps |
71 |
|
|
|
72 |
|
|
|
73 |
|
|
%if 0%{?enable_tests} |
74 |
|
|
%check |
75 |
|
|
%if 0%{?enable_grunt} |
76 |
|
|
grunt nodeunit |
77 |
|
|
%else |
78 |
|
|
%{nodejs_sitelib}/nodeunit/bin/nodeunit test/*.js |
79 |
|
|
%endif |
80 |
|
|
%endif |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
%files |
84 |
|
|
%doc LICENSE-MIT README.md |
85 |
|
|
%{nodejs_sitelib}/hooker |