distil 0.14.4 → 0.14.5.a
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/distil +10 -0
- data/lib/distil/project.rb +10 -7
- data/lib/distil/source-file.rb +1 -1
- metadata +28 -164
- data/Buildfile +0 -33
- data/distil.gemspec +0 -783
- data/lib/distil/javascript-documentation-generator.rb +0 -49
- data/vendor/pdoc/LICENSE +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Commands/Continue PDoc Comment.tmCommand +0 -39
- data/vendor/pdoc/PDoc.tmbundle/Macros/Collapse PDoc Blocks.tmMacro +0 -4084
- data/vendor/pdoc/PDoc.tmbundle/Macros/Expand PDoc Blocks.tmMacro +0 -1388
- data/vendor/pdoc/PDoc.tmbundle/Preferences/PDoc.tmPreferences +0 -50
- data/vendor/pdoc/PDoc.tmbundle/Snippets/class.tmSnippet +0 -24
- data/vendor/pdoc/PDoc.tmbundle/Snippets/constant.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/event.tmSnippet +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Snippets/method.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/mixin.tmSnippet +0 -23
- data/vendor/pdoc/PDoc.tmbundle/Snippets/namespace.tmSnippet +0 -24
- data/vendor/pdoc/PDoc.tmbundle/Snippets/param.tmSnippet +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Snippets/property.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/section.tmSnippet +0 -23
- data/vendor/pdoc/PDoc.tmbundle/Syntaxes/PDoc.tmLanguage +0 -33
- data/vendor/pdoc/PDoc.tmbundle/info.plist +0 -22
- data/vendor/pdoc/README.markdown +0 -34
- data/vendor/pdoc/Rakefile +0 -46
- data/vendor/pdoc/bin/pdoc +0 -58
- data/vendor/pdoc/lib/pdoc.rb +0 -32
- data/vendor/pdoc/lib/pdoc/error.rb +0 -4
- data/vendor/pdoc/lib/pdoc/generators.rb +0 -6
- data/vendor/pdoc/lib/pdoc/generators/abstract_generator.rb +0 -16
- data/vendor/pdoc/lib/pdoc/generators/html.rb +0 -8
- data/vendor/pdoc/lib/pdoc/generators/html/helpers.rb +0 -256
- data/vendor/pdoc/lib/pdoc/generators/html/page.rb +0 -71
- data/vendor/pdoc/lib/pdoc/generators/html/syntax_highlighter.rb +0 -41
- data/vendor/pdoc/lib/pdoc/generators/html/template.rb +0 -37
- data/vendor/pdoc/lib/pdoc/generators/html/website.rb +0 -194
- data/vendor/pdoc/lib/pdoc/generators/json.rb +0 -15
- data/vendor/pdoc/lib/pdoc/generators/pythonesque.rb +0 -105
- data/vendor/pdoc/lib/pdoc/models.rb +0 -47
- data/vendor/pdoc/lib/pdoc/models/argument.rb +0 -37
- data/vendor/pdoc/lib/pdoc/models/base.rb +0 -107
- data/vendor/pdoc/lib/pdoc/models/callable.rb +0 -19
- data/vendor/pdoc/lib/pdoc/models/class.rb +0 -28
- data/vendor/pdoc/lib/pdoc/models/class_method.rb +0 -18
- data/vendor/pdoc/lib/pdoc/models/class_property.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/constant.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/constructor.rb +0 -14
- data/vendor/pdoc/lib/pdoc/models/container.rb +0 -114
- data/vendor/pdoc/lib/pdoc/models/entity.rb +0 -54
- data/vendor/pdoc/lib/pdoc/models/instance_method.rb +0 -18
- data/vendor/pdoc/lib/pdoc/models/instance_property.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/mixin.rb +0 -10
- data/vendor/pdoc/lib/pdoc/models/namespace.rb +0 -10
- data/vendor/pdoc/lib/pdoc/models/root.rb +0 -27
- data/vendor/pdoc/lib/pdoc/models/section.rb +0 -19
- data/vendor/pdoc/lib/pdoc/models/signature.rb +0 -27
- data/vendor/pdoc/lib/pdoc/models/utility.rb +0 -11
- data/vendor/pdoc/lib/pdoc/parser.rb +0 -109
- data/vendor/pdoc/lib/pdoc/parser/argument_description_nodes.rb +0 -21
- data/vendor/pdoc/lib/pdoc/parser/basic_nodes.rb +0 -31
- data/vendor/pdoc/lib/pdoc/parser/description_nodes.rb +0 -42
- data/vendor/pdoc/lib/pdoc/parser/documentation_nodes.rb +0 -483
- data/vendor/pdoc/lib/pdoc/parser/ebnf_arguments_nodes.rb +0 -58
- data/vendor/pdoc/lib/pdoc/parser/ebnf_expression_nodes.rb +0 -227
- data/vendor/pdoc/lib/pdoc/parser/fragment.rb +0 -55
- data/vendor/pdoc/lib/pdoc/parser/section_content_nodes.rb +0 -19
- data/vendor/pdoc/lib/pdoc/parser/tags_nodes.rb +0 -14
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/argument_description.treetop +0 -31
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/basic.treetop +0 -41
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/description.treetop +0 -7
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/documentation.treetop +0 -75
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_arguments.treetop +0 -33
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_expression.treetop +0 -70
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop +0 -54
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/events.treetop +0 -17
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/section_content.treetop +0 -8
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/tags.treetop +0 -31
- data/vendor/pdoc/lib/pdoc/runner.rb +0 -110
- data/vendor/pdoc/lib/pdoc/treemaker.rb +0 -94
- data/vendor/pdoc/pdoc.gemspec +0 -31
- data/vendor/pdoc/templates/html/assets/images/pdoc/alias.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/constant.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/constructor.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/description.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/information.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/instance_method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/instance_property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/mixin.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/namespace.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/related_to.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/search-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/section-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/section.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/subclass.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/superclass.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/utility.png +0 -0
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/application.js +0 -478
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/prototype.js +0 -4874
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/tabs.js +0 -506
- data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/api.css +0 -677
- data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/pygments.css +0 -62
- data/vendor/pdoc/templates/html/helpers.rb +0 -35
- data/vendor/pdoc/templates/html/index.erb +0 -18
- data/vendor/pdoc/templates/html/item_index.js.erb +0 -6
- data/vendor/pdoc/templates/html/layout.erb +0 -67
- data/vendor/pdoc/templates/html/leaf.erb +0 -22
- data/vendor/pdoc/templates/html/node.erb +0 -30
- data/vendor/pdoc/templates/html/partials/class_relationships.erb +0 -19
- data/vendor/pdoc/templates/html/partials/classes.erb +0 -7
- data/vendor/pdoc/templates/html/partials/constructor.erb +0 -5
- data/vendor/pdoc/templates/html/partials/description.erb +0 -5
- data/vendor/pdoc/templates/html/partials/link_list.erb +0 -1
- data/vendor/pdoc/templates/html/partials/method_signatures.erb +0 -14
- data/vendor/pdoc/templates/html/partials/methodized_note.erb +0 -9
- data/vendor/pdoc/templates/html/partials/mixins.erb +0 -7
- data/vendor/pdoc/templates/html/partials/namespaces.erb +0 -7
- data/vendor/pdoc/templates/html/partials/related_utilities.erb +0 -5
- data/vendor/pdoc/templates/html/partials/relationships.erb +0 -11
- data/vendor/pdoc/templates/html/partials/short_description_list.erb +0 -7
- data/vendor/pdoc/templates/html/partials/title.erb +0 -22
- data/vendor/pdoc/templates/html/section.erb +0 -18
- data/vendor/pdoc/test/fixtures/ajax.js +0 -809
- data/vendor/pdoc/test/fixtures/prototype.js +0 -5789
- data/vendor/pdoc/test/fixtures/test.txt +0 -1
- data/vendor/pdoc/test/fixtures/text.txt +0 -13
- data/vendor/pdoc/test/unit/parser/argument_description_test.rb +0 -40
- data/vendor/pdoc/test/unit/parser/basic_test.rb +0 -55
- data/vendor/pdoc/test/unit/parser/description_test.rb +0 -34
- data/vendor/pdoc/test/unit/parser/documentation_test.rb +0 -520
- data/vendor/pdoc/test/unit/parser/ebnf_arguments_test.rb +0 -81
- data/vendor/pdoc/test/unit/parser/ebnf_expression_test.rb +0 -382
- data/vendor/pdoc/test/unit/parser/ebnf_javascript_test.rb +0 -37
- data/vendor/pdoc/test/unit/parser/events_test.rb +0 -27
- data/vendor/pdoc/test/unit/parser/section_content_test.rb +0 -44
- data/vendor/pdoc/test/unit/parser/tags_test.rb +0 -39
- data/vendor/pdoc/test/unit/parser/test_fragment.rb +0 -80
- data/vendor/pdoc/test/unit/parser_test_helper.rb +0 -62
- data/vendor/pdoc/test/unit/runner/basic_test.rb +0 -14
- data/vendor/pdoc/test/unit/templates/html_helpers_test.rb +0 -25
- data/vendor/pdoc/vendor/albino.rb +0 -122
- data/vendor/pdoc/website/html/documentation.html +0 -280
- data/vendor/pdoc/website/html/images/pdoc.jpg +0 -0
- data/vendor/pdoc/website/html/index.html +0 -84
- data/vendor/pdoc/website/html/stylesheets/main.css +0 -73
- data/vendor/pdoc/website/html/stylesheets/reset.css +0 -18
- data/vendor/pdoc/website/markdown/syntax.markdown +0 -226
- data/yuicompressor-2.4.6.zip +0 -0
@@ -1,75 +0,0 @@
|
|
1
|
-
grammar Documentation
|
2
|
-
include Tags
|
3
|
-
include Events
|
4
|
-
include ArgumentDescription
|
5
|
-
include Description
|
6
|
-
include SectionContent
|
7
|
-
include EbnfExpression
|
8
|
-
|
9
|
-
rule documentation
|
10
|
-
((!comment_start .)* doc_instance)+ (!comment_start .)* <Doc> / (!comment_start .)* {
|
11
|
-
def each
|
12
|
-
end
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
rule doc_instance
|
17
|
-
section_doc / klass_method_doc / instance_method_doc / klass_property_doc / instance_property_doc / utility_doc / constructor_doc / klass_doc / mixin_doc / constant_doc / namespace_doc
|
18
|
-
end
|
19
|
-
|
20
|
-
rule section_doc
|
21
|
-
start section comment_end <Section>
|
22
|
-
end
|
23
|
-
|
24
|
-
rule constructor_doc
|
25
|
-
start ebnf:(line constructor)+ argument_descriptions events text comment_end <Constructor>
|
26
|
-
end
|
27
|
-
|
28
|
-
rule mixin_doc
|
29
|
-
start line ebnf:mixin text comment_end <Mixin>
|
30
|
-
end
|
31
|
-
|
32
|
-
rule klass_doc
|
33
|
-
start line space* ebnf:klass text comment_end <Klass>
|
34
|
-
end
|
35
|
-
|
36
|
-
rule klass_method_doc
|
37
|
-
start ebnf:(line klass_method)+ argument_descriptions events text comment_end <KlassMethod>
|
38
|
-
end
|
39
|
-
|
40
|
-
rule instance_method_doc
|
41
|
-
start ebnf:(line instance_method)+ argument_descriptions events text comment_end <InstanceMethod>
|
42
|
-
end
|
43
|
-
|
44
|
-
rule klass_property_doc
|
45
|
-
start line ebnf:klass_property text comment_end <KlassProperty>
|
46
|
-
end
|
47
|
-
|
48
|
-
rule instance_property_doc
|
49
|
-
start line ebnf:instance_property text comment_end <InstanceProperty>
|
50
|
-
end
|
51
|
-
|
52
|
-
rule constant_doc
|
53
|
-
start line ebnf:constant text comment_end <Constant>
|
54
|
-
end
|
55
|
-
|
56
|
-
rule utility_doc
|
57
|
-
start ebnf:(line utility)+ argument_descriptions events text comment_end <Utility>
|
58
|
-
end
|
59
|
-
|
60
|
-
rule namespace_doc
|
61
|
-
start line space* ebnf:namespace text comment_end <Namespace>
|
62
|
-
end
|
63
|
-
|
64
|
-
rule start
|
65
|
-
comment_start space* (tags)?
|
66
|
-
end
|
67
|
-
|
68
|
-
rule argument_descriptions
|
69
|
-
(argument_description+ blank_line)?
|
70
|
-
end
|
71
|
-
|
72
|
-
rule events
|
73
|
-
(super)?
|
74
|
-
end
|
75
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
grammar EbnfArguments
|
2
|
-
include EbnfJavascript
|
3
|
-
|
4
|
-
rule arguments
|
5
|
-
first_argument:argument rest:(argument_separator argument)* <Arguments>
|
6
|
-
/
|
7
|
-
space* {
|
8
|
-
def to_a
|
9
|
-
[]
|
10
|
-
end
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
rule argument
|
15
|
-
optional_argument / required_argument
|
16
|
-
end
|
17
|
-
|
18
|
-
rule argument_separator
|
19
|
-
space* (&'[' / ',')
|
20
|
-
end
|
21
|
-
|
22
|
-
rule optional_argument
|
23
|
-
"[" space* ","? required_argument default:(default_value?) nested:(optional_argument*) "]" <OptionalArgument>
|
24
|
-
end
|
25
|
-
|
26
|
-
rule default_value
|
27
|
-
space* "=" space* value:[^\[\]]+
|
28
|
-
end
|
29
|
-
|
30
|
-
rule required_argument
|
31
|
-
space* (js_variable / js_object) '...'? space* <Argument>
|
32
|
-
end
|
33
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
grammar EbnfExpression
|
2
|
-
include EbnfArguments
|
3
|
-
rule ebnf
|
4
|
-
klass_method / instance_method / klass_property / instance_property / utility / constructor / mixin / klass / constant / namespace
|
5
|
-
end
|
6
|
-
|
7
|
-
rule mixin
|
8
|
-
space* 'mixin' space+ js_namespace (includes)? <Mixin>
|
9
|
-
end
|
10
|
-
|
11
|
-
rule klass
|
12
|
-
space* 'class' space+ js_namespace extends:(space+ '<' space+ js_namespace)? (includes)? <Klass>
|
13
|
-
end
|
14
|
-
|
15
|
-
rule includes
|
16
|
-
line space* 'includes' space+ js_namespace more:(',' space+ js_namespace)*
|
17
|
-
end
|
18
|
-
|
19
|
-
rule constructor
|
20
|
-
space* 'new' (space)+ js_namespace args <Constructor>
|
21
|
-
end
|
22
|
-
|
23
|
-
rule instance_accessor
|
24
|
-
js_namespace '#' js_variable
|
25
|
-
end
|
26
|
-
|
27
|
-
rule instance_signature
|
28
|
-
instance_accessor args
|
29
|
-
end
|
30
|
-
|
31
|
-
rule klass_method
|
32
|
-
space* js_namespace args return_value <KlassMethod>
|
33
|
-
end
|
34
|
-
|
35
|
-
rule instance_method
|
36
|
-
space* instance_signature return_value <InstanceMethod>
|
37
|
-
end
|
38
|
-
|
39
|
-
rule klass_property
|
40
|
-
space* js_namespace return_value <KlassProperty>
|
41
|
-
end
|
42
|
-
|
43
|
-
rule instance_property
|
44
|
-
space* instance_accessor return_value <InstanceProperty>
|
45
|
-
end
|
46
|
-
|
47
|
-
rule constant
|
48
|
-
space* js_namespace space* "=" space* value:(char)+ space* <Constant>
|
49
|
-
end
|
50
|
-
|
51
|
-
rule utility
|
52
|
-
space* utility_name:('$' [$a-zA-Z]*) args return_value <Utility>
|
53
|
-
end
|
54
|
-
|
55
|
-
rule args
|
56
|
-
'(' space* methodize:'@'? arguments space* ')' {
|
57
|
-
def text_value
|
58
|
-
super.to_s.sub('( )', '()')
|
59
|
-
end
|
60
|
-
}
|
61
|
-
end
|
62
|
-
|
63
|
-
rule namespace
|
64
|
-
js_namespace (includes)? <Namespace>
|
65
|
-
end
|
66
|
-
|
67
|
-
rule return_value
|
68
|
-
space* '->' space* value:(char)+
|
69
|
-
end
|
70
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
grammar EbnfJavascript
|
2
|
-
include Basic
|
3
|
-
rule primitive
|
4
|
-
js_all_caps_constant / js_namespace / js_constant / js_variable / js_object
|
5
|
-
end
|
6
|
-
|
7
|
-
rule js_object
|
8
|
-
'{' [^}]* '}'
|
9
|
-
end
|
10
|
-
|
11
|
-
rule js_constant
|
12
|
-
[A-Z] [a-zA-Z_0-9$]* {
|
13
|
-
def value
|
14
|
-
text_value
|
15
|
-
end
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
rule js_all_caps_constant
|
20
|
-
[A-Z] [A-Z_]+ {
|
21
|
-
def value
|
22
|
-
text_value
|
23
|
-
end
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
rule js_variable
|
28
|
-
[_a-zA-Z] [_a-zA-Z0-9]* {
|
29
|
-
def value
|
30
|
-
text_value
|
31
|
-
end
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
rule js_namespace
|
36
|
-
(js_constant / js_all_caps_constant / js_variable) ('.' (js_constant / js_all_caps_constant / js_variable))* {
|
37
|
-
def namespace
|
38
|
-
to_a.slice(0..-2).join(".")
|
39
|
-
end
|
40
|
-
|
41
|
-
def name
|
42
|
-
to_a.pop
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_a
|
46
|
-
text_value.split('.')
|
47
|
-
end
|
48
|
-
|
49
|
-
def full_name
|
50
|
-
text_value
|
51
|
-
end
|
52
|
-
}
|
53
|
-
end
|
54
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
grammar Events
|
2
|
-
include Basic
|
3
|
-
|
4
|
-
rule events
|
5
|
-
line space* 'fires' space+ event more:(',' space* event)* {
|
6
|
-
def to_a
|
7
|
-
[event.text_value].concat(more.elements.map{ |e| e.event.text_value })
|
8
|
-
end
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
rule event
|
13
|
-
[a-zA-Z]+ (':' [a-zA-Z]+)*
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
grammar Tags
|
2
|
-
include Basic
|
3
|
-
|
4
|
-
rule tags
|
5
|
-
tag more:(', ' tag)* <Tags>
|
6
|
-
end
|
7
|
-
|
8
|
-
rule tag
|
9
|
-
tag_name opt:(": " tag_value)? {
|
10
|
-
def name
|
11
|
-
tag_name.text_value
|
12
|
-
end
|
13
|
-
|
14
|
-
def value
|
15
|
-
if opt.respond_to?("tag_value")
|
16
|
-
opt.tag_value.text_value
|
17
|
-
else
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
end
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
rule tag_value
|
25
|
-
(![\n:,] .)+
|
26
|
-
end
|
27
|
-
|
28
|
-
rule tag_name
|
29
|
-
(![\n:,] .)+
|
30
|
-
end
|
31
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
module PDoc
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
class Runner
|
5
|
-
def initialize(*source_files)
|
6
|
-
options = source_files.last.is_a?(Hash) ? source_files.pop : {}
|
7
|
-
@source_files = source_files.empty? ? options[:source_files] : source_files
|
8
|
-
@output_directory = File.expand_path(options.delete(:destination) || OUTPUT_DIR)
|
9
|
-
@generator = options.delete(:generator) || Generators::Html::Website
|
10
|
-
@parser = Parser
|
11
|
-
@serializer = Serializer
|
12
|
-
@bust_cache = options.delete(:bust_cache) || false
|
13
|
-
Models.src_code_href = options.delete(:src_code_href)
|
14
|
-
Models.doc_href = options.delete(:doc_href)
|
15
|
-
@generator_options = options
|
16
|
-
end
|
17
|
-
|
18
|
-
def serialize(files)
|
19
|
-
files.each do |path|
|
20
|
-
File.open(pdoc_file(path), "w+") do |f|
|
21
|
-
f << serialize_file(path)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def deserialize(files)
|
27
|
-
results = []
|
28
|
-
files.each do |file|
|
29
|
-
file = pdoc_file(file)
|
30
|
-
File.open(file) do |y|
|
31
|
-
YAML.load_documents(y) { |doc| results << doc }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
results
|
35
|
-
end
|
36
|
-
|
37
|
-
def new_files
|
38
|
-
@source_files.select do |path|
|
39
|
-
pdoc = pdoc_file(path)
|
40
|
-
!File.exist?(pdoc) || File.mtime(path) > File.mtime(pdoc)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def run
|
45
|
-
opts = @generator_options
|
46
|
-
puts
|
47
|
-
puts " Markdown parser: #{opts[:markdown_parser]}" if opts[:markdown_parser]
|
48
|
-
puts " Syntax highlighter: #{opts[:syntax_highlighter]}" if opts[:syntax_highlighter]
|
49
|
-
puts " Pretty urls: #{opts[:pretty_urls]}" if opts[:pretty_urls]
|
50
|
-
puts " Index page: #{opts[:index_page]}" if opts[:index_page]
|
51
|
-
puts " Output directory: #{@output_directory}\n\n"
|
52
|
-
|
53
|
-
files = @bust_cache ? @source_files : new_files
|
54
|
-
if files.empty?
|
55
|
-
puts " Restoring serialized documentation from cache.\n\n"
|
56
|
-
else
|
57
|
-
puts " Parsing JS files for PDoc comments:"
|
58
|
-
start_time = Time.new
|
59
|
-
serialize(files)
|
60
|
-
puts " Finished parsing files in #{Time.new - start_time} seconds.\n\n"
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
start_time = Time.new
|
65
|
-
data = deserialize(@source_files)
|
66
|
-
root = Treemaker.new(data).root
|
67
|
-
puts " Building documentation tree. Finished in #{Time.new - start_time} seconds.\n\n"
|
68
|
-
|
69
|
-
start_time = Time.new
|
70
|
-
puts " Generating documentation:"
|
71
|
-
@generator.new(root, @generator_options).render(@output_directory)
|
72
|
-
puts "\n Finished generating documentation in #{Time.new - start_time} seconds.\n\n"
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
def serialize_file(path)
|
77
|
-
serializer = @serializer.new
|
78
|
-
serializer.path = path
|
79
|
-
puts " Parsing #{path}..."
|
80
|
-
File.open(path) do |file|
|
81
|
-
@parser.new(file.read).parse.each do |fragment|
|
82
|
-
fragment.serialize(serializer)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
serializer
|
86
|
-
end
|
87
|
-
|
88
|
-
def pdoc_file(path)
|
89
|
-
name = '.' << File.basename(path, '.js') << '.pdoc.yaml'
|
90
|
-
File.expand_path(File.join(File.dirname(path), name))
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class Serializer
|
95
|
-
attr_accessor :path
|
96
|
-
def initialize
|
97
|
-
@doc_fragments = []
|
98
|
-
end
|
99
|
-
|
100
|
-
def <<(fragment)
|
101
|
-
fragment = "---\n#{fragment}"
|
102
|
-
fragment << "\nfile: #{path}"
|
103
|
-
@doc_fragments << fragment
|
104
|
-
end
|
105
|
-
|
106
|
-
def to_s
|
107
|
-
@doc_fragments.join("\n\n")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
module PDoc
|
2
|
-
class Treemaker
|
3
|
-
include Models
|
4
|
-
|
5
|
-
def initialize(doc_fragments = [])
|
6
|
-
methodized = []
|
7
|
-
doc_fragments.each do |attributes|
|
8
|
-
if attributes['methodized']
|
9
|
-
dups = attributes.dup
|
10
|
-
dups['id'] = methodize_id(dups['id'])
|
11
|
-
dups['type'] = 'instance method'
|
12
|
-
if dups['signatures']
|
13
|
-
dups['signatures'] = dups['signatures'].map do |s|
|
14
|
-
{
|
15
|
-
'signature' => methodize_signature(s['signature']),
|
16
|
-
'return_value' => s['return_value']
|
17
|
-
}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
if dups['alias_of']
|
21
|
-
dups['alias_of'] = methodize_id(dups['alias_of'])
|
22
|
-
end
|
23
|
-
methodized << dups
|
24
|
-
i = instantiate_from(dups)
|
25
|
-
c = instantiate_from(attributes)
|
26
|
-
i.functionalized_self = c
|
27
|
-
c.methodized_self = i
|
28
|
-
else
|
29
|
-
instantiate_from(attributes)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
doc_fragments.concat(methodized).each do |attributes|
|
34
|
-
if parent_id = attributes['parent_id']
|
35
|
-
parent = root.find(parent_id)
|
36
|
-
raise "Undocumented object: #{parent_id}." unless parent
|
37
|
-
else
|
38
|
-
parent = root
|
39
|
-
end
|
40
|
-
object = root.find(attributes['id'])
|
41
|
-
object.parent = parent
|
42
|
-
object.attach_to_parent(parent)
|
43
|
-
|
44
|
-
if superclass_id = attributes['superclass_id']
|
45
|
-
superclass = root.find(superclass_id)
|
46
|
-
raise "Undocumented object: #{superclass_id}." unless superclass
|
47
|
-
object.superclass = superclass
|
48
|
-
superclass.subclasses << object
|
49
|
-
end
|
50
|
-
|
51
|
-
if included = attributes['included']
|
52
|
-
included.each do |id|
|
53
|
-
mixin = root.find(id)
|
54
|
-
raise "Undocumented object: #{id}." unless mixin
|
55
|
-
object.included_mixins << mixin
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
if alias_of_id = attributes['alias_of']
|
60
|
-
alias_of = root.find(alias_of_id)
|
61
|
-
raise "Undocumented object: #{alias_of_id}." unless alias_of
|
62
|
-
object.alias = alias_of
|
63
|
-
alias_of.aliases << object
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def instantiate_from(attributes)
|
69
|
-
arguments = attributes.delete('arguments')
|
70
|
-
signatures = attributes.delete('signatures')
|
71
|
-
object = Base.instantiate(attributes)
|
72
|
-
arguments.each { |a| Argument.new(a).attach_to_parent(object) } if arguments
|
73
|
-
signatures.each { |s| Signature.new(s).attach_to_parent(object) } if signatures
|
74
|
-
object.register_on(root.registry)
|
75
|
-
end
|
76
|
-
|
77
|
-
def methodize_signature(sig)
|
78
|
-
sig.sub(/\.([\w\d\$]+)\((.*?)(,\s*|\))/) do
|
79
|
-
first_arg = $2.to_s.strip
|
80
|
-
prefix = first_arg[-1, 1] == '[' ? '([' : '('
|
81
|
-
rest = $3 == ')' ? $3 : ''
|
82
|
-
"##{$1}#{prefix}#{rest}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def methodize_id(id)
|
87
|
-
id.sub(/\.([^\.]+)$/) { "##{$1}" }
|
88
|
-
end
|
89
|
-
|
90
|
-
def root
|
91
|
-
@root ||= Root.new
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|