Display external requirements for gem versions #502

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

Contributor

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

@adkron adkron commented on the diff Jan 18, 2013
app/views/rubygems/show.html.erb
@@ -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
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
app/models/version.rb
@@ -8,6 +8,7 @@ class Version < ActiveRecord::Base
after_save :reorder_versions
serialize :licenses
+ serialize :requirements
adkron
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
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.

Contributor
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.

Owner
evanphx commented Jul 13, 2013

Merged! Thanks!

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

Display gemspec.requirements #489

Contributor

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