Commit 5f8a86ce 5f8a86ce5bf188a98474c8b5cb3647f447ac19ee by Jan Schaumann

add a simplistic RPM just so you can easily (un)install this

1 parent 9d9c6652
1 %define name casperjs
2 %define version 1.0.0
3 %define release RC4
4 %define prefix /usr
5
6 %define mybuilddir %{_builddir}/%{name}-%{version}-root
7
8 Summary: open source navigation scripting & testing utility written in Javascript
9 Name: %{name}
10 Version: %{version}
11 License: BSD
12 Release: %{release}
13 Packager: Jan Schaumann <jschauma@etsy.com>
14 Group: Utilities/Misc
15 Source: %{name}-%{version}.tar.gz
16 BuildRoot: /tmp/%{name}-%{version}-root
17
18 Requires: phantomjs
19
20 %description
21 CasperJS is an open source navigation scripting & testing utility written
22 in Javascript and based on PhantomJS. It eases the process of defining a
23 full navigation scenario and provides useful high-level functions, methods
24 & syntactic sugar for doing common tasks
25
26 %prep
27 %setup -q
28
29 %setup
30 mkdir -p %{mybuilddir}%{prefix}/bin
31 mkdir -p %{mybuilddir}%{prefix}/share/%{name}/bin
32 mkdir -p %{mybuilddir}%{prefix}/share/%{name}/modules
33 mkdir -p %{mybuilddir}%{prefix}/share/%{name}/samples
34
35 %install
36 cp bin/%{name} %{mybuilddir}%{prefix}/share/%{name}/bin/
37 ln -s %{prefix}/share/%{name}/bin/%{name} %{mybuilddir}%{prefix}/bin/%{name}
38 cp bin/bootstrap.js %{mybuilddir}%{prefix}/share/%{name}/bin/
39 # Yes, this tool needs this file in the 'bin' directory.
40 cp bin/usage.txt %{mybuilddir}%{prefix}/share/%{name}/bin/
41 cp CHANGELOG.md %{mybuilddir}%{prefix}/share/%{name}/
42 cp CONTRIBUTING.md %{mybuilddir}%{prefix}/share/%{name}/
43 cp CONTRIBUTORS.md %{mybuilddir}%{prefix}/share/%{name}/
44 cp LICENSE.md %{mybuilddir}%{prefix}/share/%{name}/
45 cp README.md %{mybuilddir}%{prefix}/share/%{name}/
46 cp package.json %{mybuilddir}%{prefix}/share/%{name}/
47 cp -R modules/* %{mybuilddir}%{prefix}/share/%{name}/modules/
48 cp -R samples/* %{mybuilddir}%{prefix}/share/%{name}/samples/
49
50 %files
51 %defattr(0444,root,root)
52 %attr(0555,root,root)%{prefix}/bin/%{name}
53 %attr(0555,root,root)%{prefix}/share/%{name}/bin/%{name}
54 %attr(0555,root,root)%{prefix}/share/%{name}/bin/bootstrap.js
55 %{prefix}/share/%{name}/bin/usage.txt
56 %{prefix}/share/%{name}/CHANGELOG.md
57 %{prefix}/share/%{name}/CONTRIBUTING.md
58 %{prefix}/share/%{name}/CONTRIBUTORS.md
59 %{prefix}/share/%{name}/LICENSE.md
60 %{prefix}/share/%{name}/README.md
61 %{prefix}/share/%{name}/package.json
62 %{prefix}/share/%{name}/modules/casper.js
63 %{prefix}/share/%{name}/modules/cli.js
64 %{prefix}/share/%{name}/modules/clientutils.js
65 %{prefix}/share/%{name}/modules/colorizer.js
66 %{prefix}/share/%{name}/modules/events.js
67 %{prefix}/share/%{name}/modules/http.js
68 %{prefix}/share/%{name}/modules/injector.js
69 %{prefix}/share/%{name}/modules/mouse.js
70 %{prefix}/share/%{name}/modules/querystring.js
71 %{prefix}/share/%{name}/modules/tester.js
72 %{prefix}/share/%{name}/modules/utils.js
73 %{prefix}/share/%{name}/modules/vendors/coffee-script.js
74 %{prefix}/share/%{name}/modules/xunit.js
75 %{prefix}/share/%{name}/samples/bbcshots.coffee
76 %{prefix}/share/%{name}/samples/bbcshots.js
77 %{prefix}/share/%{name}/samples/cliplay.coffee
78 %{prefix}/share/%{name}/samples/cliplay.js
79 %{prefix}/share/%{name}/samples/customevents.coffee
80 %{prefix}/share/%{name}/samples/customevents.js
81 %{prefix}/share/%{name}/samples/customlogging.coffee
82 %{prefix}/share/%{name}/samples/customlogging.js
83 %{prefix}/share/%{name}/samples/download.coffee
84 %{prefix}/share/%{name}/samples/download.js
85 %{prefix}/share/%{name}/samples/dynamic.coffee
86 %{prefix}/share/%{name}/samples/dynamic.js
87 %{prefix}/share/%{name}/samples/each.coffee
88 %{prefix}/share/%{name}/samples/each.js
89 %{prefix}/share/%{name}/samples/events.coffee
90 %{prefix}/share/%{name}/samples/events.js
91 %{prefix}/share/%{name}/samples/extends.coffee
92 %{prefix}/share/%{name}/samples/extends.js
93 %{prefix}/share/%{name}/samples/googlelinks.coffee
94 %{prefix}/share/%{name}/samples/googlelinks.js
95 %{prefix}/share/%{name}/samples/googlematch.coffee
96 %{prefix}/share/%{name}/samples/googlematch.js
97 %{prefix}/share/%{name}/samples/googlepagination.coffee
98 %{prefix}/share/%{name}/samples/googlepagination.js
99 %{prefix}/share/%{name}/samples/googletesting.coffee
100 %{prefix}/share/%{name}/samples/googletesting.js
101 %{prefix}/share/%{name}/samples/logcolor.coffee
102 %{prefix}/share/%{name}/samples/logcolor.js
103 %{prefix}/share/%{name}/samples/metaextract.coffee
104 %{prefix}/share/%{name}/samples/metaextract.js
105 %{prefix}/share/%{name}/samples/multirun.coffee
106 %{prefix}/share/%{name}/samples/multirun.js
107 %{prefix}/share/%{name}/samples/screenshot.coffee
108 %{prefix}/share/%{name}/samples/screenshot.js
109 %{prefix}/share/%{name}/samples/statushandlers.coffee
110 %{prefix}/share/%{name}/samples/statushandlers.js
111 %{prefix}/share/%{name}/samples/steptimeout.coffee
112 %{prefix}/share/%{name}/samples/steptimeout.js
113 %{prefix}/share/%{name}/samples/timeout.coffee
114 %{prefix}/share/%{name}/samples/timeout.js
115
116 %changelog
117 * Mon Nov 26 2012 Jan Schaumann <jschauma@etsy.com>
118 - first rpm version
1 #!/bin/sh
2 #
3 # A silly little helper script to build the RPM.
4 set -e
5
6 name=${1:?"Usage: build <toolname>"}
7 name=${name%.spec}
8 topdir=$(mktemp -d)
9 version=$(awk '/define version/ { print $NF }' ${name}.spec)
10 builddir=${TMPDIR:-/tmp}/${name}-${version}
11 sourcedir="${topdir}/SOURCES"
12 buildroot="${topdir}/BUILD/${name}-${version}-root"
13 mkdir -p ${topdir}/RPMS ${topdir}/SRPMS ${topdir}/SOURCES ${topdir}/BUILD
14 mkdir -p ${buildroot} ${builddir}
15 echo "=> Copying sources..."
16 ( cd .. && tar cf - ./[A-Z]* ./package.json ./bin ./samples ./modules | tar xf - -C ${builddir} )
17 echo "=> Creating source tarball under ${sourcedir}..."
18 ( cd ${builddir}/.. && tar zcf ${sourcedir}/${name}-${version}.tar.gz ${name}-${version} )
19 echo "=> Building RPM..."
20 #rpmbuild --define "_topdir ${topdir}" --buildroot ${buildroot} --clean -bb ${name}.spec
21 rpm=$(rpmbuild --define "_topdir ${topdir}" --buildroot ${buildroot} --clean -bb ${name}.spec 2>/dev/null | \
22 awk '/\/RPMS\// { print $2; }')
23 cp ${rpm} ${TMPDIR:-/tmp}/
24 rm -fr ${topdir}
25 echo ${TMPDIR:-/tmp}/${rpm##*/}