Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

rubygems_proxy now compatible with new bundler API #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions rubygems_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require "fileutils"
require "logger"
require "erb"
require 'digest/md5'

class RubygemsProxy
attr_reader :env
Expand Down Expand Up @@ -119,16 +120,23 @@ def specs?
env["PATH_INFO"] =~ /specs\..+\.gz$/
end

def dependencies?
env["PATH_INFO"] =~ /dependencies/
end

def filepath
if specs?
File.join(root_dir, env["PATH_INFO"])
else
File.join(cache_dir, env["PATH_INFO"])
else dependencies? ?
File.join(cache_dir, env["PATH_INFO"] + "-" + Digest::MD5.hexdigest(env["QUERY_STRING"])) :
File.join(cache_dir, env["PATH_INFO"])
end
end

def url
File.join("http://rubygems.org", env["PATH_INFO"])
dependencies? ?
File.join("http://rubygems.org", env["PATH_INFO"] + "?" + env["QUERY_STRING"]) :
File.join("http://rubygems.org", env["PATH_INFO"])
end

def update_specs
Expand Down