Giter Site home page Giter Site logo

rbenv folder overwritten? about dotfiles HOT 4 CLOSED

AlJohri avatar AlJohri commented on August 25, 2024
rbenv folder overwritten?

from dotfiles.

Comments (4)

AlJohri avatar AlJohri commented on August 25, 2024

Not the best bash scripting, but I got around the issue like this for now:

echo $DOTFILE | egrep -q '(^rbenv/$|pyenv/$|nodenv/$)' && continue
mkdir -p $(pyenv root)
mkdir -p $(rbenv root)
mkdir -p $(nodenv root)

for FOLDER in rbenv pyenv nodenv; do
  if [ -d "$FOLDER" ]; then
    for DOTFILE in $FOLDER/*; do
      DIRFILE="$DOTFILESDIR/$DOTFILE"
      HOMEFILE="$HOME/.$DOTFILE"
      if [ -L "$HOMEFILE" ] && ! [ -d $DOTFILE ]
      then
        ln -sfv "$DIRFILE" "$HOMEFILE"
      elif ! [ -d $DOTFILE ]
      then
        rm -v "$HOMEFILE"
        ln -sv "$DIRFILE" "$HOMEFILE"
      else
        echo "ignoring $DOTFILE because it is a directory"
      fi
    done
  fi
done

from dotfiles.

MikeMcQuaid avatar MikeMcQuaid commented on August 25, 2024

will attempt to rm -rv the ~/.rbenv folder if the script is run a second time.

Yep but as it's a symlink that's quick enough for us not to care. If it's a preexisting directory it'll kill it.

from dotfiles.

AlJohri avatar AlJohri commented on August 25, 2024

Ah, I see. Perhaps then you can add to the .gitignore:

rbenv/*
!rbenv/default-gems

I ran into the situation where I had the setup script run the first time but I didn't have the rbenv folder in my dotfiles. When I tried to later add the rbenv folder to my dotfiles, it attempted to delete the existing rbenv installation as it wasn't a symlink but an actual file.

Definitely a fringe case though.

from dotfiles.

MikeMcQuaid avatar MikeMcQuaid commented on August 25, 2024

from dotfiles.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.