From 0bd91722863142b5767c700ab5e704caac72f6f4 Mon Sep 17 00:00:00 2001 From: William Oliveira Date: Mon, 17 Sep 2012 19:26:19 -0300 Subject: [PATCH] Adding colored art file Creating functions to run audit after the art Removing art file, as it uses curl Adding colored art inline Removing function keywords --- setup/install.sh | 289 ++++++++++++++++++++++++++++------------------- 1 file changed, 170 insertions(+), 119 deletions(-) diff --git a/setup/install.sh b/setup/install.sh index 798e834a..774c04c2 100755 --- a/setup/install.sh +++ b/setup/install.sh @@ -63,143 +63,194 @@ desc_print(){ printf "\t%s \e[47m\e[0;35m%s\e[0m %s\n" "$1" "$2" "$3" } - # audit \o/ -echo "" -echo "Wotcha! Well hi there. " -echo "Thanks for your interest in Yeoman." -echo "" -echo "Below is a quick audit I've run on your system to see if you have everything you need for Yeoman:" +audit() { + echo "" + echo "Wotcha! Well hi there. " + echo "Thanks for your interest in Yeoman." + echo "" + echo "Below is a quick audit I've run on your system to see if you have everything you need for Yeoman:" -if [[ $mac = 1 ]]; then - # xcode cli test. - cli=$(check_set $clangfile) + if [[ $mac = 1 ]]; then + # xcode cli test. + cli=$(check_set $clangfile) - # brew test. - brew=$(check_set $brewfile) -fi + # brew test. + brew=$(check_set $brewfile) + fi -if [[ $linux = 1 ]]; then - # curl test. - curl=$(check_set $curlfile) -fi + if [[ $linux = 1 ]]; then + # curl test. + curl=$(check_set $curlfile) + fi -# node test -node=$(check_set $nodefile) -if [[ $node == 1 ]]; then - nodever=$(node -e 'console.log(process.versions.node);') - # node version check - if [[ "$nodever" < "$reqnode" ]]; then - node=2 + # node test + node=$(check_set $nodefile) + if [[ $node == 1 ]]; then + nodever=$(node -e 'console.log(process.versions.node);') + # node version check + if [[ "$nodever" < "$reqnode" ]]; then + node=2 + fi fi -fi -# ruby test -ruby=$(check_set $rubyfile) -if [[ $ruby == 1 ]]; then - rubyver=$(ruby -e 'print RUBY_VERSION') - # ruby version check - if [[ "$rubyver" < "$reqruby" ]]; then - ruby=2 + # ruby test + ruby=$(check_set $rubyfile) + if [[ $ruby == 1 ]]; then + rubyver=$(ruby -e 'print RUBY_VERSION') + # ruby version check + if [[ "$rubyver" < "$reqruby" ]]; then + ruby=2 + fi fi -fi -# compass test -compass=$(check_set $compassfile) -if [[ $compass == 1 ]];then - compassver=$(compass -qv) - # compass version check - if [[ "$compassver" < "$reqcompass" ]]; then - compass=2 + # compass test + compass=$(check_set $compassfile) + if [[ $compass == 1 ]];then + compassver=$(compass -qv) + # compass version check + if [[ "$compassver" < "$reqcompass" ]]; then + compass=2 + fi fi -fi -git=$(check_set $gitfile) -gem=$(check_set $gemfile) -phantomjs=$(check_set $phantomjsfile) -jpegturbo=$(check_set $jpegturbofile) -optipng=$(check_set $optipngfile) -yeoman=$(check_set $yeomanfile) + git=$(check_set $gitfile) + gem=$(check_set $gemfile) + phantomjs=$(check_set $phantomjsfile) + jpegturbo=$(check_set $jpegturbofile) + optipng=$(check_set $optipngfile) + yeoman=$(check_set $yeomanfile) -# display results -# -# results logic -# passes first -# fails second + # display results + # + # results logic + # passes first + # fails second -echo "" + echo "" -# passes -if [[ "$mac" = 1 ]]; then - [ "$cli" -eq 1 ] && happy_print "Command Line Tools for Xcode" "are installed! " - [ "$brew" -eq 1 ] && happy_print "Homebrew" "is installed." -fi + # passes + if [[ "$mac" = 1 ]]; then + [ "$cli" -eq 1 ] && happy_print "Command Line Tools for Xcode" "are installed! " + [ "$brew" -eq 1 ] && happy_print "Homebrew" "is installed." + fi -if [[ "$linux" = 1 ]]; then - [ "$curl" -eq 1 ] && happy_print "curl" "is present, phew." -fi + if [[ "$linux" = 1 ]]; then + [ "$curl" -eq 1 ] && happy_print "curl" "is present, phew." + fi -[ "$git" -eq 1 ] && happy_print "git" "is installed, nice one." -[ "$node" -eq 1 ] && happy_print "NodeJS" "is installed." -[ "$ruby" -eq 1 ] && happy_print "ruby" "is installed." -[ "$gem" -eq 1 ] && happy_print "RubyGems" "is installed." -[ "$compass" -eq 1 ] && happy_print "Compass" "is installed." -[ "$phantomjs" -eq 1 ] && happy_print "PhantomJS" "is installed." -[ "$jpegturbo" -eq 1 ] && happy_print "jpegtran" "is installed." -[ "$optipng" -eq 1 ] && happy_print "optipng" "is installed." -[ "$yeoman" -eq 1 ] && happy_print "yeoman global npm module" "... installed!" - -# failures -if [[ "$mac" = 1 ]]; then - [ "$cli" -eq 0 ] && \ - sad_print "Command Line Tools for Xcode" "" && \ - desc_print "Visit http://stackoverflow.com/a/9329325/89484 for installation options." - [ "$brew" -eq 0 ] && \ - sad_print "Homebrew" "" && \ - desc_print "Install Homebrew from the instructions at https://github.com/mxcl/homebrew/wiki/Installation " && \ - desc_print "For best results, after install, be sure to run" "brew doctor" "and follow the recommendations." -fi + [ "$git" -eq 1 ] && happy_print "git" "is installed, nice one." + [ "$node" -eq 1 ] && happy_print "NodeJS" "is installed." + [ "$ruby" -eq 1 ] && happy_print "ruby" "is installed." + [ "$gem" -eq 1 ] && happy_print "RubyGems" "is installed." + [ "$compass" -eq 1 ] && happy_print "Compass" "is installed." + [ "$phantomjs" -eq 1 ] && happy_print "PhantomJS" "is installed." + [ "$jpegturbo" -eq 1 ] && happy_print "jpegtran" "is installed." + [ "$optipng" -eq 1 ] && happy_print "optipng" "is installed." + [ "$yeoman" -eq 1 ] && happy_print "yeoman global npm module" "... installed!" + + # failures + if [[ "$mac" = 1 ]]; then + [ "$cli" -eq 0 ] && \ + sad_print "Command Line Tools for Xcode" "" && \ + desc_print "Visit http://stackoverflow.com/a/9329325/89484 for installation options." + [ "$brew" -eq 0 ] && \ + sad_print "Homebrew" "" && \ + desc_print "Install Homebrew from the instructions at https://github.com/mxcl/homebrew/wiki/Installation " && \ + desc_print "For best results, after install, be sure to run" "brew doctor" "and follow the recommendations." + fi -if [[ "$linux" = 1 ]]; then - [ "$curl" -eq 0 ] && sad_print "curl" -fi + if [[ "$linux" = 1 ]]; then + [ "$curl" -eq 0 ] && sad_print "curl" + fi + + [ "$git" -eq 0 ] && \ + sad_print "git" "" && \ + desc_print "Install through your package manager. " && \ + desc_print "For example, with homebrew:" "brew install git" + [ "$node" -eq 0 ] && \ + sad_print "NodeJS" "" && \ + desc_print "I recommend you grab a fresh NodeJS install (>= 0.8.x) from http://nodejs.org/download/ " + [ "$ruby" -eq 0 ] && \ + sad_print "ruby" "" && \ + desc_print "Check your ruby with" "ruby -v" "(>= 1.8.7 required) and install http://www.ruby-lang.org/en/downloads/" + [ "$gem" -eq 0 ] && \ + sad_print "RubyGems" "" && \ + desc_print "You'll pick this up with your ruby installation. " + [ "$compass" -eq 0 ] && \ + sad_print "Compass" "" && \ + desc_print "is not installed: http://compass-style.org/install/ " + [ "$phantomjs" -eq 0 ] && \ + sad_print "PhantomJS" "" && \ + desc_print "Follow instructions at http://phantomjs.org/download.html - the binary installs are quick!" + [ "$jpegturbo" -eq 0 ] && \ + sad_print "jpegtran" "" && \ + desc_print "On Mac," "brew install jpeg-turbo && brew link jpeg-turbo" "should do the trick." + [ "$optipng" -eq 0 ] && \ + sad_print "optipng" "" && \ + desc_print "On Mac," "brew install optipng" "will sort you out." + [ "$yeoman" -eq 0 ] && \ + sad_print "yeoman" "" && \ + desc_print "You're missing yeoman!" "npm install -g yeoman" "will sort you out. You may need sudo." + + + + echo "" + echo "Help me out and install anything that's missing above. Additional help at http://goo.gl/XoyWI " + echo "" + printf "%s \e[47m\e[0;35m%s\e[0m %s\n" "Once you've ensured all of the above dependencies are present, we can start up Yeoman. Type" "yeoman" "at your prompt to get started." + echo "" +} + +# yeoman art. + +art() { + echo "                                                                                 +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  +                                                                                  + " +} -[ "$git" -eq 0 ] && \ - sad_print "git" "" && \ - desc_print "Install through your package manager. " && \ - desc_print "For example, with homebrew:" "brew install git" -[ "$node" -eq 0 ] && \ - sad_print "NodeJS" "" && \ - desc_print "I recommend you grab a fresh NodeJS install (>= 0.8.x) from http://nodejs.org/download/ " -[ "$ruby" -eq 0 ] && \ - sad_print "ruby" "" && \ - desc_print "Check your ruby with" "ruby -v" "(>= 1.8.7 required) and install http://www.ruby-lang.org/en/downloads/" -[ "$gem" -eq 0 ] && \ - sad_print "RubyGems" "" && \ - desc_print "You'll pick this up with your ruby installation. " -[ "$compass" -eq 0 ] && \ - sad_print "Compass" "" && \ - desc_print "is not installed: http://compass-style.org/install/ " -[ "$phantomjs" -eq 0 ] && \ - sad_print "PhantomJS" "" && \ - desc_print "Follow instructions at http://phantomjs.org/download.html - the binary installs are quick!" -[ "$jpegturbo" -eq 0 ] && \ - sad_print "jpegtran" "" && \ - desc_print "On Mac," "brew install jpeg-turbo && brew link jpeg-turbo" "should do the trick." -[ "$optipng" -eq 0 ] && \ - sad_print "optipng" "" && \ - desc_print "On Mac," "brew install optipng" "will sort you out." -[ "$yeoman" -eq 0 ] && \ - sad_print "yeoman" "" && \ - desc_print "You're missing yeoman!" "npm install -g yeoman" "will sort you out. You may need sudo." - - - -echo "" -echo "Help me out and install anything that's missing above. Additional help at http://goo.gl/XoyWI " -echo "" -printf "%s \e[47m\e[0;35m%s\e[0m %s\n" "Once you've ensured all of the above dependencies are present, we can start up Yeoman. Type" "yeoman" "at your prompt to get started." -echo "" +# function calls. +art +audit \ No newline at end of file