Skip to content
Browse files

Updated Rakefile to check for presence of PDoc before running 'doc' t…

…ask.
  • Loading branch information...
1 parent 9bcf687 commit 44287477cc90ad122fec43f2ea6a4df89bda7e6d @savetheclocktower savetheclocktower committed Jan 12, 2009
Showing with 27 additions and 12 deletions.
  1. +27 −12 Rakefile
View
39 Rakefile
@@ -4,6 +4,7 @@ require 'rake/packagetask'
PROTOTYPE_ROOT = File.expand_path(File.dirname(__FILE__))
PROTOTYPE_SRC_DIR = File.join(PROTOTYPE_ROOT, 'src')
PROTOTYPE_DIST_DIR = File.join(PROTOTYPE_ROOT, 'dist')
+PROTOTYPE_DOC_DIR = File.join(PROTOTYPE_ROOT, 'doc')
PROTOTYPE_PKG_DIR = File.join(PROTOTYPE_ROOT, 'pkg')
PROTOTYPE_TEST_DIR = File.join(PROTOTYPE_ROOT, 'test')
PROTOTYPE_TEST_UNIT_DIR = File.join(PROTOTYPE_TEST_DIR, 'unit')
@@ -24,21 +25,35 @@ task :dist do
end
end
-desc "Builds the documentation."
-task :doc do
- require 'protodoc'
- require 'pdoc'
- require 'tempfile'
-
- Tempfile.open("prototype-doc") do |temp|
- source = File.join(PROTOTYPE_SRC_DIR, 'prototype.js')
- temp << Protodoc::Preprocessor.new(source, :strip_documentation => false)
- temp.flush
- rm_rf PROTOTYPE_DOC_DIR
- PDoc::Runner.new(temp.path, :output => PROTOTYPE_DOC_DIR).run
+namespace :doc do
+ desc "Builds the documentation."
+ task :build => [:require] do
+ require 'protodoc'
+ require 'tempfile'
+
+ Tempfile.open("prototype-doc") do |temp|
+ source = File.join(PROTOTYPE_SRC_DIR, 'prototype.js')
+ temp << Protodoc::Preprocessor.new(source, :strip_documentation => false)
+ temp.flush
+ rm_rf PROTOTYPE_DOC_DIR
+ PDoc::Runner.new(temp.path, :output => PROTOTYPE_DOC_DIR).run
+ end
+ end
+
+ task :require do
+ lib = 'vendor/pdoc/lib/pdoc'
+ unless File.exists?(lib)
+ puts "\nYou'll need PDoc to generate the documentation. Just run:\n\n"
+ puts " $ git submodule init"
+ puts " $ git submodule update"
+ puts "\nand you should be all set.\n\n"
+ end
+ require lib
end
end
+task :doc => ['doc:build']
+
desc "Builds the updating helper."
task :dist_helper do
require 'protodoc'

0 comments on commit 4428747

Please sign in to comment.
Something went wrong with that request. Please try again.