-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Adding 'bundle grep PATTERN' for searching across gems / add bundle show --paths
#1360
Conversation
Can I ask how you did this before, with system rubygems? This seems like a feature that would be great to have, but I'm not sure it belongs in the core of Bundler? On Aug 19, 2011, at 9:24 AM, tiegzreply@reply.github.com wrote:
|
I just did a "rake build" and installed the bundler gem in the pkg folder. I just dived into the Bundler source so I'm not sure if this is the best way to do it (maybe exec instead?), but the spec did pass for me. If you didn't put it in the core of Bundler, where would be a better place? |
Sorry, I meant: how do you search for methods inside gems when you aren't using bundler? On Aug 19, 2011, at 11:20 AM, tiegzreply@reply.github.com wrote:
|
Ah! I actially don't know of a way to grep across system rubygems. Im on a train now, but I'll look later and see if there's a built in way. |
So I can't find anything in rubygems that searches for a pattern across system gems. There's always The big reason I thought this would be good for bundler was b/c projects using bundler by nature use a lot of external code. Broken tests or bugs would be much easier to track down if you could easily search among all bundled gems (even for a constant or variable, in addition to methods). Another alternative to this would be making a |
I don't think I've ever needed to search across everything in my bundle; usually I know the gem I want to dig into (via an exception usually) and I can use That way you could do things like:
|
I personally tend to use |
dpiddy: good idea for a patch; doesn't a indirect: I think Thanks for the input! Good to get others' opinions about this. |
Out of curiosity, why are you looking to avoid a shell alias/function? For bundler use I have them even for built-in commands, eg |
Those shell aliases are technically just shortcuts for existing bundler commands, but there is currently no bundler command to search amongst bundled gem sources. I just do this often enough that I felt it should be built-in. |
Right, you said:
I thought you meant you weren't a fan of
You could do that with a function, something like:
Would that be acceptable? |
Yes, I know what you meant. I'm not against a shell function/alias-- my whole point is that I thought it should be in core. But I don't mind doing a shell function/alias instead. No worries. If I have time I'll try to add |
^ Okay, that last commit adds |
Just for posterity, I came across another good use case of "bundle grep" this week. An argument to an ActiveSupport method changed from Rails 2.3.* to Rails 3.*, and actually broke a plugin that I'm using. If I had "bundle grep" I could easily search all our bundled gems that use this changed method (to ensure they still work). But I'll just use that shell alias for now ^_^ |
This patch adds a "bundle grep" cli command, which greps for a pattern across all your bundled gems.
I just noticed someone else did this too with ack (#1257) ... Seems like grep would be more ubiquitous than ack, but either way both solutions would be really helpful to me in bundler.