aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/language/node.rb
diff options
context:
space:
mode:
authorChristian Moritz2017-06-26 21:47:47 +0200
committerChristian Moritz2017-06-29 20:29:25 +0200
commit6baea2543aef21d996f04a3eff96185c4a6feba1 (patch)
tree16f13442c6266e1ec1bc94b40e9f10ec5a1d4e61 /Library/Homebrew/language/node.rb
parent466fe9841a9af915fe78c1fd8648a745610f942d (diff)
downloadbrew-6baea2543aef21d996f04a3eff96185c4a6feba1.tar.bz2
language/node: set cache config via argument
instead of writing a .npmrc file, which simplifies the code. npm_cache_config is still preserved for backwarts compatiblility and usage int he kibana@n formulas in core.
Diffstat (limited to 'Library/Homebrew/language/node.rb')
-rw-r--r--Library/Homebrew/language/node.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/Library/Homebrew/language/node.rb b/Library/Homebrew/language/node.rb
index 03fa9e522..0d02a2ad0 100644
--- a/Library/Homebrew/language/node.rb
+++ b/Library/Homebrew/language/node.rb
@@ -1,7 +1,7 @@
module Language
module Node
def self.npm_cache_config
- "cache=#{HOMEBREW_CACHE}/npm_cache\n"
+ "cache=#{HOMEBREW_CACHE}/npm_cache"
end
def self.pack_for_installation
@@ -20,13 +20,9 @@ module Language
end
def self.setup_npm_environment
- npmrc = Pathname.new("#{ENV["HOME"]}/.npmrc")
- # only run setup_npm_environment once per formula
- return if npmrc.exist?
- # explicitly set npm's cache path to HOMEBREW_CACHE/npm_cache to fix
- # issues caused by overriding $HOME (long build times, high disk usage)
- # https://github.com/Homebrew/brew/pull/37#issuecomment-208840366
- npmrc.write npm_cache_config
+ # guard that this is only run once
+ return if @env_set
+ @env_set = true
# explicitly use our npm and node-gyp executables instead of the user
# managed ones in HOMEBREW_PREFIX/lib/node_modules which might be broken
begin
@@ -49,6 +45,7 @@ module Language
-ddd
--global
--build-from-source
+ --#{npm_cache_config}
--prefix=#{libexec}
#{Dir.pwd}/#{pack}
]
@@ -57,9 +54,10 @@ module Language
def self.local_npm_install_args
setup_npm_environment
# npm install args for local style module format
- %w[
+ %W[
-ddd
--build-from-source
+ --#{npm_cache_config}
]
end
end