Permalink
Browse files

Merge branch 'Azolo-docs_config_refactor'

  • Loading branch information...
2 parents c59dc53 + 9827aed commit 5d291d2e95855d869fb50e7a9ea24893da7c1af1 @luislavena luislavena committed May 11, 2012
Showing with 91 additions and 66 deletions.
  1. +48 −0 config/docs.rb
  2. +4 −0 config/ruby_installer.rb
  3. +3 −0 rakefile.rb
  4. +26 −56 recipes/tools/docs.rake
  5. +6 −6 resources/chm/contents.hhc.rhtml
  6. +4 −4 resources/chm/project.hhp.rhtml
View
@@ -0,0 +1,48 @@
+require 'ostruct'
+
+module RubyInstaller
+ interpreters = [RubyInstaller::Ruby18, RubyInstaller::Ruby19]
+
+ interpreters.each do |package|
+ doc_dir = File.join(RubyInstaller::ROOT, package.doc_target)
+
+ core_glob = File.join(package.target, "*.c")
+ core_files = Dir.glob(core_glob).map { |file| File.basename(file) }
+
+ stdlib_files = [ './lib', './ext' ]
+
+ package.docs = [
+ core = OpenStruct.new(
+ :lib => "core",
+ :target => File.join(doc_dir, "#{package.short_version}-core"),
+ :title => "Ruby #{package.version} Core API Reference",
+ :files => core_files
+ ),
+ stdlib = OpenStruct.new(
+ :lib => "stdlib",
+ :target => File.join(doc_dir, "#{package.short_version}-stdlib"),
+ :title => "Ruby #{package.version} Standard Library API Reference",
+ :files => stdlib_files,
+ :exclude => "./lib/rdoc"
+ )
+ ]
+
+ package.docs.each do |doc|
+ # Build options
+ opts = []
+ opts.concat ['-x', doc.exclude] if doc.exclude
+ doc.opts = opts unless opts.empty?
+
+ # Build chm file names
+ doc.chm_file_basename = "#{package.short_version}-#{doc.lib}.chm"
+ doc.chm_file = File.join(RubyInstaller::ROOT, package.doc_target, doc.chm_file_basename)
+
+ end
+
+ # meta_chm for CHM format
+ package.meta_chm = OpenStruct.new(
+ :title => "Ruby #{package.version} Help file",
+ :file => File.join(package.doc_target, "#{package.short_version}.chm")
+ )
+ end
+end
View
@@ -17,10 +17,12 @@ module RubyInstaller
Ruby18 = OpenStruct.new(
:version => '1.8.7-p358',
+ :short_version => 'ruby18',
:url => "http://ftp.ruby-lang.org/pub/ruby/1.8",
:checkout => 'http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7',
:checkout_target => 'downloads/ruby_1_8',
:target => 'sandbox/ruby_1_8',
+ :doc_target => 'sandbox/doc/ruby18',
:build_target => 'sandbox/ruby18_build',
:install_target => 'sandbox/ruby18_mingw',
:patches => 'resources/patches/ruby187',
@@ -53,10 +55,12 @@ module RubyInstaller
Ruby19 = OpenStruct.new(
:version => "1.9.3-p194",
+ :short_version => 'ruby19',
:url => "http://ftp.ruby-lang.org/pub/ruby/1.9",
:checkout => 'http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_3',
:checkout_target => 'downloads/ruby_1_9',
:target => 'sandbox/ruby_1_9',
+ :doc_target => 'sandbox/doc/ruby19',
:build_target => 'sandbox/ruby19_build',
:install_target => 'sandbox/ruby19_mingw',
:patches => 'resources/patches/ruby193',
View
@@ -20,6 +20,9 @@
# DevKit configuration data
require 'config/devkit'
+# Docs configuration data
+require 'config/docs'
+
# Added download task from buildr
require 'rake/downloadtask'
require 'rake/extracttask'
View
@@ -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
@@ -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>
@@ -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 %>

0 comments on commit 5d291d2

Please sign in to comment.