Skip to content

Instantly share code, notes, and snippets.

@matthewtodd
Created July 10, 2009 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewtodd/144392 to your computer and use it in GitHub Desktop.
Save matthewtodd/144392 to your computer and use it in GitHub Desktop.
Rake task to build rdoc exactly as `gem install` would
# 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