rubygems / rfcs

RubyGems + Bundler RFCs
45 stars 40 forks source link

RFC for `change` command #14

Closed agrim123 closed 5 months ago

agrim123 commented 6 years ago

Rendered

colby-swandale commented 6 years ago

Does this command run bundle install once the change is made? Is this optional? What happens if the user runs bundle change but the gem cannot be installed?

How does it handle parsing the Gemifle? What happens if the gem is declared in a non-standard way in the Gemfile?

agrim123 commented 6 years ago

Does this command run bundle install once the change is made?

Yes. Basically its the add command that does this.

Is this optional?

Not yet but this can be made optional.

What happens if the user runs bundle change but the gem cannot be installed?

Add command remotely resolves before adding it to Gemfile. So I think it should work.

What happens if the user runs bundle change but the gem cannot be installed?

Assuming that gem has been successfully removed and added but error occurs when add runs bundle install. I think add will handle that and throw appropriate error.

How does it handle parsing the Gemifle? What happens if the gem is declared in a non-standard way in the Gemfile?

This is all dependent on remove command. If gem could not be found/removed or extra gems are removed then the remove command throws error and the Gemfile is reverted.

agrim123 commented 6 years ago

@segiddins @colby-swandale How about adding an option --skip-install for not running bundle install as colby mentioned? It would just pass this option to add command which already supports it.

segiddins commented 6 years ago

@agrim123 sounds good!

simi commented 2 years ago

Given the custom Gemfile.lock and Ruby nature of Gemfile files, it is (at least in my eyes) super complex to manipulate with those files in safe way. I was thinking for long time to support alternative format which would fit majority of needs backed by YAML (for both Gemfile and Gemfile.lock).

This kind of alternative file would be super easy to modify in non-interactive way with bundle add/remove/change/... commands. On the other side it would not be able to evaluate Ruby in Gemfile anymore (which per my experience is not widely used, but could be still helpful).

Is it worth to create initial RFC for this kind of alternative Gemfile/Gemfile.lock syntax?

deivid-rodriguez commented 2 years ago

I think RuboCop is pretty good at enforcing Gemfile styles, I think we should not mess with that. I also think bundle change is too hard and in general I don't want to add more commands that manipulate Gemfiles in this way.

If we had an alternative non dynamic YAML/JSON format, that would make this much easier indeed. But I'm not sure of the chances that someone steps in and implements something like that. So I'm not fully sure whether it's worth spending time on a RFC.