Code Monkey home page Code Monkey logo

Comments (10)

josh avatar josh commented on May 13, 2024

We don't want to override the gem bin with a shell script.

from rbenv.

joshgoebel avatar joshgoebel commented on May 13, 2024

I meant... I guess the problem is it's hard to get an "after" hook when you're using exec... hmmm...

from rbenv.

josh avatar josh commented on May 13, 2024

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.

#57

from rbenv.

joshgoebel avatar joshgoebel commented on May 13, 2024

How might that work? Are you suggesting a rbenv "geminstall" plugin?

from rbenv.

josh avatar josh commented on May 13, 2024

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.

joshgoebel avatar joshgoebel commented on May 13, 2024
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.

josh avatar josh commented on May 13, 2024

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.

joshgoebel avatar joshgoebel commented on May 13, 2024

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.

jamis avatar jamis commented on May 13, 2024

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.

scoz avatar scoz commented on May 13, 2024

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)

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.