2011-11-16 12:11:10 +00:00
|
|
|
require 'rubygems'
|
|
|
|
begin
|
|
|
|
# We prefer to use the RDoc gem over the site version.
|
|
|
|
gem 'rdoc'
|
|
|
|
rescue Gem::LoadError
|
|
|
|
end unless defined?(RDoc)
|
|
|
|
|
|
|
|
require 'rdoc/task'
|
2010-07-28 19:30:56 +00:00
|
|
|
|
|
|
|
namespace :doc do
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Generate RDoc documentation'
|
2011-11-16 12:11:10 +00:00
|
|
|
RDoc::Task.new do |rdoc|
|
2010-08-17 01:21:17 +00:00
|
|
|
rdoc.rdoc_dir = 'doc'
|
2010-07-28 19:30:56 +00:00
|
|
|
rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
|
2011-11-16 12:11:10 +00:00
|
|
|
rdoc.options << '--line-numbers' << 'cattr_accessor=object' <<
|
|
|
|
'--charset' << 'utf-8'
|
2010-08-17 01:21:17 +00:00
|
|
|
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
2011-10-11 11:54:57 +00:00
|
|
|
rdoc.rdoc_files.include('README.md', 'CHANGELOG', 'LICENSE')
|
2010-08-17 01:21:17 +00:00
|
|
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
2010-07-28 19:30:56 +00:00
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Generate ri locally for testing'
|
2010-07-28 19:30:56 +00:00
|
|
|
task :ri do
|
2010-08-17 01:21:17 +00:00
|
|
|
sh 'rdoc --ri -o ri .'
|
2010-07-28 19:30:56 +00:00
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
desc 'Remove ri products'
|
2010-07-28 19:30:56 +00:00
|
|
|
task :clobber_ri do
|
2010-08-17 01:21:17 +00:00
|
|
|
rm_r 'ri' rescue nil
|
2010-07-28 19:30:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-08-17 01:21:17 +00:00
|
|
|
task 'clobber' => ['doc:clobber_rdoc', 'doc:clobber_ri']
|