public
Created — forked from betawaffle/config.ru

Rack-based Local YARD Server

  • Download Gist
config.ru
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
require 'rubygems'
require 'yard'
 
libs = Hash.new {|hash,key| hash[key] = [] }
base = ENV['GEM_PATH'].split(':')[1][%r{^.+(?=/.+@global$)}] rescue nil
 
if base
Gem.paths = {
'GEM_PATH' => Dir["#{base}/ruby-*"].join(':'),
'GEM_HOME' => ENV['GEM_HOME']
}
 
Gem.source_index.find_name('').each do |spec|
libs[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)
end
end
 
run YARD::Server::RackAdapter.new(libs)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.