aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/npm.rb40
1 files changed, 22 insertions, 18 deletions
diff --git a/Library/Formula/npm.rb b/Library/Formula/npm.rb
index 3daf55f20..8d5a491b8 100644
--- a/Library/Formula/npm.rb
+++ b/Library/Formula/npm.rb
@@ -8,29 +8,33 @@ class Npm <Formula
depends_on 'node'
+ def executable
+ <<-EOS
+#!/bin/sh
+exec "#{libexec}/cli.js" "$@"
+ EOS
+ end
+
def install
- # install all the required libs in libexec
- libexec.install %w[cli.js npm.js package.json doc lib man scripts]
+ doc.install Dir["doc/*"]
+ prefix.install ["LICENSE", "README.md"]
- # install man pages
+ # install all the required libs in libexec so `npm help` will work
+ libexec.install Dir["*"]
+
+ # add "npm-" prefix to man pages link them into the libexec man pages
man1.mkpath
- ln_s libexec+'man/npm.1', man1+'npm.1'
+ Dir.chdir libexec+"man" do
+ Dir["*"].each do |file|
+ if file == "npm.1"
+ ln_s "#{libexec}/man/#{file}", man1
+ else
+ ln_s "#{libexec}/man/#{file}", "#{man1}/npm-#{file}"
+ end
+ end
+ end
# install the wrapper executable
(bin+"npm").write executable
end
-
- def caveats
- <<-EOS.undent
- npm is still under heavy development.
- Hopefully this package will help keep people up to date.
- EOS
- end
-
- def executable
- <<-EOS
-#!/bin/sh
-exec "#{libexec}/cli.js" "$@"
- EOS
- end
end