Permalink
Browse files

use npm root -g instead of relying on NODE_PATH

  • Loading branch information...
1 parent 301a522 commit 6a3b965a4fa13bedc3d4260daa4130bdd53cd26b @janl janl committed Jan 29, 2013
Showing with 4 additions and 26 deletions.
  1. +3 −25 bin/local-tld-setup
  2. +1 −1 etc/ie.hood.local-tld-service.plist.tpl
View
28 bin/local-tld-setup
@@ -7,31 +7,9 @@ MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
ETC=$MY_PATH/../etc
-# see if NODE_PATH is set.
-# if not, try to guess a bit
-if [ -z "$NODE_PATH" ]; then
- TEST_PATH=/usr/local/share/npm/lib/node_modules
- if [ -d "$TEST_PATH" ]; then
- NODE_PATH="$TEST_PATH"
- fi
-
- TEST_PATH=/usr/local/lib/node_modules
- if [ -d "$TEST_PATH" ]; then
- NODE_PATH="$TEST_PATH"
- fi
-
- if [ -z "$NODE_PATH"]; then
- echo "CANT DETERMINE NODE_PATH."
- echo "PLEASE SET NODE_PATH MANUALLY AND RUN THE INSTALLATION AGAIN"
- else
- echo "Guessed NODE_PATH '$NODE_PATH'"
- echo "Please set it in your shell environment."
- fi
-fi
-
-
-# set /ect/*.tpl vars
-sed -e s,{{NODE_PATH}},$NODE_PATH, \
+NODE_ROOT=`npm root -g`
+# set /etc/*.tpl vars
+sed -e s,{{NODE_ROOT}},$NODE_ROOT, \
etc/ie.hood.local-tld-service.plist.tpl \
> etc/ie.hood.local-tld-service.plist
View
2 etc/ie.hood.local-tld-service.plist.tpl
@@ -7,7 +7,7 @@
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
- <string>{{NODE_PATH}}/local-tld/bin/local-tld-service</string>
+ <string>{{NODE_ROOT}}/local-tld/bin/local-tld-service</string>
</array>
<key>KeepAlive</key>
<true/>

0 comments on commit 6a3b965

Please sign in to comment.