Expose rubygem reverse depencencies#945
Conversation
|
Can you post a screenshot? |
|
@dwradcliffe yes it's on the description |
|
<3 |
|
As the maintainer of many gems, this information is incredibly useful to me—knowing which gems depend on mine, so I can see how they’re being used—but I remember when we benchmarked this query it was rather slow. Since this information is not broadly useful (to 99% of gem users vs. 1% of gem maintainers), it may make more sense to put on a separate page, so the query doesn’t need to run every time someone looks at a gem page. Also, have you tested that this will work on specific gem version pages? For example if gem |
|
I see what you mean @sferik, and I did not try with the production database. |
|
@spk 👍 Thank you for working on this feature. I’m really looking forward to the day when it’s merged and deployed. |
|
With latest production database, with rails the query is about 151.6ms and give 8073 reverse dependencies to rails gem! |
|
Maybe it will be handy to sort gems by download count. |
9fcb184 to
5515976
Compare
|
As a gem maintainer, this is a really helpful feature.. thank you! |
|
Thanks! Is it possible to have a review by the team and get it merge ? |
|
👍 Looks good to me. I’d like to see a 👍 from at least one other maintainer before merging. |
|
A few comments-
|
|
I'm going to review this today. |
95dd967 to
70c25b3
Compare
70c25b3 to
76fa2e9
Compare
76fa2e9 to
324918d
Compare
324918d to
2acaddb
Compare
|
Status since last review:
|
|
This would be a nice feature. I hope you guys find time to merge this. 👍 |
|
Is there any way we can get this on a "feature flag" type system? So if we deploy it and need to turn it off fast w/o rollback that would be feasible. Any thoughts @dwradcliffe @arthurnn ? |
|
@qrush good idea 👍 |
|
"feature flag" , should be easy to make it work. 👍 from me.. the only thing I hate about those is that people tend to leave features behind, and the code start getting 2+ code paths.. As long as we remember that. I am fine |
14cea47 to
4a54ddc
Compare
|
Great job! These pages would definitely need to be throttled so someone couldn't use it to DDoS the site ;) That is, they should have a default/fallback state of 'unavailable' at this time when the data is not available, for whatever reason. Also, any consideration to do this in JavaScript via the API, perhaps like gemloupe did? (bookmarklet below) javascript:(function(){var script=document.createElement('SCRIPT');script.src='https://www.gemlou.pe/assets/remote_loupe_consumer.js';document.body.appendChild(script);})()I'd be happy to do the JS as an Ember Component |
53b651c to
fc5785e
Compare
|
@spk I have bad news 😓 It has n+1 for def self.reverse_dependencies(name)
joins(dependencies: :rubygem)
.indexed
.where(rubygems: { name: name })
endI think first finding the gem and then using |
|
@sonalkr132 not that bad ! |
Sure 👍 |
|
not sure if this needs an index. And does this want to be case insensitive? (use |
3f7b4eb to
4a48e62
Compare
| before_action :set_page, only: [:index] | ||
|
|
||
| def index | ||
| @latest_version = @rubygem.versions.most_recent |
There was a problem hiding this comment.
Isn't @latest_version already set with before_action :latest_version?
| <header class="gems__header push"> | ||
| <%= form_tag rubygem_reverse_dependencies_path(@rubygem), | ||
| :id => "rdeps-search", :class => "header__search-wrap", :method => :get do %> | ||
| <%= search_field_tag :rdeps_query, params[:rdeps_query], :placeholder => "Search Reverse Deps Gems…".html_safe, :class => "header__search" %> |
There was a problem hiding this comment.
Please use I18n for placeholder.
| :id => "rdeps-search", :class => "header__search-wrap", :method => :get do %> | ||
| <%= search_field_tag :rdeps_query, params[:rdeps_query], :placeholder => "Search Reverse Deps Gems…".html_safe, :class => "header__search" %> | ||
| <%= label_tag :rdeps_query do %> | ||
| <span class="t-hidden">Search gems</span> |
4a48e62 to
5ef01ec
Compare
| before_action :set_page, only: [:index] | ||
|
|
||
| def index | ||
| @reverse_dependencies = @rubygem.reverse_dependencies.by_downloads |
There was a problem hiding this comment.
Please use @rubygem.reverse_dependencies.by_downloads.includes(:latest_version, :gem_download) instead.
| @@ -0,0 +1,12 @@ | |||
| <header class="gems__header push"> | |||
| <%= form_tag rubygem_reverse_dependencies_path(@rubygem), | |||
| :id => "rdeps-search", :class => "header__search-wrap", :method => :get do %> | |||
There was a problem hiding this comment.
Please use ruby 1.9 hash syntax.
* /gems/:rubygem_id/reverse_dependencies * search on reverse dependencies
5ef01ec to
2a25ff4
Compare
|
@homu r+ |
|
📌 Commit 012c1e2 has been approved by |
Expose rubygem reverse depencencies  - [x] rebase after #1498 merged - [x] Fix rubocop on rubygem_helper class - [x] Extract aside template - [x] Improve reverse deps queries, (ref #1508)
|
☀️ Test successful - status |
Uh oh!
There was an error while loading. Please reload this page.