SameShirtEveryDay.com

Personal blog of the one called Alex Gorbatchev, from Toronto, Canada.

Bash script to install Gems

Posted on October 24th, 2007 by Alex Gorbatchev. In Misc, Ruby. No comments yet...

I looked all over and couldn’t find a bash script which could check and if missing install a list of gems. I had to hack my own up:

GEMS=( `cat gems.txt` ) # gems.txt has one gem name per line

for gem in "${GEMS[@]}"; do
  found=`gem list $gem | grep -i $gem`
  if [ "$found" != "" ]; then
    parts=( $found )
    echo "Found ${parts[0]} ${parts[1]}"
    continue
  fi

  echo "---------------------------"
  echo "Installing $gem"
  sudo gem install $gem -y
  echo "---------------------------"
done
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet, be the first one!

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> , rel="nofollow" in use - no link dropping, no keywords or domains as names; do not spam, and do not advertise!

home
Subscribe to this blog Follow me on Twitter My bookmarks on Delicious My photography on Flickr