Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add bundler to rubygems#show with clippy

  • Loading branch information...
commit 3ed58481bb8ad6dafe96ab09681b73de9b01e055 1 parent 15b7429
Nick Quaranto qrush authored
4 app/models/version.rb
View
@@ -196,6 +196,10 @@ def to_title
end
end
+ def to_bundler
+ %{gem "#{rubygem.name}", "~> #{number}"}
+ end
+
def to_gem_version
Gem::Version.new(number)
end
20 app/views/rubygems/_clippy.html.erb
View
@@ -0,0 +1,20 @@
+<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ width="110"
+ id="<%= embed %>" >
+ <param name="movie" value="/<%= embed %>.swf"/>
+ <param name="allowScriptAccess" value="always" />
+ <param name="quality" value="high" />
+ <param name="scale" value="noscale" />
+ <param NAME="FlashVars" value="text=<%= text %>">
+ <param name="wmode" value="transparent">
+ <embed src="/<%= embed %>.swf"
+ width="110"
+ name="clippy"
+ quality="high"
+ allowScriptAccess="always"
+ type="application/x-shockwave-flash"
+ pluginspage="http://www.macromedia.com/go/getflashplayer"
+ FlashVars="text=<%= text %>"
+ wmode="transparent"
+ />
+</object>
29 app/views/rubygems/show.html.erb
View
@@ -12,28 +12,7 @@
</div>
<div class="border">
- <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
- width="110"
- height="32"
- id="clippy" >
- <param name="movie" value="/clippy.swf"/>
- <param name="allowScriptAccess" value="always" />
- <param name="quality" value="high" />
- <param name="scale" value="noscale" />
- <param NAME="FlashVars" value="text=<%= @latest_version.to_install %>">
- <param name="wmode" value="transparent">
- <embed src="/clippy.swf"
- width="110"
- height="32"
- name="clippy"
- quality="high"
- allowScriptAccess="always"
- type="application/x-shockwave-flash"
- pluginspage="http://www.macromedia.com/go/getflashplayer"
- FlashVars="text=<%= @latest_version.to_install %>"
- wmode="transparent"
- />
- </object>
+ <%= render :partial => "clippy", :locals => { :embed => "clippy", :text => @latest_version.to_install } %>
<div class="install">
<div class="instructions"><strong>install</strong><span><%= @latest_version.to_install %></span></div>
</div>
@@ -96,6 +75,12 @@
<%= link_to_page "Bug Tracker", @rubygem.linkset.bugs %>
</div>
<% end %>
+
+ <div class="bundler">
+ <h5>Bundler</h5>
+ <%= render :partial => "clippy", :locals => { :embed => "github_clippy", :text => @latest_version.to_bundler } %>
+ <pre><code><%= @latest_version.to_bundler %></code></pre>
+ </div>
<% end %>
<div class="versions">
BIN  public/github_clippy.swf
View
Binary file not shown
23 public/stylesheets/screen.css
View
@@ -421,6 +421,7 @@ table {
display: block;
margin-left: 582px;
margin-top: 42px;
+ height: 32px;
position: absolute;
}
@@ -679,6 +680,28 @@ table {
border-bottom: 1px solid #B4AC99;
}
+.main .info .meta .bundler {
+ padding-top: 2em;
+ padding-bottom: 2em;
+ border-bottom: 1px solid #B4AC99;
+}
+
+.main .info .meta .bundler pre {
+ display: block;
+ margin: 0;
+}
+
+.main .info .meta .bundler #github_clippy {
+ margin-left: 3px;
+ display: inline-block;
+ height: 10px;
+}
+
+.main .info .meta .bundler h5 {
+ margin-bottom: 0.7em;
+ display: inline-block;
+}
+
.main .info .meta .links h5 {
display: inline-block;
margin-right: 0.7em;
4 test/unit/version_test.rb
View
@@ -192,6 +192,10 @@ class VersionTest < ActiveSupport::TestCase
assert_equal "#{@version.rubygem.name} (#{@version.to_s})", @version.to_title
end
+ should "give version with twiddle-wakka for #to_bundler" do
+ assert_equal %{gem "#{@version.rubygem.name}", "~> #{@version.to_s}"}, @version.to_bundler
+ end
+
should "give title and platform for #to_title" do
@version.platform = "zomg"
assert_equal "#{@version.rubygem.name} (#{@version.number}-zomg)", @version.to_title
Please sign in to comment.
Something went wrong with that request. Please try again.