Class: JsDuck::Options
- Inherits:
-
Object
- Object
- JsDuck::Options
- Defined in:
- lib/jsduck/options.rb
Overview
Keeps command line options
Instance Attribute Summary collapse
-
#body_html ⇒ Object
Returns the value of attribute body_html.
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
-
#categories_path ⇒ Object
Returns the value of attribute categories_path.
-
#comments_domain ⇒ Object
Returns the value of attribute comments_domain.
-
#comments_url ⇒ Object
Returns the value of attribute comments_url.
-
#css ⇒ Object
Returns the value of attribute css.
-
#eg_iframe ⇒ Object
Returns the value of attribute eg_iframe.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#examples_base_url ⇒ Object
Returns the value of attribute examples_base_url.
-
#export ⇒ Object
Returns the value of attribute export.
-
#ext4_events ⇒ Object
Returns the value of attribute ext4_events.
-
#ext_namespaces ⇒ Object
Returns the value of attribute ext_namespaces.
-
#external_classes ⇒ Object
Returns the value of attribute external_classes.
-
#extjs_path ⇒ Object
Returns the value of attribute extjs_path.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#guides ⇒ Object
Returns the value of attribute guides.
-
#head_html ⇒ Object
Returns the value of attribute head_html.
-
#header ⇒ Object
Returns the value of attribute header.
-
#ignore_global ⇒ Object
Returns the value of attribute ignore_global.
-
#ignore_html ⇒ Object
Returns the value of attribute ignore_html.
-
#images ⇒ Object
Returns the value of attribute images.
-
#img_tpl ⇒ Object
Returns the value of attribute img_tpl.
-
#imports ⇒ Object
Returns the value of attribute imports.
-
#input_files ⇒ Object
Returns the value of attribute input_files.
-
#link_tpl ⇒ Object
Returns the value of attribute link_tpl.
-
#local_storage_db ⇒ Object
Returns the value of attribute local_storage_db.
-
#message ⇒ Object
Returns the value of attribute message.
-
#new_since ⇒ Object
Returns the value of attribute new_since.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#search ⇒ Object
Returns the value of attribute search.
-
#seo ⇒ Object
Returns the value of attribute seo.
-
#source ⇒ Object
Returns the value of attribute source.
-
#template_dir ⇒ Object
Returns the value of attribute template_dir.
-
#template_links ⇒ Object
Returns the value of attribute template_links.
-
#tests ⇒ Object
Returns the value of attribute tests.
-
#title ⇒ Object
Customizing output.
-
#touch_examples_ui ⇒ Object
Returns the value of attribute touch_examples_ui.
-
#videos ⇒ Object
Returns the value of attribute videos.
-
#warnings_exit_nonzero ⇒ Object
Debugging.
-
#welcome ⇒ Object
Returns the value of attribute welcome.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Make options object behave like hash.
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #parse!(argv) ⇒ Object
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 |
# File 'lib/jsduck/options.rb', line 63 def initialize @input_files = [] @exclude = [] @output_dir = nil @ignore_global = false @external_classes = [ # JavaScript builtins "Object", "String", "Number", "Boolean", "RegExp", "Function", "Array", "Arguments", "Date", # JavaScript builtin error classes # https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error "Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", # DOM "HTMLElement", "XMLElement", "NodeList", "TextNode", "CSSStyleSheet", "CSSStyleRule", "Event", # Other browser-environment classes "Window", "XMLHttpRequest", # Special anything-goes type "Mixed", ] @ext4_events = nil # Customizing output @title = "Documentation - JSDuck" @header = "<strong>Documentation</strong> JSDuck" @footer = ("Generated on {DATE} by {JSDUCK} {VERSION}.") @head_html = "" @body_html = "" @css = "" @message = "" @welcome = nil @guides = nil @videos = nil @examples = nil @categories_path = nil @source = true @images = [] @custom_tag_paths = [] @link_tpl = '<a href="#!/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>' # Note that we wrap image template inside <p> because {@img} often # appears inline within text, but that just looks ugly in HTML @img_tpl = '<p><img src="%u" alt="%a" width="%w" height="%h"></p>' @export = nil @seo = false @eg_iframe = nil @examples_base_url = "extjs-build/examples/" @tests = false @comments_url = nil @comments_domain = nil @search = {} @ignore_html = {} # Debugging @warnings_exit_nonzero = false @cache = false @cache_dir = nil @root_dir = File.dirname(File.dirname(File.dirname(__FILE__))) @template_dir = @root_dir + "/template-min" @template_links = false @extjs_path = "extjs/ext-all.js" @local_storage_db = "docs" @touch_examples_ui = false @imports = [] @new_since = nil # Turn multiprocessing off by default in Windows Util::Parallel.in_processes = Util::OS::windows? ? 0 : nil # Enable all warnings except the following: Logger.set_warning(:all, true) Logger.set_warning(:link_auto, false) Logger.set_warning(:param_count, false) Logger.set_warning(:fires, false) Logger.set_warning(:nodoc, false) @optparser = create_option_parser end |
Instance Attribute Details
#body_html ⇒ Object
Returns the value of attribute body_html.
28 29 30 |
# File 'lib/jsduck/options.rb', line 28 def body_html @body_html end |
#cache ⇒ Object
Returns the value of attribute cache.
52 53 54 |
# File 'lib/jsduck/options.rb', line 52 def cache @cache end |
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
53 54 55 |
# File 'lib/jsduck/options.rb', line 53 def cache_dir @cache_dir end |
#categories_path ⇒ Object
Returns the value of attribute categories_path.
35 36 37 |
# File 'lib/jsduck/options.rb', line 35 def categories_path @categories_path end |
#comments_domain ⇒ Object
Returns the value of attribute comments_domain.
46 47 48 |
# File 'lib/jsduck/options.rb', line 46 def comments_domain @comments_domain end |
#comments_url ⇒ Object
Returns the value of attribute comments_url.
45 46 47 |
# File 'lib/jsduck/options.rb', line 45 def comments_url @comments_url end |
#css ⇒ Object
Returns the value of attribute css.
29 30 31 |
# File 'lib/jsduck/options.rb', line 29 def css @css end |
#eg_iframe ⇒ Object
Returns the value of attribute eg_iframe.
42 43 44 |
# File 'lib/jsduck/options.rb', line 42 def eg_iframe @eg_iframe end |
#examples ⇒ Object
Returns the value of attribute examples.
34 35 36 |
# File 'lib/jsduck/options.rb', line 34 def examples @examples end |
#examples_base_url ⇒ Object
Returns the value of attribute examples_base_url.
43 44 45 |
# File 'lib/jsduck/options.rb', line 43 def examples_base_url @examples_base_url end |
#export ⇒ Object
Returns the value of attribute export.
40 41 42 |
# File 'lib/jsduck/options.rb', line 40 def export @export end |
#ext4_events ⇒ Object
Returns the value of attribute ext4_events.
21 22 23 |
# File 'lib/jsduck/options.rb', line 21 def ext4_events @ext4_events end |
#ext_namespaces ⇒ Object
Returns the value of attribute ext_namespaces.
59 60 61 |
# File 'lib/jsduck/options.rb', line 59 def ext_namespaces @ext_namespaces end |
#external_classes ⇒ Object
Returns the value of attribute external_classes.
20 21 22 |
# File 'lib/jsduck/options.rb', line 20 def external_classes @external_classes end |
#extjs_path ⇒ Object
Returns the value of attribute extjs_path.
56 57 58 |
# File 'lib/jsduck/options.rb', line 56 def extjs_path @extjs_path end |
#footer ⇒ Object
Returns the value of attribute footer.
26 27 28 |
# File 'lib/jsduck/options.rb', line 26 def @footer end |
#guides ⇒ Object
Returns the value of attribute guides.
32 33 34 |
# File 'lib/jsduck/options.rb', line 32 def guides @guides end |
#head_html ⇒ Object
Returns the value of attribute head_html.
27 28 29 |
# File 'lib/jsduck/options.rb', line 27 def head_html @head_html end |
#header ⇒ Object
Returns the value of attribute header.
25 26 27 |
# File 'lib/jsduck/options.rb', line 25 def header @header end |
#ignore_global ⇒ Object
Returns the value of attribute ignore_global.
19 20 21 |
# File 'lib/jsduck/options.rb', line 19 def ignore_global @ignore_global end |
#ignore_html ⇒ Object
Returns the value of attribute ignore_html.
48 49 50 |
# File 'lib/jsduck/options.rb', line 48 def ignore_html @ignore_html end |
#images ⇒ Object
Returns the value of attribute images.
37 38 39 |
# File 'lib/jsduck/options.rb', line 37 def images @images end |
#img_tpl ⇒ Object
Returns the value of attribute img_tpl.
39 40 41 |
# File 'lib/jsduck/options.rb', line 39 def img_tpl @img_tpl end |
#imports ⇒ Object
Returns the value of attribute imports.
60 61 62 |
# File 'lib/jsduck/options.rb', line 60 def imports @imports end |
#input_files ⇒ Object
Returns the value of attribute input_files.
16 17 18 |
# File 'lib/jsduck/options.rb', line 16 def input_files @input_files end |
#link_tpl ⇒ Object
Returns the value of attribute link_tpl.
38 39 40 |
# File 'lib/jsduck/options.rb', line 38 def link_tpl @link_tpl end |
#local_storage_db ⇒ Object
Returns the value of attribute local_storage_db.
57 58 59 |
# File 'lib/jsduck/options.rb', line 57 def local_storage_db @local_storage_db end |
#message ⇒ Object
Returns the value of attribute message.
30 31 32 |
# File 'lib/jsduck/options.rb', line 30 def @message end |
#new_since ⇒ Object
Returns the value of attribute new_since.
61 62 63 |
# File 'lib/jsduck/options.rb', line 61 def new_since @new_since end |
#output_dir ⇒ Object
Returns the value of attribute output_dir.
18 19 20 |
# File 'lib/jsduck/options.rb', line 18 def output_dir @output_dir end |
#search ⇒ Object
Returns the value of attribute search.
47 48 49 |
# File 'lib/jsduck/options.rb', line 47 def search @search end |
#seo ⇒ Object
Returns the value of attribute seo.
41 42 43 |
# File 'lib/jsduck/options.rb', line 41 def seo @seo end |
#source ⇒ Object
Returns the value of attribute source.
36 37 38 |
# File 'lib/jsduck/options.rb', line 36 def source @source end |
#template_dir ⇒ Object
Returns the value of attribute template_dir.
54 55 56 |
# File 'lib/jsduck/options.rb', line 54 def template_dir @template_dir end |
#template_links ⇒ Object
Returns the value of attribute template_links.
55 56 57 |
# File 'lib/jsduck/options.rb', line 55 def template_links @template_links end |
#tests ⇒ Object
Returns the value of attribute tests.
44 45 46 |
# File 'lib/jsduck/options.rb', line 44 def tests @tests end |
#title ⇒ Object
Customizing output
24 25 26 |
# File 'lib/jsduck/options.rb', line 24 def title @title end |
#touch_examples_ui ⇒ Object
Returns the value of attribute touch_examples_ui.
58 59 60 |
# File 'lib/jsduck/options.rb', line 58 def touch_examples_ui @touch_examples_ui end |
#videos ⇒ Object
Returns the value of attribute videos.
33 34 35 |
# File 'lib/jsduck/options.rb', line 33 def videos @videos end |
#warnings_exit_nonzero ⇒ Object
Debugging
51 52 53 |
# File 'lib/jsduck/options.rb', line 51 def warnings_exit_nonzero @warnings_exit_nonzero end |
#welcome ⇒ Object
Returns the value of attribute welcome.
31 32 33 |
# File 'lib/jsduck/options.rb', line 31 def welcome @welcome end |
Instance Method Details
#[](key) ⇒ Object
Make options object behave like hash. This allows us to substitute it with hash in unit tests.
163 164 165 |
# File 'lib/jsduck/options.rb', line 163 def [](key) instance_variable_get("@#{key}") end |
#[]=(key, value) ⇒ Object
166 167 168 |
# File 'lib/jsduck/options.rb', line 166 def []=(key, value) instance_variable_set("@#{key}", value) end |
#parse!(argv) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/jsduck/options.rb', line 170 def parse!(argv) (argv) auto_detect_config_file unless @config_option_specified exclude_input_files validate if @custom_tag_paths.length > 0 TagRegistry.reconfigure(@custom_tag_paths) else # Ensure the TagRegistry get instantiated just once. # Otherwise the parallel processing causes multiple requests # to initialize the TagRegistry, resulting in loading the Tag # definitions multiple times. TagRegistry.instance end end |