Permalink
Browse files

Generate ERB docs for war. Other docs improvements.

  • Loading branch information...
AE9RB committed Feb 21, 2011
1 parent 4d07e91 commit 7999d410b9d9ce36779a47e190f2a1d212b646ff
Showing with 2,274 additions and 12 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 .yardopts
  3. +18 −9 Rakefile
  4. +2 −3 lib/closure.rb
  5. +1,349 −0 scripts/docs/HAML_REFERENCE.md
  6. +902 −0 scripts/docs/erb.rb
View
@@ -6,5 +6,6 @@ tmp/*
scripts/docs/closure/*
scripts/docs/haml/*
scripts/docs/rack/*
+scripts/docs/erb/*
closure-library/closure/bin/*.pyc
closure-library/closure/bin/build/*.pyc
View
@@ -1,3 +1,5 @@
+--default-return ""
+--hide-void-return
--no-private
-
LICENSE
View
@@ -8,7 +8,7 @@ require 'yard'
# All docs are distributed with the war
# Only closure is packaged with the gem
-DOCS_GEMS = %w{closure rack haml}
+DOCS = %w{closure erb rack haml}
# These versions are important for war packaging.
# Gem users are free to mix and match any sensible versions.
@@ -35,6 +35,7 @@ end
desc 'Start the Closure Script welcome server'
task 'welcome' do
mkdir_p 'tmp' if !File.exist?('tmp')
+ rm Dir.glob 'tmp/*'
chdir 'tmp'
require 'rack'
print "Closure Script Welcome Server is running\n"
@@ -140,7 +141,7 @@ task 'war' do
dir = war_config.autodeploy_dir
mkdir_p dir if !File.exist?(dir)
# ensure all docs were built
- DOCS_GEMS.each do |gem_name|
+ DOCS.each do |gem_name|
unless File.exists? "scripts/docs/#{gem_name}/index.html"
print "ERROR: Docs for #{gem_name} not built.\n"
exit 1
@@ -167,21 +168,29 @@ end
# DOCS
-DOCS_GEMS.each do |gem_name|
- if gem_name == 'closure'
- spec = nil
+DOCS.each do |gem_name|
+ if %w{closure}.include? gem_name
+ base_path = '.'
+ elsif %w{erb}.include? gem_name
+ # Where yard won't magically find the wrong README
+ base_path = 'scripts/docs'
else
spec = Gem.loaded_specs[gem_name]
unless spec
print "ERROR: Gem #{gem_name} not loaded."
exit 1
end
+ base_path = spec.full_gem_path
end
- #TODO we can hijack the --readme
if gem_name == 'rack'
extra = '- SPEC'
+ elsif gem_name == 'erb'
+ extra = '--default-return "" --hide-void-return --title ERB --no-yardopts erb.rb'
elsif gem_name == 'haml'
- extra = '- MIT-LICENSE'
+ # Haml ships gem with incomplete docs
+ # https://github.com/nex3/haml/issues/351
+ haml_ref_file = File.expand_path("scripts/docs/HAML_REFERENCE.md")
+ extra = "- MIT-LICENSE #{haml_ref_file}"
else
extra = ''
end
@@ -192,13 +201,13 @@ DOCS_GEMS.each do |gem_name|
out_dir = File.expand_path("scripts/docs/#{gem_name}")
rm_rf out_dir
save_dir = Dir.getwd
- Dir.chdir(spec.full_gem_path) if spec
+ Dir.chdir(base_path)
`yardoc --db #{db_dir} --output-dir #{out_dir} #{extra}`
Dir.chdir save_dir
rm_rf db_dir # cleanup
end
end
desc 'Generate all documentation'
-task 'docs' => DOCS_GEMS.collect {|s| "docs:#{s}"}
+task 'docs' => DOCS.collect {|s| "docs:#{s}"}
View
@@ -19,7 +19,6 @@
# middleware into a framework like Rails, or adapted to anything with a rack environment.
# @example config.ru
# #\ -p 8080 -E none
-# require 'rubygems'
# require 'closure'
# Closure.add_source :goog, '/goog'
# Closure.add_source './src/myapp', '/myapp'
@@ -70,8 +69,8 @@ def self.base_path
# @example
# Closure.add_source :goog, '/goog'
# Closure.add_source './myapp', '/myapp'
- # @overload script(path, directory)
- # @overload script(path, built_in)
+ # @overload add_source(directory, path=nil)
+ # @overload add_source(built_in, path=nil)
# @param (String) path http server mount point.
# @param (String) directory Where the scripts are in the filesystem.
# @param (Symbol) built_in
Oops, something went wrong.

0 comments on commit 7999d41

Please sign in to comment.