Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix marshalled quick gemspecs

  • Loading branch information...
commit a357680bb93c2fcb903bdbc4fbd6b7a92e449485 1 parent a4ee19b
@jnewland authored
Showing with 8 additions and 11 deletions.
  1. +6 −9 lib/rack_rubygems.rb
  2. +2 −2 spec/rack_rubygems_spec.rb
View
15 lib/rack_rubygems.rb
@@ -71,14 +71,13 @@ class RackRubygems < Sinatra::Base
Gem.deflate(source_index.latest_specs.map { |spec| spec.full_name }.sort.join("\n"))
end
- get "/quick/*.gemspec.rz" do
- content_type 'application/x-deflate'
- Gem.deflate(quick(params[:splat].first).to_yaml)
+ get "/quick/Marshal.#{Gem.marshal_version}/*.gemspec.rz" do
+ Gem.deflate(marshal(quick(params[:splat].first), 'application/x-deflate'))
end
- get "/quick/Marshal.#{Gem.marshal_version}/*.gemspec.rz" do
+ get "/quick/*.gemspec.rz" do
content_type 'application/x-deflate'
- Gem.deflate(marshal(quick(params[:splat].first)))
+ Gem.deflate(quick(params[:splat].first).to_yaml)
end
def source_index
@@ -97,8 +96,6 @@ def quick(selector)
name, version, platform = $1, $2, $3
specs = source_index.search Gem::Dependency.new(name, version)
- selector = [name, version, platform].map { |s| s.inspect }.join ' '
-
if platform
platform = Gem::Platform.new platform.sub(/^-/, '')
else
@@ -118,8 +115,8 @@ def quick(selector)
end
end
- def marshal(data)
- content_type 'application/octet-stream'
+ def marshal(data, type = 'application/octet-stream')
+ content_type type
Marshal.dump(data)
end
View
4 spec/rack_rubygems_spec.rb
@@ -82,7 +82,7 @@
end
it "via name, version, and platform" do
- should_match_webrick_behavior "/quick/sinatra-0.9.0.4-#{Gem::Platform.local}.gemspec.rz", :quick
+ should_match_webrick_behavior "/quick/sinatra-0.9.0.4-ruby.gemspec.rz", :quick
end
it "returns a 404 when accessing a missing gem" do
@@ -95,7 +95,7 @@
end
it "marshalled via name, version, and platform" do
- should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/sinatra-0.9.0.4-#{Gem::Platform.local}.gemspec.rz", :quick
+ should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/sinatra-0.9.0.4-ruby.gemspec.rz", :quick
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.