Created
October 25, 2011 16:59
-
-
Save betawaffle/1313488 to your computer and use it in GitHub Desktop.
Rack-based Local YARD Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'yard' | |
libs = {} | |
gems = {} | |
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] ||= [] | |
libs[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem) | |
end | |
end | |
run YARD::Server::RackAdapter.new(libs) |
For all gems available, use:
require 'rubygems'
require 'yard'
libs = {}
Gem.source_index.find_name('').each do |spec|
libs[spec.name] ||= []
libs[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :ge
end
run YARD::Server::RackAdapter.new(libs)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BOOM