Class: RDoc::Generator::SDoc
- Inherits:
-
Object
- Object
- RDoc::Generator::SDoc
- Includes:
- ERB::Util, SDoc::GitHub, SDoc::Helpers, SDoc::Templatable
- Defined in:
- lib/sdoc/generator.rb
Defined Under Namespace
Classes: FilesTree
Constant Summary collapse
- DESCRIPTION =
'Searchable HTML documentation'
- GENERATOR_DIRS =
[File.join('sdoc', 'generator')]
- TYPE_CLASS =
Used in js to reduce index sizes
1
- TYPE_METHOD =
2
- TYPE_FILE =
3
- TREE_FILE =
File.join 'panel', 'tree.js'
- SEARCH_INDEX_FILE =
File.join 'panel', 'search_index.js'
- FILE_DIR =
'files'
- CLASS_DIR =
'classes'
- RESOURCES_DIR =
File.join('resources', '.')
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #class_dir ⇒ Object
- #file_dir ⇒ Object
- #generate(top_levels) ⇒ Object
-
#initialize(options) ⇒ SDoc
constructor
A new instance of SDoc.
Constructor Details
#initialize(options) ⇒ SDoc
Returns a new instance of SDoc.
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/sdoc/generator.rb', line 162 def initialize() @options = if @options.respond_to?('diagram=') @options.diagram = false end @github_url_cache = {} @template_dir = Pathname.new(.template_dir) @basedir = Pathname.pwd. end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
130 131 132 |
# File 'lib/sdoc/generator.rb', line 130 def basedir @basedir end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
132 133 134 |
# File 'lib/sdoc/generator.rb', line 132 def @options end |
Class Method Details
.setup_options(options) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/sdoc/generator.rb', line 134 def self.() @github = false .se_index = true opt = .option_parser opt.separator nil opt.separator "SDoc generator options:" opt.separator nil opt.on("--github", "-g", "Generate links to github.") do |value| .github = true end opt.separator nil opt.on("--no-se-index", "-ns", "Do not generated index file for search engines.", "SDoc uses javascript to refrence individual documentation pages.", "Search engine crawlers are not smart enough to find all the", "referenced pages.", "To help them SDoc generates a static file with links to every", "documentation page. This file is not shown to the user." ) do |value| .se_index = false end opt.separator nil end |
Instance Method Details
#class_dir ⇒ Object
188 189 190 |
# File 'lib/sdoc/generator.rb', line 188 def class_dir CLASS_DIR end |
#file_dir ⇒ Object
192 193 194 |
# File 'lib/sdoc/generator.rb', line 192 def file_dir FILE_DIR end |
#generate(top_levels) ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/sdoc/generator.rb', line 173 def generate(top_levels) @outputdir = Pathname.new(@options.op_dir).(@basedir) @files = top_levels.sort @classes = RDoc::TopLevel.all_classes_and_modules.sort # Now actually write the output copy_resources generate_class_tree generate_search_index generate_file_files generate_class_files generate_index_file generate_se_index if @options.se_index end |