forked from rubygems/guides
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
51 lines (41 loc) · 1.1 KB
/
Rakefile
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
gem "rdoc"
require 'rdoc/rdoc'
require 'rake/rdoctask'
require 'fileutils'
$:.unshift "."
Rake::RDocTask.new(:rdoc_spec) do |rd|
spec_file = File.join(ENV["RUBYGEMS_DIR"].to_s, "lib", "rubygems", "specification.rb")
rd.rdoc_files.include(spec_file)
rd.template = "jekdoc"
end
desc "move spec guide into the right place"
task :move_spec do
FileUtils.mv "html/Gem/Specification.html", "specification-reference.md"
end
desc "clean up after rdoc"
task :clean do
FileUtils.rm_rf "html"
end
desc "generate specification guide"
task :spec_guide => [:rdoc_spec, :move_spec, :clean]
desc "generate command guide"
task :command_guide do
require 'rubygems/command_manager'
require 'rdoc/erbio'
names = Gem::CommandManager.instance.command_names
commands = {}
names.each do |name|
commands[name] = Gem::CommandManager.instance[name]
end
def htmlify(string)
if string
string.gsub("<", "<").gsub(">", ">")
else
""
end
end
erbio = RDoc::ERBIO.new File.read("command-reference.erb"), nil, nil
open 'command-reference.md', 'w' do |io|
erbio.result binding
end
end