Class: Hostess::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/hostess/app.rb

Instance Method Summary collapse

Instance Method Details

#full_nameObject



39
40
41
# File 'lib/hostess/app.rb', line 39

def full_name
  @full_name ||= params[:splat].join.chomp('.gem')
end

#serveObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hostess/app.rb', line 8

def serve
  fname = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'server', 'repo', request.path_info))
  if File.exists? fname
    puts "serving #{fname} from disk"
    send_file fname
  else
    puts "couldnt find #{fname}"
    puts "fetching #{request.path_info} from http://rubygems.org"
    URI.parse("http://rubygems.org#{request.path_info}").read
  end
end