Browse Source

fix brew cask command more, fix inefficient default handler

Kyle P Davis 8 years ago
parent
commit
a566aa17f1
1 changed files with 16 additions and 11 deletions
  1. 16 11
      gimmes/_default

+ 16 - 11
gimmes/_default

@@ -1,15 +1,20 @@
 #!/bin/bash
 set -o errexit -o pipefail
-has curl  ||  gimme_pkg curl
-
-if [[ "$OS" = "Darwin" ]]; then
-	[[ -d "$HOME/homebrew" ]]  ||  (mkdir "$HOME/homebrew" 2>/dev/null  &&  curl -L "https://github.com/Homebrew/homebrew/tarball/master" | tar xz --strip 1 -C "$HOME/homebrew"  &&  brew update)
-	brew tap caskroom/cask
-else
-	if ! has apt-get; then
-		echo "ERROR: Your OS does not have 'apt-get' and is not currently supported."
-		echo "For support please see the website: $GIMME_URL"
+
+if ! has "$GIMME"; then
+
+	has curl  ||  gimme_pkg curl
+
+	if [[ "$OS" = "Darwin" ]]; then
+		[[ -d "$HOME/homebrew" ]]  ||  (mkdir "$HOME/homebrew" 2>/dev/null  &&  curl -L "https://github.com/Homebrew/homebrew/tarball/master" | tar xz --strip 1 -C "$HOME/homebrew"  &&  brew update)
+		[[ -d "$HOME/homebrew/Caskroom" ]]  ||  brew tap caskroom/cask
+	else
+		if ! has apt-get; then
+			echo "ERROR: Your OS does not have 'apt-get' and is not currently supported."
+			echo "For support please see the website: $GIMME_URL"
+		fi
 	fi
-fi
 
-has "$GIMME"  ||  gimme_pkg "$GIMME"
+	gimme_pkg "$GIMME"
+
+fi