Package: coffeescript / 1.10.0~dfsg-1

support-system-wide-install.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Description: Support system-wide and deferred installation
 Add options --destdir and --nodedir.
Author: Jonas Smedegaard <dr@jones.dk>
Forwarded: no
Last-Update: 2011-07-09

--- a/Cakefile
+++ b/Cakefile
@@ -94,21 +94,27 @@
 
 option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
 
+option '-d', '--destdir [DIR]', 'set the installation destdir for `cake install`'
+
+option '-n', '--nodedir [DIR]', 'set the installation nodedir for `cake install`'
+
 task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
   base = options.prefix or '/usr/local'
+  destdir = options.destdir or ''
   lib  = "#{base}/lib/coffee-script"
   bin  = "#{base}/bin"
-  node = "~/.node_libraries/coffee-script"
-  console.log   "Installing CoffeeScript to #{lib}"
+  nodedir = options.nodedir or "~/.node_libraries"
+  node = "#{nodedir}/coffee-script"
+  console.log   "Installing CoffeeScript to #{destdir}#{lib}"
   console.log   "Linking to #{node}"
-  console.log   "Linking 'coffee' to #{bin}/coffee"
+  console.log   "Linking 'coffee' to #{destdir}#{bin}/coffee"
   exec([
-    "mkdir -p #{lib} #{bin}"
-    "cp -rf bin lib LICENSE README.md package.json src #{lib}"
-    "ln -sfn #{lib}/bin/coffee #{bin}/coffee"
-    "ln -sfn #{lib}/bin/cake #{bin}/cake"
-    "mkdir -p ~/.node_libraries"
-    "ln -sfn #{lib}/lib/coffee-script #{node}"
+    "mkdir -p #{destdir}#{lib} #{destdir}#{bin}"
+    "cp -rf bin lib LICENSE README.md package.json src #{destdir}#{lib}"
+    "ln -sfn #{lib}/bin/coffee #{destdir}#{bin}/coffee"
+    "ln -sfn #{lib}/bin/cake #{destdir}#{bin}/cake"
+    "mkdir -p #{destdir}#{nodedir}"
+    "ln -sfn #{lib}/lib/coffee-script #{destdir}#{node}"
   ].join(' && '), (err, stdout, stderr) ->
     if err then console.log stderr.trim() else log 'done', green
   )