yard 0.6.8 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/.yardopts +1 -0
- data/ChangeLog +723 -0
- data/README.md +16 -6
- data/docs/CodeObjects.md +10 -16
- data/docs/GettingStarted.md +232 -32
- data/docs/Glossary.md +1 -2
- data/docs/Handlers.md +10 -16
- data/docs/Overview.md +14 -13
- data/docs/Parser.md +13 -22
- data/docs/Tags.md +209 -16
- data/docs/Templates.md +237 -26
- data/docs/WhatsNew.md +178 -2
- data/lib/yard.rb +13 -10
- data/lib/yard/autoload.rb +22 -18
- data/lib/yard/cli/command.rb +13 -12
- data/lib/yard/cli/command_parser.rb +20 -19
- data/lib/yard/cli/config.rb +19 -19
- data/lib/yard/cli/diff.rb +46 -21
- data/lib/yard/cli/gems.rb +11 -11
- data/lib/yard/cli/graph.rb +13 -13
- data/lib/yard/cli/help.rb +1 -1
- data/lib/yard/cli/list.rb +22 -0
- data/lib/yard/cli/server.rb +17 -17
- data/lib/yard/cli/stats.rb +32 -32
- data/lib/yard/cli/yardoc.rb +181 -135
- data/lib/yard/cli/yri.rb +29 -29
- data/lib/yard/code_objects/base.rb +101 -101
- data/lib/yard/code_objects/class_object.rb +20 -20
- data/lib/yard/code_objects/constant_object.rb +1 -1
- data/lib/yard/code_objects/extended_method_object.rb +5 -5
- data/lib/yard/code_objects/extra_file_object.rb +89 -0
- data/lib/yard/code_objects/macro_object.rb +215 -0
- data/lib/yard/code_objects/method_object.rb +30 -30
- data/lib/yard/code_objects/module_object.rb +1 -1
- data/lib/yard/code_objects/namespace_object.rb +39 -39
- data/lib/yard/code_objects/proxy.rb +38 -38
- data/lib/yard/code_objects/root_object.rb +1 -1
- data/lib/yard/config.rb +40 -40
- data/lib/yard/core_ext/array.rb +2 -2
- data/lib/yard/core_ext/file.rb +11 -11
- data/lib/yard/core_ext/insertion.rb +10 -10
- data/lib/yard/core_ext/module.rb +2 -2
- data/lib/yard/core_ext/string.rb +2 -2
- data/lib/yard/core_ext/symbol_hash.rb +14 -14
- data/lib/yard/docstring.rb +122 -54
- data/lib/yard/globals.rb +2 -2
- data/lib/yard/handlers/base.rb +216 -127
- data/lib/yard/handlers/processor.rb +65 -27
- data/lib/yard/handlers/ruby/alias_handler.rb +6 -3
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -6
- data/lib/yard/handlers/ruby/base.rb +50 -31
- data/lib/yard/handlers/ruby/class_condition_handler.rb +11 -11
- data/lib/yard/handlers/ruby/class_handler.rb +10 -10
- data/lib/yard/handlers/ruby/class_variable_handler.rb +3 -3
- data/lib/yard/handlers/ruby/constant_handler.rb +7 -7
- data/lib/yard/handlers/ruby/exception_handler.rb +2 -2
- data/lib/yard/handlers/ruby/extend_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/alias_handler.rb +8 -5
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +6 -5
- data/lib/yard/handlers/ruby/legacy/base.rb +42 -27
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +9 -9
- data/lib/yard/handlers/ruby/legacy/class_handler.rb +13 -12
- data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +3 -6
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +5 -8
- data/lib/yard/handlers/ruby/legacy/exception_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/extend_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/macro_handler.rb +40 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -10
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +4 -3
- data/lib/yard/handlers/ruby/legacy/module_handler.rb +2 -1
- data/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +4 -4
- data/lib/yard/handlers/ruby/legacy/visibility_handler.rb +2 -1
- data/lib/yard/handlers/ruby/legacy/yield_handler.rb +3 -3
- data/lib/yard/handlers/ruby/macro_handler.rb +41 -0
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +130 -0
- data/lib/yard/handlers/ruby/method_condition_handler.rb +1 -1
- data/lib/yard/handlers/ruby/method_handler.rb +13 -13
- data/lib/yard/handlers/ruby/mixin_handler.rb +4 -4
- data/lib/yard/handlers/ruby/module_handler.rb +2 -1
- data/lib/yard/handlers/ruby/private_constant_handler.rb +4 -4
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +11 -11
- data/lib/yard/handlers/ruby/visibility_handler.rb +1 -1
- data/lib/yard/handlers/ruby/yield_handler.rb +5 -5
- data/lib/yard/logging.rb +11 -11
- data/lib/yard/parser/base.rb +8 -8
- data/lib/yard/parser/c_parser.rb +42 -33
- data/lib/yard/parser/ruby/ast_node.rb +62 -61
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +66 -66
- data/lib/yard/parser/ruby/legacy/ruby_parser.rb +4 -4
- data/lib/yard/parser/ruby/legacy/statement.rb +11 -11
- data/lib/yard/parser/ruby/legacy/statement_list.rb +15 -15
- data/lib/yard/parser/ruby/legacy/token_list.rb +9 -9
- data/lib/yard/parser/ruby/ruby_parser.rb +51 -37
- data/lib/yard/parser/source_parser.rb +271 -46
- data/lib/yard/rake/yardoc_task.rb +18 -17
- data/lib/yard/registry.rb +64 -64
- data/lib/yard/registry_store.rb +34 -34
- data/lib/yard/rubygems/backports.rb +8 -0
- data/lib/yard/rubygems/backports/LICENSE.txt +57 -0
- data/lib/yard/rubygems/backports/MIT.txt +20 -0
- data/lib/yard/rubygems/backports/gem.rb +8 -0
- data/lib/yard/rubygems/backports/source_index.rb +353 -0
- data/lib/yard/rubygems/specification.rb +2 -2
- data/lib/yard/serializers/base.rb +20 -20
- data/lib/yard/serializers/file_system_serializer.rb +28 -24
- data/lib/yard/serializers/process_serializer.rb +3 -3
- data/lib/yard/serializers/stdout_serializer.rb +6 -6
- data/lib/yard/serializers/yardoc_serializer.rb +17 -17
- data/lib/yard/server/adapter.rb +12 -12
- data/lib/yard/server/commands/base.rb +26 -26
- data/lib/yard/server/commands/display_file_command.rb +3 -2
- data/lib/yard/server/commands/display_object_command.rb +5 -5
- data/lib/yard/server/commands/frames_command.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +7 -7
- data/lib/yard/server/commands/library_index_command.rb +2 -2
- data/lib/yard/server/commands/list_command.rb +8 -8
- data/lib/yard/server/commands/search_command.rb +8 -8
- data/lib/yard/server/commands/static_file_command.rb +3 -3
- data/lib/yard/server/doc_server_helper.rb +6 -3
- data/lib/yard/server/doc_server_serializer.rb +1 -1
- data/lib/yard/server/library_version.rb +45 -45
- data/lib/yard/server/rack_adapter.rb +10 -10
- data/lib/yard/server/router.rb +28 -28
- data/lib/yard/server/static_caching.rb +5 -5
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +3 -3
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +1 -1
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +2 -2
- data/lib/yard/server/templates/default/layout/html/headers.erb +13 -8
- data/lib/yard/server/templates/default/layout/html/setup.rb +7 -0
- data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +2 -2
- data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +14 -4
- data/lib/yard/server/templates/doc_server/library_list/html/contents.erb +2 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +2 -2
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/search.erb +1 -1
- data/lib/yard/server/webrick_adapter.rb +2 -2
- data/lib/yard/tags/default_factory.rb +19 -19
- data/lib/yard/tags/default_tag.rb +1 -1
- data/lib/yard/tags/library.rb +68 -63
- data/lib/yard/tags/option_tag.rb +1 -1
- data/lib/yard/tags/overload_tag.rb +9 -9
- data/lib/yard/tags/ref_tag_list.rb +2 -2
- data/lib/yard/tags/tag.rb +7 -7
- data/lib/yard/templates/engine.rb +31 -31
- data/lib/yard/templates/erb_cache.rb +1 -1
- data/lib/yard/templates/helpers/base_helper.rb +46 -32
- data/lib/yard/templates/helpers/filter_helper.rb +2 -2
- data/lib/yard/templates/helpers/html_helper.rb +120 -81
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +4 -4
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +9 -9
- data/lib/yard/templates/helpers/markup_helper.rb +37 -30
- data/lib/yard/templates/helpers/method_helper.rb +7 -7
- data/lib/yard/templates/helpers/text_helper.rb +7 -7
- data/lib/yard/templates/helpers/uml_helper.rb +3 -3
- data/lib/yard/templates/section.rb +14 -14
- data/lib/yard/templates/template.rb +54 -54
- data/lib/yard/verifier.rb +27 -27
- data/spec/cli/list_spec.rb +8 -0
- data/spec/cli/yardoc_spec.rb +58 -10
- data/spec/code_objects/extra_file_object_spec.rb +132 -0
- data/spec/code_objects/macro_object_spec.rb +154 -0
- data/spec/docstring_spec.rb +90 -0
- data/spec/handlers/base_spec.rb +22 -0
- data/spec/handlers/examples/macro_handler_001.rb.txt +73 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +17 -0
- data/spec/handlers/macro_handler_spec.rb +140 -0
- data/spec/handlers/method_handler_spec.rb +28 -0
- data/spec/handlers/processor_spec.rb +4 -0
- data/spec/handlers/spec_helper.rb +1 -1
- data/spec/parser/c_parser_spec.rb +47 -16
- data/spec/parser/examples/extrafile.c.txt +8 -0
- data/spec/parser/examples/multifile.c.txt +6 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +5 -0
- data/spec/parser/source_parser_spec.rb +235 -0
- data/spec/rake/yardoc_task_spec.rb +22 -17
- data/spec/serializers/file_system_serializer_spec.rb +6 -0
- data/spec/server/commands/library_command_spec.rb +39 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/templates/examples/method001.html +6 -6
- data/spec/templates/examples/method002.html +4 -4
- data/spec/templates/examples/method003.html +10 -10
- data/spec/templates/examples/method005.html +2 -2
- data/spec/templates/examples/module001.dot +2 -0
- data/spec/templates/examples/module001.html +76 -37
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/helpers/base_helper_spec.rb +7 -2
- data/spec/templates/helpers/html_helper_spec.rb +49 -5
- data/spec/templates/helpers/markup_helper_spec.rb +9 -8
- data/spec/templates/module_spec.rb +7 -0
- data/spec/templates/onefile_spec.rb +47 -0
- data/templates/default/fulldoc/html/css/style.css +7 -5
- data/templates/default/fulldoc/html/full_list.erb +13 -10
- data/templates/default/fulldoc/html/full_list_files.erb +1 -1
- data/templates/default/fulldoc/html/js/app.js +16 -14
- data/templates/default/fulldoc/html/js/full_list.js +7 -6
- data/templates/default/fulldoc/html/setup.rb +78 -17
- data/templates/default/layout/html/files.erb +1 -1
- data/templates/default/layout/html/headers.erb +11 -7
- data/templates/default/layout/html/search.erb +4 -4
- data/templates/default/layout/html/setup.rb +28 -8
- data/templates/default/module/html/inherited_attributes.erb +17 -0
- data/templates/default/module/setup.rb +1 -1
- data/templates/default/onefile/html/files.erb +2 -2
- data/templates/default/onefile/html/layout.erb +1 -1
- data/templates/default/onefile/html/setup.rb +7 -5
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/default/tags/html/tag.erb +3 -3
- data/templates/guide/class/html/setup.rb +1 -0
- data/templates/guide/docstring/html/setup.rb +1 -0
- data/templates/guide/fulldoc/html/css/style.css +91 -0
- data/templates/guide/fulldoc/html/js/app.js +33 -0
- data/templates/guide/fulldoc/html/setup.rb +54 -0
- data/templates/guide/layout/html/layout.erb +81 -0
- data/templates/guide/layout/html/setup.rb +24 -0
- data/templates/guide/method/html/header.erb +18 -0
- data/templates/guide/method/html/setup.rb +21 -0
- data/templates/guide/module/html/header.erb +7 -0
- data/templates/guide/module/html/method_list.erb +5 -0
- data/templates/guide/module/html/setup.rb +26 -0
- data/templates/guide/tags/html/setup.rb +8 -0
- metadata +40 -7
- data/lib/yard/handlers/ruby/legacy/process_handler.rb +0 -13
- data/lib/yard/handlers/ruby/process_handler.rb +0 -18
- data/spec/handlers/process_handler_spec.rb +0 -17
@@ -5,19 +5,19 @@ module YARD
|
|
5
5
|
module Server
|
6
6
|
# This class wraps the {RackAdapter} into a Rack-compatible middleware.
|
7
7
|
# See {#initialize} for a list of options to pass via Rack's +#use+ method.
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# @note You must pass a +:libraries+ option to the RackMiddleware via +#use+. To
|
10
10
|
# read about how to return a list of libraries, see {LibraryVersion} or look
|
11
11
|
# at the example below.
|
12
12
|
# @example Using the RackMiddleware in a Rack application
|
13
13
|
# libraries = {:mylib => [YARD::Server::LibraryVersion.new('mylib', nil, '/path/to/.yardoc')]}
|
14
14
|
# use YARD::Server::RackMiddleware, :libraries => libraries
|
15
|
-
#
|
15
|
+
#
|
16
16
|
class RackMiddleware
|
17
17
|
# Creates a new Rack-based middleware for serving YARD documentation.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# @param app the next Rack middleware in the stack
|
20
|
-
# @option opts [Hash{String=>Array<LibraryVersion>}] :libraries ({})
|
20
|
+
# @option opts [Hash{String=>Array<LibraryVersion>}] :libraries ({})
|
21
21
|
# the map of libraries to serve through the adapter. This option is *required*.
|
22
22
|
# @option opts [Hash] :options ({}) a list of options to pass to the adapter.
|
23
23
|
# See {Adapter#options} for a list.
|
@@ -28,7 +28,7 @@ module YARD
|
|
28
28
|
@app = app
|
29
29
|
@adapter = RackAdapter.new(*args)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def call(env)
|
33
33
|
status, headers, body = *@adapter.call(env)
|
34
34
|
if status == 404
|
@@ -38,11 +38,11 @@ module YARD
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
# A server adapter to respond to requests using the Rack server infrastructure.
|
43
43
|
class RackAdapter < Adapter
|
44
44
|
include WEBrick::HTTPUtils
|
45
|
-
|
45
|
+
|
46
46
|
# Responds to Rack requests and builds a response with the {Router}.
|
47
47
|
# @return [Array(Number,Hash,Array)] the Rack-style response
|
48
48
|
def call(env)
|
@@ -50,7 +50,7 @@ module YARD
|
|
50
50
|
request.path_info = unescape(request.path_info) # unescape things like %3F
|
51
51
|
router.call(request)
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
# Starts the +Rack::Server+. This method will pass control to the server and
|
55
55
|
# block.
|
56
56
|
# @return [void]
|
@@ -60,9 +60,9 @@ module YARD
|
|
60
60
|
print_start_message(server)
|
61
61
|
server.start
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
private
|
65
|
-
|
65
|
+
|
66
66
|
def print_start_message(server)
|
67
67
|
opts = server.default_options.merge(server.options)
|
68
68
|
puts ">> YARD #{YARD::VERSION} documentation server at http://#{opts[:Host]}:#{opts[:Port]}"
|
data/lib/yard/server/router.rb
CHANGED
@@ -2,21 +2,21 @@ module YARD
|
|
2
2
|
module Server
|
3
3
|
# A router class implements the logic used to recognize a request for a specific
|
4
4
|
# URL and run specific {Commands::Base commands}.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# == Subclassing Notes
|
7
7
|
# To create a custom router, subclass this class and pass it into the adapter
|
8
|
-
# options through {Adapter#initialize} or by directly modifying {Adapter#router}.
|
9
|
-
#
|
10
|
-
# The most general customization is to change the URL prefixes recognized by
|
11
|
-
# routing, which can be done by overriding {#docs_prefix}, {#list_prefix}
|
8
|
+
# options through {Adapter#initialize} or by directly modifying {Adapter#router}.
|
9
|
+
#
|
10
|
+
# The most general customization is to change the URL prefixes recognized by
|
11
|
+
# routing, which can be done by overriding {#docs_prefix}, {#list_prefix}
|
12
12
|
# and {#search_prefix}.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# == Implementing Custom Caching
|
15
15
|
# By default, the Router class performs static disk-based caching on all
|
16
16
|
# requests through the +#check_static_cache+. To override this behaviour,
|
17
17
|
# or create your own caching mechanism, mixin your own custom module with
|
18
18
|
# this method implemented as per {StaticCaching#check_static_cache}.
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# @example Creating a subclassed router
|
21
21
|
# # Adds 'my' to all routing prefixes
|
22
22
|
# class MyRouter < YARD::Server::Router
|
@@ -24,29 +24,29 @@ module YARD
|
|
24
24
|
# def list_prefix; 'mylist' end
|
25
25
|
# def search_prefix; 'mysearch' end
|
26
26
|
# end
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# # Using it:
|
29
29
|
# WebrickAdapter.new(libraries, :router => MyRouter).start
|
30
30
|
class Router
|
31
31
|
include StaticCaching
|
32
32
|
include Commands
|
33
|
-
|
33
|
+
|
34
34
|
# @return [Adapter Dependent] the request data coming in with the routing
|
35
35
|
attr_accessor :request
|
36
|
-
|
36
|
+
|
37
37
|
# @return [Adapter] the adapter used by the router
|
38
38
|
attr_accessor :adapter
|
39
|
-
|
39
|
+
|
40
40
|
# Creates a new router for a specific adapter
|
41
|
-
#
|
41
|
+
#
|
42
42
|
# @param [Adapter] adapter the adapter to route requests to
|
43
43
|
def initialize(adapter)
|
44
44
|
self.adapter = adapter
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Perform routing on a specific request, serving the request as a static
|
48
48
|
# file through {Commands::StaticFileCommand} if no route is found.
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# @param [Adapter Dependent] request the request object
|
51
51
|
# @return [Array(Number,Hash,Array)] the Rack-style server response data
|
52
52
|
def call(request)
|
@@ -57,20 +57,20 @@ module YARD
|
|
57
57
|
StaticFileCommand.new(adapter.options).call(request)
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
# @group Route Prefixes
|
62
62
|
|
63
63
|
# @return [String] the URI prefix for all object documentation requests
|
64
64
|
def docs_prefix; 'docs' end
|
65
|
-
|
65
|
+
|
66
66
|
# @return [String] the URI prefix for all class/method/file list requests
|
67
67
|
def list_prefix; 'list' end
|
68
|
-
|
68
|
+
|
69
69
|
# @return [String] the URI prefix for all search requests
|
70
70
|
def search_prefix; 'search' end
|
71
|
-
|
71
|
+
|
72
72
|
# @group Routing Methods
|
73
|
-
|
73
|
+
|
74
74
|
# @return [Array(LibraryVersion, Array<String>)] the library followed
|
75
75
|
# by the rest of the path components in the request path. LibraryVersion
|
76
76
|
# will be nil if no matching library was found.
|
@@ -89,10 +89,10 @@ module YARD
|
|
89
89
|
end
|
90
90
|
|
91
91
|
protected
|
92
|
-
|
92
|
+
|
93
93
|
# Performs routing algorithm to find which prefix is called, first
|
94
94
|
# parsing out library name/version information.
|
95
|
-
#
|
95
|
+
#
|
96
96
|
# @return [Array(Numeric,Hash,Array<String>)] the Rack-style response
|
97
97
|
# @return [nil] if no route is matched
|
98
98
|
def route
|
@@ -112,7 +112,7 @@ module YARD
|
|
112
112
|
end
|
113
113
|
nil
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
# Routes requests from {#docs_prefix} and calls the appropriate command
|
117
117
|
# @param [LibraryVersion] library the library to route for
|
118
118
|
# @param [Array<String>] paths path components (split by '/')
|
@@ -132,7 +132,7 @@ module YARD
|
|
132
132
|
cmd = cmd.new(final_options(library, paths))
|
133
133
|
cmd.call(request)
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
# Routes for the index of a library / multiple libraries
|
137
137
|
# @return (see #route)
|
138
138
|
def route_index
|
@@ -142,7 +142,7 @@ module YARD
|
|
142
142
|
LibraryIndexCommand.new(adapter.options.merge(:path => '')).call(request)
|
143
143
|
end
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
# Routes requests from {#list_prefix} and calls the appropriate command
|
147
147
|
# @param (see #route_docs)
|
148
148
|
# @return (see #route_docs)
|
@@ -156,7 +156,7 @@ module YARD
|
|
156
156
|
end
|
157
157
|
cmd.new(final_options(library, paths)).call(request)
|
158
158
|
end
|
159
|
-
|
159
|
+
|
160
160
|
# Routes requests from {#search_prefix} and calls the appropriate command
|
161
161
|
# @param (see #route_docs)
|
162
162
|
# @return (see #route_docs)
|
@@ -164,12 +164,12 @@ module YARD
|
|
164
164
|
return unless paths.empty?
|
165
165
|
SearchCommand.new(final_options(library, paths)).call(request)
|
166
166
|
end
|
167
|
-
|
167
|
+
|
168
168
|
# @group Utility Methods
|
169
|
-
|
169
|
+
|
170
170
|
# Adds extra :library/:path option keys to the adapter options.
|
171
171
|
# Use this method when passing options to a command.
|
172
|
-
#
|
172
|
+
#
|
173
173
|
# @param (see #route_docs)
|
174
174
|
# @return [Hash] finalized options
|
175
175
|
def final_options(library, paths)
|
@@ -1,31 +1,31 @@
|
|
1
1
|
module YARD
|
2
2
|
module Server
|
3
3
|
# Implements static caching for requests.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# @see Router Router documentation for "Caching"
|
6
6
|
module StaticCaching
|
7
7
|
# Called by a router to return the cached object. By default, this
|
8
8
|
# method performs disk-based caching. To perform other forms of caching,
|
9
9
|
# implement your own +#check_static_cache+ method and mix the module into
|
10
10
|
# the Router class.
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Note that caching does not occur here. This method simply checks for
|
13
13
|
# the existence of cached data. To actually cache a response, see
|
14
14
|
# {Commands::Base#cache}.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# @example Implementing In-Memory Cache Checking
|
17
17
|
# module MemoryCaching
|
18
18
|
# def check_static_cache
|
19
19
|
# # $memory_cache is filled by {Commands::Base#cache}
|
20
20
|
# cached_data = $memory_cache[request.path]
|
21
|
-
# if cached_data
|
21
|
+
# if cached_data
|
22
22
|
# [200, {'Content-Type' => 'text/html'}, [cached_data]]
|
23
23
|
# else
|
24
24
|
# nil
|
25
25
|
# end
|
26
26
|
# end
|
27
27
|
# end
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# class YARD::Server::Router; include MemoryCaching; end
|
30
30
|
# @return [Array(Number,Hash,Array)] the Rack-style response
|
31
31
|
# @return [nil] if no cache is available and routing should continue
|
@@ -8,7 +8,7 @@
|
|
8
8
|
form.search {
|
9
9
|
position: relative;
|
10
10
|
color: #fff;
|
11
|
-
margin-top: 3px; padding: 7px; border: 1px solid #99f; width: 315px; background: #05a;
|
11
|
+
margin-top: 3px; padding: 7px; border: 1px solid #99f; width: 315px; background: #05a;
|
12
12
|
-moz-border-radius: 4px; -webkit-border-radius: 4px;
|
13
13
|
margin-bottom: 10px;
|
14
14
|
}
|
@@ -50,7 +50,7 @@ form.search input { margin-left: 5px; width: 250px; border: 1px solid #99f; -moz
|
|
50
50
|
line-height: 16px;
|
51
51
|
overflow: hidden;
|
52
52
|
|
53
|
-
}
|
53
|
+
}
|
54
54
|
|
55
55
|
.ac_loading {
|
56
56
|
background: white url('/images/loading.gif') right center no-repeat;
|
@@ -69,7 +69,7 @@ form.search input { margin-left: 5px; width: 250px; border: 1px solid #99f; -moz
|
|
69
69
|
}
|
70
70
|
|
71
71
|
#fade { display: none; position: absolute; top: 0px; left: 0; background: #eee; z-index: -1; width: 100%; height: 100%; border-top: 1px solid #e0e0e0; }
|
72
|
-
#processing {
|
72
|
+
#processing {
|
73
73
|
position: absolute; width: 400px; height: 200px; margin: auto; background: #fff; padding: 10px 30px; z-index: 20;
|
74
74
|
-webkit-box-shadow: 0px 0px 20px #444; -moz-box-shadow: 0px 0px 20px #444;
|
75
75
|
-webkit-border-radius: 4px;
|
@@ -14,7 +14,7 @@ function searchFrameLinks() {
|
|
14
14
|
|
15
15
|
function methodPermalinks() {
|
16
16
|
if ($($('#content h1')[0]).text().match(/^Method:/)) return;
|
17
|
-
|
17
|
+
|
18
18
|
$('#method_details .signature, #constructor_details .signature, ' +
|
19
19
|
'.method_details .signature, #method_missing_details .signature').each(function() {
|
20
20
|
var id = this.id;
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<% end %>
|
32
32
|
<% if object.is_a?(CodeObjects::Base) && @file.nil? %>
|
33
33
|
<% unless @single_library %>»<% end %>
|
34
|
-
<a href="/<%= base_path(router.docs_prefix) %>"><% if object.root? || object.type == :method %>Index<% else %>Index (<%= object.name.to_s[0] %>)<% end %></a> »
|
34
|
+
<a href="/<%= base_path(router.docs_prefix) %>"><% if object.root? || object.type == :method %>Index<% else %>Index (<%= object.name.to_s[0] %>)<% end %></a> »
|
35
35
|
<%= @breadcrumb.map {|obj| "<span class='title'>" + linkify(obj, obj.name) + "</span>" }.join(" » ") %>
|
36
36
|
<%= @breadcrumb.size > 0 ? " » " : "" %>
|
37
37
|
<span class='title'><%= object.root? ? "Top Level Namespace" : object.name(true) %></span>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<% if object != '_index.html' %><a href="/<%= base_path(router.docs_prefix) %>">Index</a> » <% end %>
|
41
41
|
<span class='title'><%= @breadcrumb_title %></span>
|
42
42
|
<% end %>
|
43
|
-
|
43
|
+
|
44
44
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
45
45
|
</div>
|
46
46
|
|
@@ -1,11 +1,16 @@
|
|
1
|
-
<meta
|
2
|
-
<title
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
|
2
|
+
<title>
|
3
|
+
<%= h @page_title %>
|
4
|
+
<% if options[:title] && @page_title != options[:title] %>
|
5
|
+
— <%= h options[:title] %>
|
6
|
+
<% end %>
|
7
|
+
</title>
|
8
|
+
<% stylesheets.each do |stylesheet| %>
|
9
|
+
<link rel="stylesheet" href="<%= url_for(stylesheet) %>" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
<% end %>
|
9
11
|
<script type="text/javascript" charset="utf-8">
|
10
12
|
library = '<%= base_path(router.list_prefix) %>';
|
11
13
|
</script>
|
14
|
+
<% javascripts.each do |javascript| %>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="<%= url_for(javascript) %>"></script>
|
16
|
+
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
|
6
6
|
<link rel="stylesheet" href="/css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
7
7
|
<link rel="stylesheet" href="/css/common.css" type="text/css" media="screen" charset="utf-8" />
|
8
8
|
<script type="text/javascript" charset="utf-8" src="/js/jquery.js"></script>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<div id="content">
|
20
20
|
<h1 id="full_list_header"><%= @list_title %></h1>
|
21
21
|
<div id="nav">
|
22
|
-
<a target="_self" href="/<%= base_path(router.list_prefix) %>/class">Classes</a> |
|
22
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/class">Classes</a> |
|
23
23
|
<a target="_self" href="/<%= base_path(router.list_prefix) %>/methods">Methods</a> |
|
24
24
|
<a target="_self" href="/<%= base_path(router.list_prefix) %>/files">Files</a>
|
25
25
|
</div>
|
@@ -2,9 +2,19 @@ include T('default/fulldoc/html')
|
|
2
2
|
|
3
3
|
def init
|
4
4
|
case @list_type.to_sym
|
5
|
-
when :class
|
6
|
-
|
7
|
-
|
5
|
+
when :class
|
6
|
+
generate_class_list
|
7
|
+
@list_title = "Class List"
|
8
|
+
when :methods
|
9
|
+
generate_method_list
|
10
|
+
@list_title = "Method List"
|
11
|
+
when :files
|
12
|
+
generate_file_list
|
13
|
+
@list_title = "File List"
|
8
14
|
end
|
9
15
|
sections :full_list
|
10
|
-
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def asset(file, contents)
|
19
|
+
contents
|
20
|
+
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
<li class="r<%= @row = @row == 1 ? 2 : 1 %>">
|
4
4
|
<% library_versions = library_versions.dup %>
|
5
5
|
<% first_lib = library_versions.pop %>
|
6
|
-
<a href="/<%= router.docs_prefix %>/<%= first_lib %>/frames"><%= name %></a>
|
6
|
+
<a href="/<%= router.docs_prefix %>/<%= first_lib %>/frames"><%= name %></a>
|
7
7
|
<% if first_lib.version %>
|
8
|
-
<small>(<%= first_lib.version %><% if library_versions.size > 0 %>,
|
8
|
+
<small>(<%= first_lib.version %><% if library_versions.size > 0 %>,
|
9
9
|
<%= library_versions.reverse.map {|lib| "<a href=\"/#{router.docs_prefix}/#{lib}/frames\">#{lib.version}</a>" }.join(', ') %><% end %>)</small>
|
10
10
|
<% end %>
|
11
11
|
</li>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<meta
|
1
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
2
2
|
<title>YARD Documentation Server <%= YARD::VERSION %> - Library Listing</title>
|
3
3
|
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" charset="utf-8" />
|
4
4
|
<link rel="stylesheet" href="/css/custom.css" type="text/css" media="screen" charset="utf-8" />
|
@@ -17,7 +17,7 @@
|
|
17
17
|
});
|
18
18
|
})
|
19
19
|
}
|
20
|
-
|
20
|
+
|
21
21
|
$(framesLinks);
|
22
22
|
</script>
|
23
23
|
<style type="text/css" media="screen">
|
@@ -42,7 +42,7 @@
|
|
42
42
|
<div id="processing">
|
43
43
|
<h1>Processing <%= @library.name %></h1>
|
44
44
|
<p>
|
45
|
-
<strong><%= @library.name %></strong> <% if @library.version %>(<%= @library.version %>)<% end %> is being processed.
|
45
|
+
<strong><%= @library.name %></strong> <% if @library.version %>(<%= @library.version %>)<% end %> is being processed.
|
46
46
|
You'll be redirected when the pages are built, it shouldn't take much longer.
|
47
47
|
</p>
|
48
48
|
<img src="/images/processing.gif" align="center" />
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<% name = result.type == :method ? result.name(true).to_s : result.name.to_s %>
|
8
8
|
<% path = name.gsub(/(#{Regexp.quote @query})/i, '<strong>\1</strong>') %>
|
9
9
|
<li class="r<%= n %>">
|
10
|
-
<a href="<%= serializer.serialized_path(result) %>"
|
10
|
+
<a href="<%= serializer.serialized_path(result) %>"
|
11
11
|
title="<%= result.path %>"><%= path %></a>
|
12
12
|
<% if !result.namespace.root? %>
|
13
13
|
<small>(<%= result.namespace.path %>)</small>
|
@@ -18,12 +18,12 @@ module YARD
|
|
18
18
|
# The main WEBrick servlet implementation, accepting only GET requests.
|
19
19
|
class WebrickServlet < WEBrick::HTTPServlet::AbstractServlet
|
20
20
|
attr_accessor :adapter
|
21
|
-
|
21
|
+
|
22
22
|
def initialize(server, adapter)
|
23
23
|
super
|
24
24
|
self.adapter = adapter
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def do_GET(request, response)
|
28
28
|
status, headers, body = *adapter.router.call(request)
|
29
29
|
response.status = status
|