Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Edit doc recipe to use new refactored docs config

  • Loading branch information...
commit d3f0f12d60af131e2cfe5b69aa7e560a3db25602 1 parent dd00bd9
@Azolo Azolo authored
View
82 recipes/tools/docs.rake
@@ -4,9 +4,9 @@ require 'rubygems'
interpreters = [RubyInstaller::Ruby18, RubyInstaller::Ruby19]
begin
- gem 'rdoc', '~> 2.5.11'
+ gem 'rdoc', '~> 3.12'
require 'rdoc/rdoc'
- gem 'rdoc_chm', '~> 2.4.2'
+ gem 'rdoc_chm', '~> 2.4.3'
rescue Gem::LoadError
if Rake.application.options.show_tasks
puts "You need rdoc 2.5.11 and rdoc_chm 2.4.2 gems installed"
@@ -35,71 +35,41 @@ EOT
end
interpreters.each do |package|
- short_ver = package.version.gsub('.', '')[0..1]
- version = "ruby#{short_ver}"
- doc_dir = File.join(RubyInstaller::ROOT, 'sandbox', 'doc')
- target = File.join(doc_dir, version)
-
- core_glob = File.join(package.target, "*.c")
- core_files = Dir.glob(core_glob).map{ |f| File.basename(f) }
-
- stdlib_files = ['./lib', './ext']
-
- default_opts = ['--format=chm']
-
- # build file dependencies
- rdocs = [
- {
- :file => "#{version}-core.chm",
- :title => "Ruby #{package.version} Core",
- :files => core_files,
- },
- {
- :file => "#{version}-stdlib.chm",
- :title => "Ruby #{package.version} Standard Library",
- :files => stdlib_files,
- :opts => ["-x", "./lib/rdoc"]
- }
- ]
-
- meta_chm = OpenStruct.new(
- :title => "Ruby #{package.version} Help file",
- :file => File.join(target, "#{version}.chm")
- )
-
- rdocs.each do |chm|
- chm_file = File.join(target, chm[:file])
-
- file chm_file do
+ default_opts = ['--format=chm', '--encoding=UTF-8']
+ meta_chm = package.meta_chm
+ expanded_doc_target = File.join(RubyInstaller::ROOT, package.doc_target)
+
+ package.docs.each do |doc|
+ file doc.chm_file do
cd package.target do
- dirname = File.basename(chm_file, '.chm')
- op_dir = File.join(target, dirname)
- title = "#{chm[:title]} API Reference"
+ dirname = File.basename(doc.chm_file, '.chm')
+ op_dir = doc.target
+ title = "#{doc.title} API Reference"
# create documentation
args = default_opts +
- (chm[:opts] || []) +
+ (doc.opts || []) +
['--title', title, '--op', op_dir] +
- chm[:files]
+ doc.files
rdoc = RDoc::RDoc.new
rdoc.document(args)
- cp File.join(op_dir, File.basename(chm[:file])), chm_file
+ cp File.join(op_dir, File.basename(doc.chm_file)), doc.chm_file
end
end
# meta package depends on individual chm files
- file meta_chm.file => [chm_file]
+ file meta_chm.file => [doc.chm_file]
end
# generate index
- index = File.join(target, 'index.html')
+ index = File.join(expanded_doc_target, 'index.html')
file index do
- cd target do
+ cd package.doc_target do
cp File.join(RubyInstaller::ROOT, 'resources', 'chm', 'README.txt'), '.'
- op_dir = File.join(target, 'README')
+ op_dir = File.join(expanded_doc_target, 'README')
# create documentation
opts = ['--op', op_dir, '--title', 'RubyInstaller', 'README.txt']
@@ -109,10 +79,10 @@ interpreters.each do |package|
images = File.join(op_dir, 'images')
js = File.join(op_dir, 'js')
- cp_r(images, target) if File.exist?(images)
- cp_r(js, target) if File.exist?(js)
+ cp_r(images, expanded_doc_target) if File.exist?(images)
+ cp_r(js, expanded_doc_target) if File.exist?(js)
- cp File.join(op_dir, 'rdoc.css'), target
+ cp File.join(op_dir, 'rdoc.css'), expanded_doc_target
cp File.join(op_dir, 'README_txt.html'), index
end
end
@@ -122,7 +92,7 @@ interpreters.each do |package|
# generate meta package
file meta_chm.file do
- cd target do
+ cd package.doc_target do
meta_chm.files = Dir.glob('*.html')
meta_chm.merge_files = Dir.glob('*.chm')
@@ -141,15 +111,15 @@ interpreters.each do |package|
end
end
- namespace version do
+ namespace package.short_version do
task :clobber_docs do
- rm_rf target
+ rm_rf package.doc_target
end
- desc "build docs for #{version}"
+ desc "build docs for #{package.short_version}"
task :docs => ['docs:htmlhelp', meta_chm.file]
- desc "rebuild docs for #{version}"
+ desc "rebuild docs for #{package.short_version}"
task :redocs => [:clobber_docs, :docs]
end
end
View
12 resources/chm/contents.hhc.rhtml
@@ -7,17 +7,17 @@
<BODY>
<OBJECT type="text/site properties">
<param name="ImageType" value="Folder">
- </OBJECT><% rdocs.each do |rdoc| %>
+ </OBJECT><% package.docs.each do |doc| %>
<UL>
<LI><OBJECT type="text/sitemap">
- <param name="Name" value="<%= rdoc[:title] %>"><% if rdoc[:file] =~ /\.chm$/ %>
- <param name="Local" value="<%= rdoc[:file] %>::/index.html">
+ <param name="Name" value="<%= doc.title %>"><% if doc.chm_file_basename =~ /\.chm$/ %>
+ <param name="Local" value="<%= doc.chm_file_basename %>::/index.html">
</OBJECT>
<OBJECT type="text/sitemap">
- <param name="Name" value="<%= rdoc[:file] %>::/contents.hhc">
- <param name="Merge" value="<%= rdoc[:file] %>::/contents.hhc">
+ <param name="Name" value="<%= doc.chm_file_basename %>::/contents.hhc">
+ <param name="Merge" value="<%= doc.chm_file_basename %>::/contents.hhc">
</OBJECT><% else %>
- <param name="Local" value="<%= rdoc[:file] %>">
+ <param name="Local" value="<%= doc.chm_file_basename %>">
</OBJECT><% end %>
</UL><% end %>
</BODY>
View
8 resources/chm/project.hhp.rhtml
@@ -1,20 +1,20 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
-Compiled file=<%= File.basename(meta_chm.file) %>
+Compiled file=<%= File.basename(package.meta_chm.file) %>
Contents file=contents.hhc
Display compile progress=No
Default topic=index.html
Language=0x409 English (United States)
-Title=<%= meta_chm.title %>
+Title=<%= package.meta_chm.title %>
Full-text search=Yes
Index file=index.hhk
-[FILES] <% meta_chm.files.each do |file| %>
+[FILES] <% package.meta_chm.files.each do |file| %>
<%= file %>
<% end %>
-[MERGE FILES] <% meta_chm.merge_files.each do |merge_file| %>
+[MERGE FILES] <% package.meta_chm.merge_files.each do |merge_file| %>
<%= merge_file %>
<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.