From 76fb2b7b7c6d5145eebf7c4a4f4587b32ec76424 Mon Sep 17 00:00:00 2001 From: Eric Hodel Date: Sat, 1 Jan 2011 13:10:39 -0800 Subject: [PATCH] Touch the flag file at directory creation time to prevent error after rdoc crashes --- History.txt | 2 ++ lib/rdoc/rdoc.rb | 1 + test/test_rdoc_rdoc.rb | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index e83a553f1e..1f2591dc3e 100644 --- a/History.txt +++ b/History.txt @@ -10,6 +10,8 @@ obj...) to display correctly. Patch #6 by KUBO Takehiro. * Improved processing of meta-programmed methods when followed by unparseable syntax. RubyForge patch #28653 by Aidan Cully. + * rdoc now touches the flag file when it create the output directory. + Prevents the "isn't an RDoc directory" error if rdoc crashes. === 3.2 / 2010-12-29 diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 05cd6814d1..12f1935f8e 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -197,6 +197,7 @@ def setup_output_dir(dir, force) end unless @options.force_output else FileUtils.mkdir_p dir + FileUtils.touch output_flag_file dir end last diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index e30aa2e15b..d2662197b5 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -64,13 +64,14 @@ def test_setup_output_dir skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir Dir.mktmpdir {|d| - path = File.join(d, 'testdir') + path = File.join d, 'testdir' last = @rdoc.setup_output_dir path, false assert_empty last assert File.directory? path + assert File.exist? @rdoc.output_flag_file path } end