class Geminabox::Proxy::Hostess
def copy_file(file_name)
def copy_file(file_name) self.file_handler = Copier.copy(file_name) end
def get_from_rubygems_if_not_local
def get_from_rubygems_if_not_local file = File.expand_path(File.join(Server.data, *request.path_info)) unless File.exists?(file) Net::HTTP.start("production.cf.rubygems.org") do |http| path = File.join(*request.path_info) response = http.get(path) GemStore.create(IncomingGem.new(StringIO.new(response.body))) end end end
def serve
def serve if file_handler send_file file_handler.proxy_path else send_file(File.expand_path(File.join(Server.data, *request.path_info)), :type => response['Content-Type']) end end
def splice_file(file_name)
def splice_file(file_name) self.file_handler = Splicer.make(file_name) end