summaryrefslogtreecommitdiff
path: root/tasks/doc.rake
diff options
context:
space:
mode:
authorMatthias H <apoc@sixserv.org>2015-03-09 05:00:59 +0100
committerMatthias H <apoc@sixserv.org>2015-03-09 05:00:59 +0100
commit2f70ebb1c50fb8876745dd5ceefe272607cc9698 (patch)
treecc1a52922527e23e68205e5eb10d16aa94baf251 /tasks/doc.rake
parent655d1e6e32466ea9b017b1ce7f603f7b2a57c72c (diff)
rake: yarn doc task
Diffstat (limited to 'tasks/doc.rake')
-rw-r--r--tasks/doc.rake31
1 files changed, 31 insertions, 0 deletions
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
+