[RUBY] Problems and solutions when trying to put rbenv with git submodule (also pyenv)

I tried using rbenv for the first time. I haven't had a chance to use it until now. I used to use nvm and pyenv for this kind of version control, so put it in my home directory where dotfiles is located with git submodule as usual ~ (Now mac, linux, freebsd, any environment, come on! )

% cd ~
% git submodule add https://github.com/sstephenson/rbenv.git ~/.rbenv

common/.shrc


~

# ruby

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

~

Let's go. It's exactly the same as pyenv (no, this is the head family). Alright. Next, you need ruby-build. that? If you put it in ~ / .rbenv / plugins / ,?

% git submodule add https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

The following path is ignored by one of your .gitignore files:
/Users/masayuki.ishikawa/.rbenv/plugins/ruby-build
Use -f if you really want to add it.

That's right. That will be the case.

Well, I don't want to put ruby-build in clone to put rbenv in submodule. Besides forking rbenv and editing .gitignore. You can put it somewhere else and put a symlink in plugins /. I googled if there was a good way, but after all I saw people who think the same way. (With ** pyenv, this wouldn't happen **.)

There is no choice but to add a git submodule to another location and let the setup script create a symbolic link.

mkdir -p ~/.rbenv-plugins
git submodule add https://github.com/sstephenson/ruby-build.git ~/.rbenv-plugins/ruby-build
ln -s ~/.rbenv-plugins/ruby-build ~/.rbenv/plugins/

Put the ln part in setup.sh in dotfiles.

bin/setup.sh


~

# rbenv
if [ -d ~/.rbenv-plugins/ruby-build -a ! -d ~/.rbenv/plugins/ruby-build ]; then
    ln -s ~/.rbenv-plugins/ruby-build ~/.rbenv/plugins/ruby-build
fi

~

When. .. .. .. that? The description of pyenv is already in setup.sh ...

bin/setup.sh


~

# pyenv
if [ -d ~/.pyenv-virtualenv -a ! -d ~/.pyenv/plugins/pyenv-virtualenv ]; then
    ln -s ~/.pyenv-virtualenv ~/.pyenv/plugins/pyenv-virtualenv
fi

~

what! The same thing is done with pyenv with virtualenv! !! !!

rbenv-san I'm sorry for a little dis.

Now. Let's hope that if you write here, someone in rubyist (someone in pythonista) might teach you a better way ~ (・ ω <)

Recommended Posts

Problems and solutions when trying to put rbenv with git submodule (also pyenv)
How to deal with "fatal: destination path''already exists and is not an empty directory." When trying to clone on Git hub
Django-A story that got stuck when trying to operate mail with SES and Amazon SES (also introduces the fastest operation procedure)
Error and solution when trying to run a classifier made with Labellio with my own ubuntu
[Tips] Dealing with errors that occur when trying to install Python 3 series less than 3.5.3 with pyenv
What to do if you get an Undefined error when trying to use pip with pyenv
[python] A note when trying to use numpy with Cython
Stumble when trying to share clipboard between VirtualBox and Mac
Problems and solutions when asked for MySQL db in Python 3