Created
July 10, 2009 10:19
-
-
Save matthewtodd/144392 to your computer and use it in GitHub Desktop.
Rake task to build rdoc exactly as `gem install` would
This file contains hidden or 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
# I've folded this idea into http://github.com/matthewtodd/shoe | |
# See what you think! | |
require 'rubygems' | |
require 'rubygems/doc_manager' | |
spec = Gem::Specification.new do |spec| | |
# ... | |
end | |
desc 'Generate documentation' | |
task :rdoc do | |
def spec.full_gem_path | |
File.dirname(__FILE__) | |
end | |
klass = Class.new(Gem::DocManager) do | |
def initialize(spec) | |
@spec = spec | |
@doc_dir = File.dirname(__FILE__) | |
@rdoc_args = [] | |
end | |
end | |
klass.new(spec).generate_rdoc | |
end | |
desc 'Generate a gemspec file' | |
task :gemspec do | |
File.open("#{spec.name}.gemspec", 'w') do |f| | |
f.write spec.to_ruby | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment