Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save puffnfresh/483810 to your computer and use it in GitHub Desktop.

Select an option

Save puffnfresh/483810 to your computer and use it in GitHub Desktop.
From 57ae2bf86e269702ae417edc03565c1f0b3ed7d0 Mon Sep 17 00:00:00 2001
From: Brian McKenna <brian@brianmckenna.org>
Date: Wed, 21 Jul 2010 09:56:09 +1000
Subject: [PATCH] Making install task recognise npm config. Fixes issue #522
---
Cakefile | 8 ++++++++
package.json | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Cakefile b/Cakefile
index 098f6c9..6044b30 100644
--- a/Cakefile
+++ b/Cakefile
@@ -19,11 +19,19 @@ log: (message, color, explanation) ->
puts "$color$message$reset ${explanation or ''}"
option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
+option '-P', '--platform [npm]', 'set the platform coffee is to be installed in'
task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
base: options.prefix or '/usr/local'
lib: "$base/lib/coffee-script"
bin: "$base/bin"
+
+ if options.platform == 'npm'
+ npm: require 'npm'
+ bin: npm.config.get('binroot')
+ base: npm.config.get('root')
+ lib: "$base/coffee-script"
+
node: "~/.node_libraries/coffee-script"
puts "Installing CoffeeScript to $lib"
puts "Linking to $node"
diff --git a/package.json b/package.json
index f80f2aa..3296986 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,6 @@
"node": ">=0.1.99"
},
"scripts": {
- "install": "bin/cake install"
+ "install": "bin/cake --platform npm install"
}
}
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment