-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install after the fact #6
Comments
@kevinSuttle agreed! Same here… I was so disappointed when I didn’t get my sweet gems installed automagically. Clearly there’s some room to improvements on this plugin. Note: I installed using homebrew (even though it isn’t the recommended way of doing it), because I personally prefer installing such things that way whenever it is possible. |
I also install via Homebrew. I just like the convenience of automation. |
didn't work for me either (also installed it via homebrew) |
I installed straight from github but experienced the same error trying to call it directly. My ruby-build is version 20140408 which is higher that required. Having a look at the code it might be split up and another method besides the "after_install" event could be created to allow direct access to the install_default_gems() function. Also the status check should be moved out of the install_default_gems() function. Then the install_default_gems() function would be able to stand on its own so it cold be called any time you want to update your gems from the list of default gems for your currently selected ruby. |
Totally agree. How do I update my existing rubies when I modify ~/default-gems? I made this change: diff --git a/etc/rbenv.d/install/default-gems.bash b/etc/rbenv.d/install/default-gems.bash
index a8a9a6a..540fadf 100644
--- a/etc/rbenv.d/install/default-gems.bash
+++ b/etc/rbenv.d/install/default-gems.bash
@@ -1,9 +1,3 @@
-if declare -Ff after_install >/dev/null; then
- after_install install_default_gems
-else
- echo "rbenv: rbenv-default-gems plugin requires ruby-build 20130129 or later" >&2
-fi
-
install_default_gems() {
# Only install default gems after successfully installing Ruby.
[ "$STATUS" = "0" ] || return 0
@@ -34,10 +28,16 @@ install_default_gems() {
# Invoke `gem install` in the just-installed Ruby. Point its
# stdin to /dev/null or else it'll read from our default-gems
# file.
- RBENV_VERSION="$VERSION_NAME" rbenv-exec gem install "$gem_name" "${args[@]}" < /dev/null || {
+ RBENV_VERSION="$VERSION_NAME" rbenv exec gem install "$gem_name" "${args[@]}" < /dev/null || {
echo "rbenv: error installing gem \`$gem_name'"
} >&2
done < "${RBENV_ROOT}/default-gems"
fi
}
+
+if declare -Ff after_install >/dev/null; then
+ after_install install_default_gems
+else
+ VERSION_NAME="$(rbenv version-name)" RBENV_ROOT="$(rbenv root)" STATUS=0 install_default_gems
+fi And ran
Worked great! Gems are installed, and rbenv-install continues working as before. It shouldn't be too hard to expand this into a proper 'rbenv install default-gems' command. |
FWIW, I'm now running chruby with https://github.com/bronson/chruby-default-gems That includes a command to install gems after the fact. :) |
It would be great if In the meantime, this worked for me:
|
For some reason,
rbenv-default-gems
didn't run at some point, and so my gems aren't installed. I tried to install them by running the install script by itself. Here's the output in zsh:I've got the latest Rbenv and Ruby-build repos. I'm not sure if the script was intended to be used this way, but it'd be nice to have just in case.
The text was updated successfully, but these errors were encountered: