Skip to content

Commit f498593

Browse files
committed
Switch rdoc task to normal rake task, avoid rdoc/task require
1 parent e99a6b0 commit f498593

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

Rakefile

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,24 @@ task :default=>:spec
2525

2626
### RDoc
2727

28-
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'minitest-hooks: around and before_all/after_all/around_all hooks for Minitest']
29-
30-
begin
31-
gem 'hanna'
32-
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
33-
rescue Gem::LoadError
34-
end
35-
36-
rdoc_task_class = begin
37-
require "rdoc/task"
38-
RDoc::Task
39-
rescue LoadError
40-
require "rake/rdoctask"
41-
Rake::RDocTask
28+
desc "Generate rdoc"
29+
task :rdoc do
30+
rdoc_dir = "rdoc"
31+
rdoc_opts = ["--line-numbers", "--inline-source", '--title', 'minitest-hooks: around and before_all/after_all/around_all hooks for Minitest']
32+
33+
begin
34+
gem 'hanna'
35+
rdoc_opts.concat(['-f', 'hanna'])
36+
rescue Gem::LoadError
37+
end
38+
39+
rdoc_opts.concat(['--main', 'README.rdoc', "-o", rdoc_dir] +
40+
%w"README.rdoc CHANGELOG MIT-LICENSE" +
41+
Dir["lib/**/*.rb"]
42+
)
43+
44+
FileUtils.rm_rf(rdoc_dir)
45+
46+
require "rdoc"
47+
RDoc::RDoc.new.document(rdoc_opts)
4248
end
43-
44-
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
45-
46-
rdoc_task_class.new do |rdoc|
47-
rdoc.rdoc_dir = "rdoc"
48-
rdoc.options += RDOC_OPTS
49-
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
50-
end
51-

0 commit comments

Comments
 (0)