Skip to content

Instantly share code, notes, and snippets.

@zarembas
Forked from jez/uninstall_gems.sh
Created October 17, 2016 12:50
Show Gist options
  • Select an option

  • Save zarembas/795df1611a3d32dc626b7f9a83ded8e6 to your computer and use it in GitHub Desktop.

Select an option

Save zarembas/795df1611a3d32dc626b7f9a83ded8e6 to your computer and use it in GitHub Desktop.

Revisions

  1. @jez jez revised this gist Aug 4, 2015. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions uninstall_gems.sh
    Original file line number Diff line number Diff line change
    @@ -36,9 +36,9 @@ else
    RUBIES=`ls $RBENVPATH/versions`
    fi

    # Don't clobber existing .ruby_version file
    if [ -f .ruby_version ]; then
    RUBY_VERSION="$(cat .ruby_version)"
    # Don't clobber existing .ruby-version file
    if [ -f ./.ruby-version ]; then
    RUBY_VERSION="$(cat ./.ruby-version)"
    fi

    for ruby in $RUBIES; do
    @@ -48,9 +48,9 @@ for ruby in $RUBIES; do
    uninstall
    done

    # Restore old .ruby_version file if there was one
    # Restore old .ruby-version file if there was one
    if [ "$RUBY_VERSION" ]; then
    echo "RUBY_VERSION" > .ruby_version
    echo "$RUBY_VERSION" > ./.ruby-version
    else
    rm .ruby_version
    rm ./.ruby-version
    fi
  2. @jez jez revised this gist Aug 4, 2015. No changes.
  3. @jez jez revised this gist Aug 4, 2015. 1 changed file with 0 additions and 56 deletions.
    56 changes: 0 additions & 56 deletions -
    Original file line number Diff line number Diff line change
    @@ -1,56 +0,0 @@
    #!/usr/bin/env bash
    #
    # Originally from https://gist.github.com/IanVaughan/2902499
    #
    # authors: Ian Vaughan
    # Jacob Zimmerman
    #
    # usage: uninstall_gems [<version> ...]
    #
    # examples:
    # Uninstall all gems in all ruby version
    # uninstall_gems
    #
    # Uninstall all gems in ruby 2.1.3
    # uninstall_gems 2.1.3
    #
    # Uninstall all gems in the current ruby version
    # uninstall_gems $(rbenv version-name)


    uninstall() {
    list=`gem list --no-versions`
    for gem in $list; do
    gem uninstall $gem -aIx
    done
    gem list
    gem install bundler
    }

    if [ "$@" ]; then
    RUBIES="$@"
    else
    #rbenv versions --bare
    RBENVPATH=`rbenv root`
    echo $RBENVPATH
    RUBIES=`ls $RBENVPATH/versions`
    fi

    # Don't clobber existing .ruby-version file
    if [ -f ./.ruby-version ]; then
    RUBY_VERSION="$(cat ./.ruby-version)"
    fi

    for ruby in $RUBIES; do
    echo '---------------------------------------'
    echo $ruby
    rbenv local $ruby
    uninstall
    done

    # Restore old .ruby-version file if there was one
    if [ "$RUBY_VERSION" ]; then
    echo "$RUBY_VERSION" > ./.ruby-version
    else
    rm ./.ruby-version
    fi
  4. @jez jez revised this gist Aug 4, 2015. 1 changed file with 56 additions and 0 deletions.
    56 changes: 56 additions & 0 deletions -
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    #!/usr/bin/env bash
    #
    # Originally from https://gist.github.com/IanVaughan/2902499
    #
    # authors: Ian Vaughan
    # Jacob Zimmerman
    #
    # usage: uninstall_gems [<version> ...]
    #
    # examples:
    # Uninstall all gems in all ruby version
    # uninstall_gems
    #
    # Uninstall all gems in ruby 2.1.3
    # uninstall_gems 2.1.3
    #
    # Uninstall all gems in the current ruby version
    # uninstall_gems $(rbenv version-name)


    uninstall() {
    list=`gem list --no-versions`
    for gem in $list; do
    gem uninstall $gem -aIx
    done
    gem list
    gem install bundler
    }

    if [ "$@" ]; then
    RUBIES="$@"
    else
    #rbenv versions --bare
    RBENVPATH=`rbenv root`
    echo $RBENVPATH
    RUBIES=`ls $RBENVPATH/versions`
    fi

    # Don't clobber existing .ruby-version file
    if [ -f ./.ruby-version ]; then
    RUBY_VERSION="$(cat ./.ruby-version)"
    fi

    for ruby in $RUBIES; do
    echo '---------------------------------------'
    echo $ruby
    rbenv local $ruby
    uninstall
    done

    # Restore old .ruby-version file if there was one
    if [ "$RUBY_VERSION" ]; then
    echo "$RUBY_VERSION" > ./.ruby-version
    else
    rm ./.ruby-version
    fi
  5. @jez jez revised this gist Dec 21, 2014. 1 changed file with 39 additions and 4 deletions.
    43 changes: 39 additions & 4 deletions uninstall_gems.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,22 @@
    #!/usr/bin/env bash
    #
    # Originally from https://gist.github.com/IanVaughan/2902499
    #
    # authors: Ian Vaughan
    # Jacob Zimmerman
    #
    # usage: uninstall_gems [<version> ...]
    #
    # examples:
    # Uninstall all gems in all ruby version
    # uninstall_gems
    #
    # Uninstall all gems in ruby 2.1.3
    # uninstall_gems 2.1.3
    #
    # Uninstall all gems in the current ruby version
    # uninstall_gems $(rbenv version-name)


    uninstall() {
    list=`gem list --no-versions`
    @@ -9,13 +27,30 @@ uninstall() {
    gem install bundler
    }

    #rbenv versions --bare
    RBENVPATH=`rbenv root`
    echo $RBENVPATH
    RUBIES=`ls $RBENVPATH/versions`
    if [ "$@" ]; then
    RUBIES="$@"
    else
    #rbenv versions --bare
    RBENVPATH=`rbenv root`
    echo $RBENVPATH
    RUBIES=`ls $RBENVPATH/versions`
    fi

    # Don't clobber existing .ruby_version file
    if [ -f .ruby_version ]; then
    RUBY_VERSION="$(cat .ruby_version)"
    fi

    for ruby in $RUBIES; do
    echo '---------------------------------------'
    echo $ruby
    rbenv local $ruby
    uninstall
    done

    # Restore old .ruby_version file if there was one
    if [ "$RUBY_VERSION" ]; then
    echo "RUBY_VERSION" > .ruby_version
    else
    rm .ruby_version
    fi
  6. Ian Vaughan created this gist Jun 9, 2012.
    21 changes: 21 additions & 0 deletions uninstall_gems.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/usr/bin/env bash

    uninstall() {
    list=`gem list --no-versions`
    for gem in $list; do
    gem uninstall $gem -aIx
    done
    gem list
    gem install bundler
    }

    #rbenv versions --bare
    RBENVPATH=`rbenv root`
    echo $RBENVPATH
    RUBIES=`ls $RBENVPATH/versions`
    for ruby in $RUBIES; do
    echo '---------------------------------------'
    echo $ruby
    rbenv local $ruby
    uninstall
    done