class Geminabox::Proxy::Hostess
Attributes
file_handler[RW]
Public Instance Methods
serve()
click to toggle source
# File lib/geminabox/proxy/hostess.rb, line 9 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
Private Instance Methods
copy_file(file_name)
click to toggle source
# File lib/geminabox/proxy/hostess.rb, line 74 def copy_file(file_name) self.file_handler = Copier.copy(file_name) end
get_from_rubygems_if_not_local()
click to toggle source
# File lib/geminabox/proxy/hostess.rb, line 57 def get_from_rubygems_if_not_local file = File.expand_path(File.join(Server.data, *request.path_info)) unless File.exists?(file) ruby_gems_url = Geminabox.ruby_gems_url path = File.join(ruby_gems_url, *request.path_info) content = Geminabox.http_adapter.get_content(path) GemStore.create(IncomingGem.new(StringIO.new(content))) end end
splice_file(file_name)
click to toggle source
# File lib/geminabox/proxy/hostess.rb, line 70 def splice_file(file_name) self.file_handler = Splicer.make(file_name) end