ruby icon indicating copy to clipboard operation
ruby copied to clipboard

Support for bundler binstubs

Open fgrehm opened this issue 3 years ago • 5 comments

Slack thread

Describe the Enhancement

Allow us to save a few keystrokes and stop typing in bundle exec on interactive shell sessions.

Possible Solution

Introduce a new bundler-binstubs buildpack that contributes binstubs for all gems installed and pushes them to app's $PATHs. We could start by only pushing them to launch layers unless ppl feel there's a need for them at build time as well.

Motivation

Less typing is always better :smile:

fgrehm avatar Sep 23 '22 20:09 fgrehm

@fgrehm as discussed on Slack, I was wondering if there was a way we could implement this inside of the bundle install buildpack. It would involve running the bundle binstub command for each of the installed launch gems (perhaps if an environment variable is set?). I'm not sure if this would muddy the waters too much of the Bundle Install buildpack's job but it does seem like making the gems available for direct execution would be a part of bundler's job.

sophiewigmore avatar Sep 29 '22 15:09 sophiewigmore

Works for me!

Looks like we could do something like bundle binstubs --path={{ .layer.Path}}/binstubs --all around here and layer.LaunchEnv.Prepend("PATH", filepath.Join(layer.Path, "binstubs")) afterwards later in the build

What do you think? That should be enough and we could enable the behavior by setting the BP_BUNDLER_BINSTUBS=true flag

fgrehm avatar Sep 29 '22 23:09 fgrehm

this seems like a valid path forward to me! @paketo-buildpacks/ruby-maintainers feel free to chime in if you have any concerns. I also don't feel like the new environment variable needs an RFC especially because it's not default behaviour, but we should make sure we document it well so people know about it.

sophiewigmore avatar Sep 30 '22 14:09 sophiewigmore

we should make sure we document it well so people know about it

Sure! I can make note of it on the README and https://paketo.io/docs/reference/ruby-reference/ :smile:

fgrehm avatar Sep 30 '22 14:09 fgrehm

I'm not too familiar with binstubs but this approach sounds reasonable to me. I don't think it needs an RFC as we have approval (implicit and explicit) from other ruby maintainers to support this optional feature.

I agree with the approach of adding it to bundle-install rather than making a new buildpack - assuming that is possible.

robdimsdale avatar Sep 30 '22 17:09 robdimsdale