Comments (10)
We don't want to override the gem
bin with a shell script.
from rbenv.
I meant... I guess the problem is it's hard to get an "after" hook when you're using exec... hmmm...
from rbenv.
That area is best left to a rbenv plugin then.
I'm working on some stuff that'd make it easier to write simple shell extensions.
from rbenv.
How might that work? Are you suggesting a rbenv "geminstall" plugin?
from rbenv.
You could either define a gem
shell function and inject that way. Or there are some official methods if you created a "rubygems plugin", search for Gem.post_install_hooks
.
from rbenv.
function gem ()
{
cmd=$1
command gem $@
if [ $cmd = "install" ]; then
rbenv rehash 2>/dev/null
fi
}
I'm not sure where to contribute this though... could it go in rbenv-init? It seems kind of silly as a one-off plugin with it's own install script, etc...
from rbenv.
One of rbenv's "features" is that it doesn't override any commands with shell commands. So we're going to keep stuff like that out of core.
from rbenv.
How would one go about writing a "plugin" for this kind of thing? Pick an unused command such as "gempostinstallhook" and create a rbenv-gempostinstallhook and then recommend users then call that in their bashrc like they do "init"? :-)
from rbenv.
You might want to take a look at my rbenv-gemset, which extends rbenv using the plugin infrastructure that rbenv provides, You could probably do some of what you're talking about with a plugin that extends rbenv exec, looks to see if the command being executed is "gem", and if it is, hijacks the call and does its own thing. The drawback is that the installation procedure for these plugins is a little less transparent than I'd like (see "rbenv gemset install").
from rbenv.
https://github.com/scoz/rbenv-rehash
Threw together a quick plugin to rehash once after installing gems with executables. Really new at this so if I did something wrong feel free to correct :)
tl/dr gem install rbenv-rehash
from rbenv.
Related Issues (20)
- rbenv commands do nothing (e.g. install) HOT 4
- GRPC in nix does not work
- Helpful install message HOT 3
- Ubuntu 22 - no ruby 3.1.2 HOT 2
- clearer feedback message needed after running rbenv init HOT 1
- Question: why rbenv recommends inserting initial command to `~/.zshrc` instead of `~/.zshenv` or `~/.zprofile` ? HOT 2
- rbenv 1.2.0 (from Homebrew) not installing versions to ~/.rbenv/versions on Mac OS Ventura HOT 2
- Error installing mini_racer: ERROR: Failed to build gem native extension HOT 2
- Windows with WSL2 manual git clone installation method, wrong line endings HOT 4
- `rbenv init` fails in parallel environment HOT 2
- rbenv-doctor script fails: `printc:3: bad substitution` HOT 2
- version `GLIBC_2.38' not found HOT 2
- `rbenv doctor` warns about multiple paths, one symlinks to the other HOT 1
- homebrew ruby: gem command not found
- Multiple instances of rbenv-install HOT 2
- `gem-rehash` inop for `bundle install`
- GOV UK
- rbenv breaks non-interactive shells when switching user and installing version
- Shim doesn't work for Ruby 3.3.0 HOT 5
- Error when use "gem" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbenv.