summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile4
-rwxr-xr-xdocgen4
-rw-r--r--tasks/doc.rake31
3 files changed, 33 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 7bf643e3..1bd782ea 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,5 @@
require 'rake'
-require 'rake/gempackagetask'
+require 'rubygems/package_task'
task :default => [:buildext]
@@ -15,7 +15,7 @@ SPECFILE = 'rbot.gemspec'
# we must (and can) skip defining the gem packaging tasks.
if File.exist? SPECFILE
spec = eval(File.read(SPECFILE), nil, SPECFILE)
- Rake::GemPackageTask.new(spec) do |pkg|
+ Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
diff --git a/docgen b/docgen
deleted file mode 100755
index 5bb8ae23..00000000
--- a/docgen
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-rm -rf doc
-rdoc -a -i 'lib' --exclude 'post-install.rb' --main README.rdoc --title "rbot - The Ruby IRC bot" -o doc lib bin/rbot README.rdoc
-
diff --git a/tasks/doc.rake b/tasks/doc.rake
new file mode 100644
index 00000000..b39f8c65
--- /dev/null
+++ b/tasks/doc.rake
@@ -0,0 +1,31 @@
+desc "Generate RDoc"
+task :doc => ['doc:generate']
+
+namespace :doc do
+ project_root = File.expand_path(File.join(File.dirname(__FILE__), '.'))
+ doc_destination = File.join(project_root, 'doc')
+
+ begin
+ require 'yard'
+ require 'yard/rake/yardoc_task'
+
+ YARD::Rake::YardocTask.new(:generate) do |yt|
+ yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb'))
+# +
+# [ File.join(project_root, 'README.md') ]
+ yt.options = ['--output-dir', doc_destination, '--readme', 'README.md']
+ end
+ rescue LoadError
+ desc "Generate YARD Documentation"
+ task :generate do
+ abort "Please install the YARD gem to generate rdoc."
+ end
+ end
+
+ desc "Remove generated documenation"
+ task :clean do
+ rm_r doc_dir if File.exists?(doc_destination)
+ end
+
+end
+