Commits

Anonymous committed 9b10b45

Comments (0)

Files changed (2)

README.rdoc

-= log_weaver - DESCRIBE YOUR GEM
-
-Author::  YOUR NAME (YOUR EMAIL)
-Copyright:: Copyright (c) 2012 YOUR NAME
-
-
-DESCRIBE YOUR GEM HERE
-
-== Links
-
-* {Source on Github}[LINK TO GITHUB]
-* RDoc[LINK TO RDOC.INFO]
-
-== Install
-
-== Examples
-
-== Contributing
-
 
 require 'cucumber'
 require 'cucumber/rake/task'
-gem 'rdoc' # we need the installed RDoc gem, not the system one
-require 'rdoc/task'
 
 include Rake::DSL
 
   t.fork = false
 end
 
-Rake::RDocTask.new do |rd|
-  
-  rd.main = "README.rdoc"
-  
-  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
+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', 'rdoc')
+
+  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_destination if File.exists?(doc_destination)
+  end
+
 end
 
 task :default => [:spec,:features]