install: some tweaks and clean-up

master
elliottcable 2015-02-04 16:39:57 -06:00
parent 6cfc309336
commit 0717d5f995
2 changed files with 6 additions and 6 deletions

View File

@ -133,14 +133,14 @@ nvm_check_global_modules() {
[ "${NPM_VERSION%%[!0-9]*}" -gt 1 ] || return 0 [ "${NPM_VERSION%%[!0-9]*}" -gt 1 ] || return 0
local NPM_GLOBAL_MODULES local NPM_GLOBAL_MODULES
NPM_GLOBAL_MODULES=$(npm list -g --depth=0 | sed '/ npm@/d') NPM_GLOBAL_MODULES="$(npm list -g --depth=0 | sed '/ npm@/d')"
local MODULE_COUNT local MODULE_COUNT
MODULE_COUNT=$( MODULE_COUNT="$(
printf %s\\n "$NPM_GLOBAL_MODULES" | printf %s\\n "$NPM_GLOBAL_MODULES" |
sed -ne '1!p' | # Remove the first line sed -ne '1!p' | # Remove the first line
wc -l | tr -d ' ' # Count entries wc -l | tr -d ' ' # Count entries
) )"
if [ $MODULE_COUNT -ne 0 ]; then if [ $MODULE_COUNT -ne 0 ]; then
cat <<-'END_MESSAGE' cat <<-'END_MESSAGE'

View File

@ -25,11 +25,11 @@ setup () {
setup setup
npm install -g nop >/dev/null 2>&1 npm install -g nop >/dev/null
message=$(nvm_check_global_modules) message=$(nvm_check_global_modules)
[ ! -z "$message" ] || die "nvm_check_global_modules should have printed a notice when npm had global modules installed" [ ! -z "$message" ] || die "nvm_check_global_modules should have printed a notice when npm had global modules installed"
npm uninstall -g nop >/dev/null 2>&1 npm uninstall -g nop >/dev/null
message=$(nvm_check_global_modules) message=$(nvm_check_global_modules)
[ -z "$message" ] || die "nvm_check_global_modules should not have printed a notice when npm had no global modules installed" [ -z "$message" ] || die "nvm_check_global_modules should not have printed a notice when npm had no global modules installed"