rdoc-f95 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +79 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +147 -0
- data/Rakefile +28 -0
- data/bin/rdoc-f95 +70 -0
- data/lib/rdoc-f95.rb +306 -0
- data/lib/rdoc-f95/code_objects.rb +776 -0
- data/lib/rdoc-f95/diagram.rb +342 -0
- data/lib/rdoc-f95/dot.rb +249 -0
- data/lib/rdoc-f95/generator.rb +1088 -0
- data/lib/rdoc-f95/generator/chm.rb +113 -0
- data/lib/rdoc-f95/generator/chm/chm.rb +98 -0
- data/lib/rdoc-f95/generator/html.rb +370 -0
- data/lib/rdoc-f95/generator/html/hefss.rb +414 -0
- data/lib/rdoc-f95/generator/html/html.rb +708 -0
- data/lib/rdoc-f95/generator/html/kilmer.rb +418 -0
- data/lib/rdoc-f95/generator/html/one_page_html.rb +121 -0
- data/lib/rdoc-f95/generator/ri.rb +229 -0
- data/lib/rdoc-f95/generator/xhtml.rb +106 -0
- data/lib/rdoc-f95/generator/xhtml/ctop.xsl +1318 -0
- data/lib/rdoc-f95/generator/xhtml/mathml.xsl +42 -0
- data/lib/rdoc-f95/generator/xhtml/pmathml.xsl +612 -0
- data/lib/rdoc-f95/generator/xhtml/pmathmlcss.xsl +872 -0
- data/lib/rdoc-f95/generator/xhtml/xhtml.rb +732 -0
- data/lib/rdoc-f95/generator/xml.rb +120 -0
- data/lib/rdoc-f95/generator/xml/rdf.rb +113 -0
- data/lib/rdoc-f95/generator/xml/xml.rb +111 -0
- data/lib/rdoc-f95/install.rb +166 -0
- data/lib/rdoc-f95/markup.rb +506 -0
- data/lib/rdoc-f95/markup/formatter.rb +14 -0
- data/lib/rdoc-f95/markup/fragments.rb +337 -0
- data/lib/rdoc-f95/markup/inline.rb +361 -0
- data/lib/rdoc-f95/markup/install.rb +57 -0
- data/lib/rdoc-f95/markup/lines.rb +152 -0
- data/lib/rdoc-f95/markup/mathml_wrapper.rb +91 -0
- data/lib/rdoc-f95/markup/preprocess.rb +71 -0
- data/lib/rdoc-f95/markup/sample/rdoc2latex.rb +16 -0
- data/lib/rdoc-f95/markup/sample/sample.rb +42 -0
- data/lib/rdoc-f95/markup/to_flow.rb +185 -0
- data/lib/rdoc-f95/markup/to_html.rb +357 -0
- data/lib/rdoc-f95/markup/to_html_crossref.rb +123 -0
- data/lib/rdoc-f95/markup/to_latex.rb +328 -0
- data/lib/rdoc-f95/markup/to_test.rb +50 -0
- data/lib/rdoc-f95/markup/to_xhtml_texparser.rb +234 -0
- data/lib/rdoc-f95/options.rb +745 -0
- data/lib/rdoc-f95/parsers/parse_c.rb +775 -0
- data/lib/rdoc-f95/parsers/parse_f95.rb +2499 -0
- data/lib/rdoc-f95/parsers/parse_rb.rb +2587 -0
- data/lib/rdoc-f95/parsers/parse_simple.rb +39 -0
- data/lib/rdoc-f95/parsers/parserfactory.rb +99 -0
- data/lib/rdoc-f95/ri.rb +2 -0
- data/lib/rdoc-f95/ri/cache.rb +188 -0
- data/lib/rdoc-f95/ri/descriptions.rb +147 -0
- data/lib/rdoc-f95/ri/display.rb +244 -0
- data/lib/rdoc-f95/ri/driver.rb +435 -0
- data/lib/rdoc-f95/ri/formatter.rb +603 -0
- data/lib/rdoc-f95/ri/paths.rb +105 -0
- data/lib/rdoc-f95/ri/reader.rb +106 -0
- data/lib/rdoc-f95/ri/util.rb +81 -0
- data/lib/rdoc-f95/ri/writer.rb +64 -0
- data/lib/rdoc-f95/stats.rb +23 -0
- data/lib/rdoc-f95/template.rb +64 -0
- data/lib/rdoc-f95/tokenstream.rb +33 -0
- data/lib/rdoc-f95/usage.rb +210 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_helper.rb +3 -0
- data/test/test_rdoc-f95.rb +11 -0
- metadata +156 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'rdoc-f95/generator/html'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Generate XML output as one big file
|
5
|
+
|
6
|
+
class RDocF95::Generator::XML < RDocF95::Generator::HTML
|
7
|
+
|
8
|
+
##
|
9
|
+
# Standard generator factory
|
10
|
+
|
11
|
+
def self.for(options)
|
12
|
+
new(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(*args)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Build the initial indices and output objects
|
21
|
+
# based on an array of TopLevel objects containing
|
22
|
+
# the extracted information.
|
23
|
+
|
24
|
+
def generate(info)
|
25
|
+
@info = info
|
26
|
+
@files = []
|
27
|
+
@classes = []
|
28
|
+
@hyperlinks = {}
|
29
|
+
|
30
|
+
build_indices
|
31
|
+
generate_xml
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Generate:
|
36
|
+
#
|
37
|
+
# * a list of HtmlFile objects for each TopLevel object.
|
38
|
+
# * a list of HtmlClass objects for each first level
|
39
|
+
# class or module in the TopLevel objects
|
40
|
+
# * a complete list of all hyperlinkable terms (file,
|
41
|
+
# class, module, and method names)
|
42
|
+
|
43
|
+
def build_indices
|
44
|
+
@info.each do |toplevel|
|
45
|
+
@files << RDocF95::Generator::HtmlFile.new(toplevel, @options, RDocF95::Generator::FILE_DIR)
|
46
|
+
end
|
47
|
+
|
48
|
+
RDocF95::TopLevel.all_classes_and_modules.each do |cls|
|
49
|
+
build_class_list(cls, @files[0], RDocF95::Generator::CLASS_DIR)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def build_class_list(from, html_file, class_dir)
|
54
|
+
@classes << RDocF95::Generator::HtmlClass.new(from, html_file, class_dir, @options)
|
55
|
+
from.each_classmodule do |mod|
|
56
|
+
build_class_list(mod, html_file, class_dir)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Generate all the HTML. For the one-file case, we generate
|
62
|
+
# all the information in to one big hash
|
63
|
+
|
64
|
+
def generate_xml
|
65
|
+
values = {
|
66
|
+
'charset' => @options.charset,
|
67
|
+
'files' => gen_into(@files),
|
68
|
+
'classes' => gen_into(@classes)
|
69
|
+
}
|
70
|
+
|
71
|
+
# this method is defined in the template file
|
72
|
+
write_extra_pages if defined? write_extra_pages
|
73
|
+
|
74
|
+
template = RDocF95::TemplatePage.new @template::ONE_PAGE
|
75
|
+
|
76
|
+
if @options.op_name
|
77
|
+
opfile = File.open(@options.op_name, "w")
|
78
|
+
else
|
79
|
+
opfile = $stdout
|
80
|
+
end
|
81
|
+
template.write_html_on(opfile, values)
|
82
|
+
end
|
83
|
+
|
84
|
+
def gen_into(list)
|
85
|
+
res = []
|
86
|
+
list.each do |item|
|
87
|
+
res << item.value_hash
|
88
|
+
end
|
89
|
+
res
|
90
|
+
end
|
91
|
+
|
92
|
+
def gen_file_index
|
93
|
+
gen_an_index(@files, 'Files')
|
94
|
+
end
|
95
|
+
|
96
|
+
def gen_class_index
|
97
|
+
gen_an_index(@classes, 'Classes')
|
98
|
+
end
|
99
|
+
|
100
|
+
def gen_method_index
|
101
|
+
gen_an_index(RDocF95::Generator::HtmlMethod.all_methods, 'Methods')
|
102
|
+
end
|
103
|
+
|
104
|
+
def gen_an_index(collection, title)
|
105
|
+
res = []
|
106
|
+
collection.sort.each do |f|
|
107
|
+
if f.document_self
|
108
|
+
res << { "href" => f.path, "name" => f.index_name }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
return {
|
113
|
+
"entries" => res,
|
114
|
+
'list_title' => title,
|
115
|
+
'index_url' => main_url,
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'rdoc-f95/generator/xml'
|
2
|
+
|
3
|
+
module RDocF95::Generator::XML::RDF
|
4
|
+
|
5
|
+
CONTENTS_RDF = <<-EOF
|
6
|
+
<% if defined? classes and classes["description"] then %>
|
7
|
+
<description rd:parseType="Literal">
|
8
|
+
<%= classes["description"] %>
|
9
|
+
</description>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% if defined? files and files["requires"] then %>
|
13
|
+
<% files["requires"].each do |requires| %>
|
14
|
+
<rd:required-file rd:name="<%= requires["name"] %>" />
|
15
|
+
<% end # files["requires"] %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if defined? classes and classes["includes"] then %>
|
19
|
+
<IncludedModuleList>
|
20
|
+
<% classes["includes"].each do |includes| %>
|
21
|
+
<included-module rd:name="<%= includes["name"] %>" />
|
22
|
+
<% end # includes["includes"] %>
|
23
|
+
</IncludedModuleList>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% if defined? classes and classes["sections"] then %>
|
27
|
+
<% classes["sections"].each do |sections| %>
|
28
|
+
<% if sections["attributes"] then %>
|
29
|
+
<% sections["attributes"].each do |attributes| %>
|
30
|
+
<contents>
|
31
|
+
<Attribute rd:name="<%= attributes["name"] %>">
|
32
|
+
<% if attributes["rw"] then %>
|
33
|
+
<attribute-rw><%= attributes["rw"] %></attribute-rw>
|
34
|
+
<% end %>
|
35
|
+
<description rdf:parseType="Literal"><%= attributes["a_desc"] %></description>
|
36
|
+
</Attribute>
|
37
|
+
</contents>
|
38
|
+
<% end # sections["attributes"] %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<% if sections["method_list"] then %>
|
42
|
+
<% sections["method_list"].each do |method_list| %>
|
43
|
+
<% if method_list["methods"] then %>
|
44
|
+
<% method_list["methods"].each do |methods| %>
|
45
|
+
<contents>
|
46
|
+
<Method rd:name="<%= methods["name"] %>" rd:visibility="<%= methods["type"] %>"
|
47
|
+
rd:category="<%= methods["category"] %>" rd:id="<%= methods["aref"] %>">
|
48
|
+
<parameters><%= methods["params"] %></parameters>
|
49
|
+
<% if methods["m_desc"] then %>
|
50
|
+
<description rdf:parseType="Literal">
|
51
|
+
<%= methods["m_desc"] %>
|
52
|
+
</description>
|
53
|
+
<% end %>
|
54
|
+
<% if methods["sourcecode"] then %>
|
55
|
+
<source-code-listing rdf:parseType="Literal">
|
56
|
+
<%= methods["sourcecode"] %>
|
57
|
+
</source-code-listing>
|
58
|
+
<% end %>
|
59
|
+
</Method>
|
60
|
+
</contents>
|
61
|
+
<% end # method_list["methods"] %>
|
62
|
+
<% end %>
|
63
|
+
<% end # sections["method_list"] %>
|
64
|
+
<% end %>
|
65
|
+
<!-- end method list -->
|
66
|
+
<% end # classes["sections"] %>
|
67
|
+
<% end %>
|
68
|
+
EOF
|
69
|
+
|
70
|
+
########################################################################
|
71
|
+
|
72
|
+
ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
|
73
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
74
|
+
xmlns="http://pragprog.com/rdoc/rdoc.rdf#"
|
75
|
+
xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">
|
76
|
+
|
77
|
+
<!-- RDoc -->
|
78
|
+
<% values["files"].each do |files| %>
|
79
|
+
<rd:File rd:name="<%= files["short_name"] %>" rd:id="<%= files["href"] %>">
|
80
|
+
<path><%= files["full_path"] %></path>
|
81
|
+
<dtm-modified><%= files["dtm_modified"] %></dtm-modified>
|
82
|
+
} + CONTENTS_RDF + %{
|
83
|
+
</rd:File>
|
84
|
+
<% end # values["files"] %>
|
85
|
+
<% values["classes"].each do |classes| %>
|
86
|
+
<<%= values["classmod"] %> rd:name="<%= classes["full_name"] %>" rd:id="<%= classes["full_name"] %>">
|
87
|
+
<classmod-info>
|
88
|
+
<% if classes["infiles"] then %>
|
89
|
+
<InFiles>
|
90
|
+
<% classes["infiles"].each do |infiles| %>
|
91
|
+
<infile>
|
92
|
+
<File rd:name="<%= infiles["full_path"] %>"
|
93
|
+
<% if infiles["full_path_url"] then %>
|
94
|
+
rdf:about="<%= infiles["full_path_url"] %>"
|
95
|
+
<% end %>
|
96
|
+
/>
|
97
|
+
</infile>
|
98
|
+
<% end # classes["infiles"] %>
|
99
|
+
</InFiles>
|
100
|
+
<% end %>
|
101
|
+
<% if classes["parent"] then %>
|
102
|
+
<superclass><%= href classes["par_url"], classes["parent"] %></superclass>
|
103
|
+
<% end %>
|
104
|
+
</classmod-info>
|
105
|
+
} + CONTENTS_RDF + %{
|
106
|
+
</<%= classes["classmod"] %>>
|
107
|
+
<% end # values["classes"] %>
|
108
|
+
<!-- /RDoc -->
|
109
|
+
</rdf:RDF>
|
110
|
+
}
|
111
|
+
|
112
|
+
end
|
113
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'rdoc-f95/generator/xml'
|
2
|
+
|
3
|
+
module RDocF95::Generator::XML::XML
|
4
|
+
|
5
|
+
CONTENTS_XML = <<-EOF
|
6
|
+
<% if defined? classes and classes["description"] then %>
|
7
|
+
<description>
|
8
|
+
<%= classes["description"] %>
|
9
|
+
</description>
|
10
|
+
<% end %>
|
11
|
+
<contents>
|
12
|
+
<% if defined? files and files["requires"] then %>
|
13
|
+
<required-file-list>
|
14
|
+
<% files["requires"].each do |requires| %>
|
15
|
+
<required-file name="<%= requires["name"] %>"
|
16
|
+
<% if requires["aref"] then %>
|
17
|
+
href="<%= requires["aref"] %>"
|
18
|
+
<% end %>
|
19
|
+
/>
|
20
|
+
<% end # files["requires"] %>
|
21
|
+
</required-file-list>
|
22
|
+
<% end %>
|
23
|
+
<% if defined? classes and classes["sections"] then %>
|
24
|
+
<% classes["sections"].each do |sections| %>
|
25
|
+
<% if sections["attributes"] then %>
|
26
|
+
<attribute-list>
|
27
|
+
<% sections["attributes"].each do |attributes| %>
|
28
|
+
<attribute name="<%= attributes["name"] %>">
|
29
|
+
<% if attributes["rw"] then %>
|
30
|
+
<attribute-rw><%= attributes["rw"] %></attribute-rw>
|
31
|
+
<% end %>
|
32
|
+
<description><%= attributes["a_desc"] %></description>
|
33
|
+
</attribute>
|
34
|
+
<% end # sections["attributes"] %>
|
35
|
+
</attribute-list>
|
36
|
+
<% end %>
|
37
|
+
<% if sections["method_list"] then %>
|
38
|
+
<method-list>
|
39
|
+
<% sections["method_list"].each do |method_list| %>
|
40
|
+
<% if method_list["methods"] then %>
|
41
|
+
<% method_list["methods"].each do |methods| %>
|
42
|
+
<method name="<%= methods["name"] %>" type="<%= methods["type"] %>" category="<%= methods["category"] %>" id="<%= methods["aref"] %>">
|
43
|
+
<parameters><%= methods["params"] %></parameters>
|
44
|
+
<% if methods["m_desc"] then %>
|
45
|
+
<description>
|
46
|
+
<%= methods["m_desc"] %>
|
47
|
+
</description>
|
48
|
+
<% end %>
|
49
|
+
<% if methods["sourcecode"] then %>
|
50
|
+
<source-code-listing>
|
51
|
+
<%= methods["sourcecode"] %>
|
52
|
+
</source-code-listing>
|
53
|
+
<% end %>
|
54
|
+
</method>
|
55
|
+
<% end # method_list["methods"] %>
|
56
|
+
<% end %>
|
57
|
+
<% end # sections["method_list"] %>
|
58
|
+
</method-list>
|
59
|
+
<% end %>
|
60
|
+
<% end # classes["sections"] %>
|
61
|
+
<% end %>
|
62
|
+
<% if defined? classes and classes["includes"] then %>
|
63
|
+
<included-module-list>
|
64
|
+
<% classes["includes"].each do |includes| %>
|
65
|
+
<included-module name="<%= includes["name"] %>"
|
66
|
+
<% if includes["aref"] then %>
|
67
|
+
href="<%= includes["aref"] %>"
|
68
|
+
<% end %>
|
69
|
+
/>
|
70
|
+
<% end # classes["includes"] %>
|
71
|
+
</included-module-list>
|
72
|
+
<% end %>
|
73
|
+
</contents>
|
74
|
+
EOF
|
75
|
+
|
76
|
+
ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
|
77
|
+
<rdoc>
|
78
|
+
<file-list>
|
79
|
+
<% values["files"].each do |files| %>
|
80
|
+
<file name="<%= files["short_name"] %>" id="<%= files["href"] %>">
|
81
|
+
<file-info>
|
82
|
+
<path><%= files["full_path"] %></path>
|
83
|
+
<dtm-modified><%= files["dtm_modified"] %></dtm-modified>
|
84
|
+
</file-info>
|
85
|
+
} + CONTENTS_XML + %{
|
86
|
+
</file>
|
87
|
+
<% end # values["files"] %>
|
88
|
+
</file-list>
|
89
|
+
<class-module-list>
|
90
|
+
<% values["classes"].each do |classes| %>
|
91
|
+
<<%= classes["classmod"] %> name="<%= classes["full_name"] %>" id="<%= classes["full_name"] %>">
|
92
|
+
<classmod-info>
|
93
|
+
<% if classes["infiles"] then %>
|
94
|
+
<infiles>
|
95
|
+
<% classes["infiles"].each do |infiles| %>
|
96
|
+
<infile><%= href infiles["full_path_url"], infiles["full_path"] %></infile>
|
97
|
+
<% end # classes["infiles"] %>
|
98
|
+
</infiles>
|
99
|
+
<% end %>
|
100
|
+
<% if classes["parent"] then %>
|
101
|
+
<superclass><%= href classes["par_url"], classes["parent"] %></superclass>
|
102
|
+
<% end %>
|
103
|
+
</classmod-info>
|
104
|
+
} + CONTENTS_XML + %{
|
105
|
+
</<%= classes["classmod"] %>>
|
106
|
+
<% end # values["classes"] %>
|
107
|
+
</class-module-list>
|
108
|
+
</rdoc>
|
109
|
+
}
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'find'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
include Config
|
7
|
+
|
8
|
+
$ruby = CONFIG['ruby_install_name']
|
9
|
+
|
10
|
+
##
|
11
|
+
# Install a binary file. We patch in on the way through to
|
12
|
+
# insert a #! line. If this is a Unix install, we name
|
13
|
+
# the command (for example) 'rdoc-f95' and let the shebang line
|
14
|
+
# handle running it. Under windows, we add a '.rb' extension
|
15
|
+
# and let file associations to their stuff
|
16
|
+
#
|
17
|
+
|
18
|
+
def installBIN(from, opfile)
|
19
|
+
|
20
|
+
tmp_dir = nil
|
21
|
+
[".", "/tmp", "c:/temp", $bindir].each{|t|
|
22
|
+
stat = File.stat(t) rescue next
|
23
|
+
if stat.directory? and stat.writable?
|
24
|
+
tmp_dir = t
|
25
|
+
break
|
26
|
+
end
|
27
|
+
}
|
28
|
+
|
29
|
+
fail "Cannot find a temporary directory" unless tmp_dir
|
30
|
+
tmp_file = File.join(tmp_dir, "_tmp")
|
31
|
+
|
32
|
+
|
33
|
+
File.open(from) do |ip|
|
34
|
+
File.open(tmp_file, "w") do |op|
|
35
|
+
ruby = File.join($realbindir, $ruby)
|
36
|
+
# op.puts "#!#{ruby}"
|
37
|
+
op.write ip.read
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
opfile += ".rb" if CONFIG["target_os"] =~ /mswin/i
|
42
|
+
FileUtils::makedirs($bindir, {:verbose => true})
|
43
|
+
FileUtils::install(tmp_file, File.join($bindir, opfile),
|
44
|
+
{:mode => 0755, :verbose => true})
|
45
|
+
FileUtils::safe_unlink(tmp_file)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Main Program
|
49
|
+
|
50
|
+
opt = OptionParser.new
|
51
|
+
OPTS = {}
|
52
|
+
opt.summary_width = 23
|
53
|
+
opt.summary_indent = ''*1
|
54
|
+
opt.on('--bindir=VAL',
|
55
|
+
'Directory to which the executable file is installed') \
|
56
|
+
{|v| $bindir = v.to_s}
|
57
|
+
opt.on('--binname=VAL',
|
58
|
+
'Name of the executable file (default name is "rdoc")') \
|
59
|
+
{|v| $binname = v.to_s}
|
60
|
+
opt.on('--libdir=VAL',
|
61
|
+
'Directory to which the libraries are installed') \
|
62
|
+
{|v| $libdir = v.to_s}
|
63
|
+
opt.on('--help', 'Show help message') {|v| OPTS[:help] = v}
|
64
|
+
|
65
|
+
opt.parse!(ARGV)
|
66
|
+
|
67
|
+
$bindir = File.expand_path($bindir) if $bindir
|
68
|
+
$binname ||= "rdoc"
|
69
|
+
$libdir = File.expand_path($libdir) if $libdir
|
70
|
+
|
71
|
+
install_opt = ""
|
72
|
+
install_opt = "--libdir=#{$libdir}" if $libdir
|
73
|
+
|
74
|
+
if $libdir
|
75
|
+
$sitedir = $libdir
|
76
|
+
else
|
77
|
+
$sitedir = CONFIG["sitelibdir"]
|
78
|
+
unless $sitedir
|
79
|
+
version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
|
80
|
+
$libdir = File.join(CONFIG["libdir"], "ruby", version)
|
81
|
+
$sitedir = $:.find {|x| x =~ /site_ruby/}
|
82
|
+
if !$sitedir
|
83
|
+
$sitedir = File.join($libdir, "site_ruby")
|
84
|
+
elsif $sitedir !~ Regexp.quote(version)
|
85
|
+
$sitedir = File.join($sitedir, version)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
$bindir ||= CONFIG["bindir"]
|
91
|
+
$realbindir = $bindir
|
92
|
+
|
93
|
+
bindir = CONFIG["bindir"]
|
94
|
+
|
95
|
+
rdoc_dest = File.join($sitedir, "rdoc")
|
96
|
+
rdoc_generator = File.join(rdoc_dest, "generator")
|
97
|
+
rdoc_parsers = File.join(rdoc_dest, "parsers")
|
98
|
+
rdoc_ri = File.join(rdoc_dest, "ri")
|
99
|
+
|
100
|
+
# help message
|
101
|
+
if ARGV[0] || OPTS[:help]
|
102
|
+
print <<-HELP
|
103
|
+
|
104
|
+
This ruby script installs libraries to \"#{$sitedir}\",
|
105
|
+
and executables to \"#{$bindir}/#{$binname}\". (See \"rbconfig.rb\")
|
106
|
+
|
107
|
+
If you want to install other directory, use following options.
|
108
|
+
|
109
|
+
#{opt.help}
|
110
|
+
|
111
|
+
HELP
|
112
|
+
exit
|
113
|
+
end
|
114
|
+
|
115
|
+
# make directories
|
116
|
+
[
|
117
|
+
rdoc_dest,
|
118
|
+
rdoc_generator,
|
119
|
+
rdoc_parsers,
|
120
|
+
rdoc_ri].each{|d|
|
121
|
+
FileUtils::makedirs(d, {:verbose => true})
|
122
|
+
}
|
123
|
+
|
124
|
+
FileUtils::chmod(0755, rdoc_dest)
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
# The library files
|
129
|
+
files = %w{
|
130
|
+
code_objects.rb
|
131
|
+
generator.rb
|
132
|
+
generator/*.rb
|
133
|
+
options.rb
|
134
|
+
parsers/parserfactory.rb
|
135
|
+
parsers/parse_*.rb
|
136
|
+
template.rb
|
137
|
+
tokenstream.rb
|
138
|
+
diagram.rb
|
139
|
+
rdoc.rb
|
140
|
+
dot.rb
|
141
|
+
ri/*.rb
|
142
|
+
ri.rb
|
143
|
+
markup.rb
|
144
|
+
stats.rb
|
145
|
+
}.collect {|f| Dir.glob(f)}.flatten
|
146
|
+
|
147
|
+
["chm", "html", "xml", "xhtml"].each{ |template|
|
148
|
+
d = File.join(rdoc_generator, template)
|
149
|
+
FileUtils::makedirs(d, {:verbose => true})
|
150
|
+
files.concat Dir.glob("generator/#{template}/*.rb")
|
151
|
+
files.concat Dir.glob("generator/#{template}/*.xsl")
|
152
|
+
}
|
153
|
+
|
154
|
+
files.each{ |aFile|
|
155
|
+
dst = File.join(rdoc_dest, aFile)
|
156
|
+
FileUtils::install(aFile, dst, {:mode => 0644, :verbose => true})
|
157
|
+
}
|
158
|
+
|
159
|
+
# and the executable
|
160
|
+
|
161
|
+
installBIN("rdoc", $binname)
|
162
|
+
|
163
|
+
# 'Markup' will eventually be a separate package, but
|
164
|
+
# for now we'll install it automatically
|
165
|
+
|
166
|
+
Dir.chdir("markup") && system("#$ruby install.rb #{install_opt}")
|