Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
node: make post_install repeatable.
  • Loading branch information
MikeMcQuaid committed Apr 4, 2014
1 parent 223253a commit c431259
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Library/Formula/node.rb
Expand Up @@ -53,20 +53,24 @@ def post_install

npm_root = node_modules/"npm"
npmrc = npm_root/"npmrc"
npmrc.delete if npmrc.exist?
npmrc.write("prefix = #{HOMEBREW_PREFIX}\n")
npmrc.atomic_write("prefix = #{HOMEBREW_PREFIX}\n")

npm_root.cd { system "make", "install" }
system "#{HOMEBREW_PREFIX}/bin/npm", "update", "npm", "-g"

Pathname.glob(npm_root/"man/*") do |man|
dir = send(man.basename)
man.children.each {|file| dir.install_symlink(file) }
man.children.each do |file|
next if (dir/file.basename).exist?
dir.install_symlink(file)
end
end

if build.with? "completion"
bash_completion.install_symlink \
npm_root/"lib/utils/completion.sh" => "npm"
unless (bash_completion/"npm").exist?
bash_completion.install_symlink \
npm_root/"lib/utils/completion.sh" => "npm"
end
end
end

Expand Down

0 comments on commit c431259

Please sign in to comment.