rubygems / rfcs

RubyGems + Bundler RFCs
45 stars 40 forks source link

NPX like behaviour like with bundle exec -i #20

Closed emilebosch closed 1 year ago

emilebosch commented 5 years ago

In the JS ecosystem there is a tool called npx which downloads a npm package and directly executes it.

Read about it here https://github.com/npm/npx

I would love to have this too in the ruby ecosystem, not sure if it needs to be part of gem or bundler. But let me know!

bundle exec -i rails/rails new blog

or

gem exec rails/rails new blog

Let me know what you all think.

emilebosch commented 5 years ago

I also offered it to build it in gem https://github.com/rubygems/rfcs/issues/20

segiddins commented 5 years ago

Have a look at https://rubygems.org/gems/gemx as well

emilebosch commented 5 years ago

Thanks!

Just added this

https://github.com/emilebosch/gem-exec

Sent from my iPhone

On 12 Aug 2019, at 17:15, Samuel Giddins notifications@github.com wrote:

Have a look at https://rubygems.org/gems/gemx as well

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

indirect commented 1 year ago

I'm going to propose that we name this bundle run, and that the command in question be run inside the context of the bundle regardless of whether the gem is in the Gemfile or not. That might mean resolving and installing the gem before running, if needed. I think this is a big need in the tooling world, where eg your editor needs to be able to run rufo, but you don't have it in your Gemfile.

tl;dr: bundle run rufo would effectively do a temporary bundle add rufo && bundle exec rufo without editing the on-disk Gemfile or lockfile.

emilebosch commented 1 year ago

Even though I'm was a fan of it originally, I do think having a lock file or adding it is a great thing because it makes things deterministic. it would really only be to bootstrap things like rails or Sinatra or smth that you can later check in.

indirect commented 1 year ago

Good point! We should probably count this issue as resolved by https://github.com/rubygems/rfcs/pull/45, and open a new tracking issue for bundle run or whatever we end up calling it.