Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance bundle open command to allow opening subdir/file of gem #6146

Merged

Conversation

yoka
Copy link
Contributor

@yoka yoka commented Dec 18, 2022

What was the end-user or developer problem that led to this PR?

I had an development workflow halt when vscode + remote containers combo was used. The scenario was following:

I wanted to open up specific gems specific file, but as remote containers use filesystem from within the docker container I could not use bundle open command to be able to see within a specific file of a gem.

Even though remote containers does not allow easy "mount n+1 dirs" mechanisms, it would have been sufficient enough to be able to scope my bundle open command to a specific file that my tests were failing at.

I had the expectation that bundle open command would have allowed to open specific file with some syntax, but my expectations were not met.

What is your fix for the problem, implemented in this PR?

As the first intuitive command to open a specific file was to try bundle open GEM/some/file.rb this is what was implemented.

I did try out adding second argument too, so that bundle open GEM some/file.rb would have worked, but that felt kind of off.

So, wrote the tests for the core of this enhancement and tests that make sure all the other fuzz matching & "did you mean" features would work just like they've been working before this enhancement.

Make sure the following tasks are checked

  • [x ] Describe the problem / feature
  • [ x] Write tests for features and bug fixes
  • [ x] Write code to solve the problem
  • [ x] Make sure you follow the [current code style]

@welcome
Copy link

welcome bot commented Dec 18, 2022

Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack.

For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide

@simi
Copy link
Member

simi commented Dec 19, 2022

I did try out adding second argument too, so that bundle open GEM some/file.rb would have worked, but that felt kind of off.

Can you elaborate? That seems much better to me. 🤔

@deivid-rodriguez
Copy link
Member

Thanks for coding this enhancement!

I agree with @simi. If it's because of clarity, we could add a specific flag for it, like bundle open foo --path README.md?

Also using GEM/path could potentially cause ambiguity is we introduced scoped gems in the future.

@yoka
Copy link
Contributor Author

yoka commented Dec 22, 2022

Thanks for coding this enhancement!

I agree with @simi. If it's because of clarity, we could add a specific flag for it, like bundle open foo --path README.md?

Also using GEM/path could potentially cause ambiguity is we introduced scoped gems in the future.

Alright fellas, --path opt sounds reasonable to me. I'll make the necessary changes.

@yoka yoka force-pushed the add_bundle_open_subdir_support branch from 25f3f41 to ea08168 Compare December 22, 2022 06:39
@deivid-rodriguez deivid-rodriguez changed the title Enhance bundle open command to allow opening subdir/file of gem Enhance bundle open command to allow opening subdir/file of gem Dec 26, 2022
Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just added a small comment about handling a missing value.

bundler/lib/bundler/cli.rb Outdated Show resolved Hide resolved
Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@deivid-rodriguez deivid-rodriguez merged commit 6bd5aa8 into rubygems:master Jan 4, 2023
deivid-rodriguez added a commit that referenced this pull request Jan 6, 2023
Enhance `bundle open` command to allow opening subdir/file of gem

(cherry picked from commit 6bd5aa8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants