rwx patch for rdocs
Diff
code posted
by
Quintus
created at 16 Dec 11:45
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
From 08d1046812fda3e5073c56a15b695f55abaa3a07 Mon Sep 17 00:00:00 2001 From: Quintus <quintus@quintilianus.eu> Date: Mon, 16 Dec 2013 11:40:05 +0100 Subject: [PATCH] Add a Rake task for documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RDoc doesn’t like DLL_LOCAL currently, so remove it while generating the documentation. --- Rakefile | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 931b9c2..984a3ed 100644 --- a/Rakefile +++ b/Rakefile @@ -3,11 +3,19 @@ gem "rdoc" require "rake" require "rake/clean" require "rubygems/package_task" +require "rdoc/task" -require 'rake/extensiontask' rescue nil +begin + require 'rake/extensiontask' +rescue LoadError +end ENV["RDOCOPT"] = "" if ENV["RDOCOPT"] -CLOBBER.include("doc") +TMPSRCDIR = "tmpsrc" + +CLEAN.include(TMPSRCDIR) +CLOBBER.include("rdoc") + load "rwx.gemspec" @@ -39,4 +47,39 @@ else t.cross_compile = true # enable cross compilation (requires cross compile toolchain) t.cross_platform = 'i386-mswin32' # forces the Windows platform instead of the default one end -end \ No newline at end of file +end + +RDoc::Task.new do |rdoc| + rdoc.title = "rwx RDocs" + rdoc.main = "README.rdoc" + rdoc.rdoc_files.include("*.rdoc", TMPSRCDIR) + rdoc.rdoc_dir = "rdoc" + + # We will have another 'rdoc' task that depends on this task + rdoc.name = :docs +end + +# This task removes the DLL_LOCAL statements temporarily to +# make RDoc work properly. The stripped sources are to be +# found in TMPSRCDIR afterwards. +task :prepare_sources do + rm_r "tmpsrc" if File.directory?(TMPSRCDIR) + + cp_r "ext", TMPSRCDIR + + Dir["#{TMPSRCDIR}/*.cpp", "#{TMPSRCDIR}/*.hpp"].each do |path| + puts "Removing DLL_LOCAL in #{path}" + + str = File.read(path) + str.gsub!(/DLL_LOCAL\s?/, "") + File.open(path, "w"){|file| file.write(str)} + end +end + +# Removes the temporary directory created by :prepare_sources. +task :clean_sources do + rm_r TMPSRCDIR +end + +desc "Generate the RDoc documentation." +task :rdoc => [:prepare_sources, :docs, :clean_sources] -- 1.8.5.1 |
2.26 KB in 6 ms with coderay