homebrew-core/Formula/nvm.rb
2015-09-28 15:44:58 +01:00

38 lines
1.1 KiB
Ruby

class Nvm < Formula
desc "Manage multiple Node.js versions"
homepage "https://github.com/creationix/nvm"
url "https://github.com/creationix/nvm/archive/v0.27.1.tar.gz"
sha256 "74f843bf743017c086ea0c2549999afb0c81d8f5fa8bd2fdc92da37617e5b279"
head "https://github.com/creationix/nvm.git"
def install
prefix.install "nvm.sh", "nvm-exec"
bash_completion.install "bash_completion" => "nvm"
end
def caveats; <<-EOS.undent
You should create NVM's working directory if it doesn't exist:
mkdir ~/.nvm
Add the following to #{shell_profile} or your desired shell
configuration file:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
You can set $NVM_DIR to any location, but leaving it unchanged from
#{prefix} will destroy any nvm-installed Node installations
upon upgrade/reinstall.
Type `nvm help` for further information.
EOS
end
test do
output = pipe_output("#{prefix}/nvm-exec 2>&1")
assert_no_match /No such file or directory/, output
assert_no_match /nvm: command not found/, output
assert_match /Node Version Manager/, output
end
end