#!/usr/bin/bash -e

# just in case of hidden files.. not sure why would someone do that, it's more
# like forgotten cache file possibility, but rather do that..
shopt -s dotglob

handle_dir() {
    # Check that $1 is not already a symlink
    # then remove the directory so that RPM can freely create the
    # symlink.
    if [ "$(readlink "$1")" == "/usr/share/gems/gems/irb-1.3.5" ]; then
        return
    fi

    # There is no configuration or anything that the user should ever customize
    # and expect to retain.
    rm -rf "$1"

    return 0
}


handle_dir /usr/share/ruby/irb
