Display external requirements for gem versions #502

wants to merge 1 commit into


None yet

4 participants


Displays external gem requirements in the same area as dependencies. Should close #489

@adkron adkron commented on the diff Jan 18, 2013
@@ -100,6 +100,18 @@
<%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.runtime } %>
<%= render :partial => "rubygems/dependencies", :locals => { :dependencies => @latest_version.dependencies.development } %>
+ <% if @latest_version.requirements.present? %>
+ <div class="dependencies requirements_dependencies">
+ <h5><%= t '.requirements_header' %></h5>
+ <ol>
+ <% Array(@latest_version.requirements).each do |requirement| %>
adkron Jan 18, 2013 Contributor

Why is there a cast to an Array here? requirements is already an array, correct?

@adkron adkron commented on the diff Jan 18, 2013
@@ -8,6 +8,7 @@ class Version < ActiveRecord::Base
after_save :reorder_versions
serialize :licenses
+ serialize :requirements
adkron Jan 18, 2013 Contributor

I think that it would be a good move to make a Requirement object. Then in the future it would be easier to add queries based on that. ie. Find all gems with a specific requirement, find gems with no external dependencies. This would help users if they want to find pure ruby gems for instance. It would also make for a nice place to hang behavior later.

Serialized objects don't work well for queries and writing a migration later would be harder than doing this now.

seeingidog Jan 18, 2013 Contributor

gemspec.requirements is not especially common, even less so than licenses which is a serialized column in this manner. I had thought a full model was overkill. If that's the way you'd like this done i'll scrap this and go that route.

adkron commented Jan 21, 2013

I'm a committer, but I'm not running the show. I don't think that anyone would complain if it was another collection.

Serializations are not the best when it comes to queries. It makes the design more flexible, and opens up a much larger world for the future.

I would remove the cast to an Array in the view. That is unless I'm missing something.

I would personally be in favor of this if it was not a serialized field.

evanphx commented Jul 13, 2013

Merged! Thanks!

@evanphx evanphx closed this Jul 13, 2013
@qrush qrush referenced this pull request Nov 28, 2014

Display gemspec.requirements #489


zomg finally! Now gem authors can expose external dependencies, directly on rubygems.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment