yard 0.9.26 → 0.9.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +104 -8
- data/LEGAL +29 -1
- data/LICENSE +1 -1
- data/README.md +9 -2
- data/docs/Tags.md +1 -1
- data/docs/WhatsNew.md +2 -2
- data/lib/yard/autoload.rb +3 -1
- data/lib/yard/cli/command.rb +1 -1
- data/lib/yard/cli/stats.rb +4 -1
- data/lib/yard/cli/yardoc.rb +5 -3
- data/lib/yard/code_objects/base.rb +5 -1
- data/lib/yard/code_objects/macro_object.rb +0 -1
- data/lib/yard/config.rb +5 -1
- data/lib/yard/docstring_parser.rb +1 -2
- data/lib/yard/handlers/processor.rb +0 -1
- data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/method_handler.rb +2 -2
- data/lib/yard/handlers/ruby/mixin_handler.rb +15 -6
- data/lib/yard/handlers/ruby/module_function_handler.rb +15 -3
- data/lib/yard/handlers/ruby/visibility_handler.rb +13 -1
- data/lib/yard/i18n/locale.rb +1 -1
- data/lib/yard/i18n/message.rb +2 -2
- data/lib/yard/i18n/messages.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +1 -1
- data/lib/yard/logging.rb +116 -61
- data/lib/yard/open_struct.rb +67 -0
- data/lib/yard/options.rb +1 -1
- data/lib/yard/parser/ruby/ast_node.rb +9 -2
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +19 -4
- data/lib/yard/parser/ruby/ruby_parser.rb +9 -3
- data/lib/yard/parser/source_parser.rb +4 -5
- data/lib/yard/registry_resolver.rb +2 -1
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +9 -9
- data/lib/yard/server/commands/static_file_helpers.rb +1 -2
- data/lib/yard/server/http_utils.rb +512 -0
- data/lib/yard/server/rack_adapter.rb +13 -5
- data/lib/yard/tags/default_factory.rb +1 -0
- data/lib/yard/tags/directives.rb +10 -2
- data/lib/yard/tags/tag.rb +3 -2
- data/lib/yard/tags/types_explainer.rb +1 -1
- data/lib/yard/templates/engine.rb +0 -1
- data/lib/yard/templates/helpers/html_helper.rb +5 -2
- data/lib/yard/templates/helpers/markup_helper.rb +2 -1
- data/lib/yard/templates/helpers/method_helper.rb +3 -1
- data/lib/yard/templates/template.rb +3 -1
- data/lib/yard/templates/template_options.rb +0 -1
- data/lib/yard/version.rb +1 -1
- data/lib/yard.rb +6 -0
- data/po/ja.po +19 -19
- data/templates/default/fulldoc/html/css/full_list.css +3 -3
- data/templates/default/fulldoc/html/css/style.css +6 -0
- data/templates/default/fulldoc/html/frames.erb +9 -4
- data/templates/default/fulldoc/html/full_list.erb +5 -2
- data/templates/default/fulldoc/html/js/app.js +294 -264
- data/templates/default/fulldoc/html/js/full_list.js +30 -4
- data/templates/default/fulldoc/html/setup.rb +10 -2
- data/templates/default/layout/html/footer.erb +1 -1
- data/templates/default/onefile/html/headers.erb +2 -0
- data/templates/default/tags/html/example.erb +2 -2
- data/templates/default/tags/html/option.erb +1 -1
- metadata +5 -41
- data/.dockerignore +0 -2
- data/.gitattributes +0 -4
- data/.github/FUNDING.yml +0 -3
- data/.github/ISSUE_TEMPLATE.md +0 -33
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
- data/.github/workflows/ci.yml +0 -42
- data/.github/workflows/gem.yml +0 -27
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.rubocop.yml +0 -112
- data/.travis.yml +0 -49
- data/CODE_OF_CONDUCT.md +0 -15
- data/CONTRIBUTING.md +0 -140
- data/Dockerfile.samus +0 -28
- data/Gemfile +0 -33
- data/Rakefile +0 -39
- data/SECURITY.md +0 -26
- data/benchmarks/builtins_vs_eval.rb +0 -24
- data/benchmarks/concat_vs_join.rb +0 -13
- data/benchmarks/erb_vs_erubis.rb +0 -54
- data/benchmarks/format_args.rb +0 -47
- data/benchmarks/generation.rb +0 -38
- data/benchmarks/marshal_vs_dbm.rb +0 -64
- data/benchmarks/parsing.rb +0 -46
- data/benchmarks/pathname_vs_string.rb +0 -51
- data/benchmarks/rdoc_vs_yardoc.rb +0 -11
- data/benchmarks/registry_store_types.rb +0 -49
- data/benchmarks/ri_vs_yri.rb +0 -19
- data/benchmarks/ripper_parser.rb +0 -13
- data/benchmarks/splat_vs_flatten.rb +0 -13
- data/benchmarks/template_erb.rb +0 -23
- data/benchmarks/template_format.rb +0 -7
- data/benchmarks/template_profile.rb +0 -18
- data/benchmarks/yri_cache.rb +0 -20
- data/samus.json +0 -49
- data/tasks/update_error_map.rake +0 -53
- data/yard.gemspec +0 -23
data/CONTRIBUTING.md
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
# Contributing Guide
|
2
|
-
|
3
|
-
## Help YARD Help You!
|
4
|
-
|
5
|
-
**YARD thrives off of the contributions of its users**. This project will gladly
|
6
|
-
review pull requests and issues. This document outlines how to maximize
|
7
|
-
the chance of a reported issue being resolved or pull request being accepted.
|
8
|
-
|
9
|
-
## Code of Conduct
|
10
|
-
|
11
|
-
**All reported issues, pull requests, communication, and code related to YARD**
|
12
|
-
**must follow the [Code of Conduct][code] or they will be moderated immediately**.
|
13
|
-
Please take time to familiarize yourself with the Code of Conduct before
|
14
|
-
you get started. Fundamentally, **you are expected to behave with respect** to all
|
15
|
-
other users.
|
16
|
-
|
17
|
-
## Filing a Bug Report
|
18
|
-
|
19
|
-
**You can submit bug reports on our [GitHub issue tracker][issues]**.
|
20
|
-
|
21
|
-
If you believe you have found a bug, please include a few things in your report:
|
22
|
-
|
23
|
-
1. **A minimal reproduction of the issue**. Providing a huge blob of code is
|
24
|
-
better than nothing, but providing the shortest possible set of instructions
|
25
|
-
is even better. Take out any instructions or code that, when removed, have
|
26
|
-
no effect on the problematic behavior. The easier your bug is to triage and
|
27
|
-
diagnose, the higher up in the priority list it will go. We can do this stuff,
|
28
|
-
but limited time means this may not happen immediately. Make your bug report
|
29
|
-
extremely accessible and you will almost guarantee a quick fix.
|
30
|
-
|
31
|
-
2. **Your environment and relevant versions**. Please include your Ruby,
|
32
|
-
YARD, and system versions (including OS) when reporting a bug. This
|
33
|
-
makes it easier to diagnose problems. If the issue or stack trace
|
34
|
-
includes another library, consider also listing any dependencies
|
35
|
-
that may be affecting the issue. This is where a minimal reproduction
|
36
|
-
case helps a lot.
|
37
|
-
|
38
|
-
3. **Your expected result**. Tell us what you think should happen. This
|
39
|
-
helps us to understand the context of your problem. Many complex features
|
40
|
-
can contain ambiguous usage, and your use case may differ from the
|
41
|
-
intended one. If we know your expectations, we can more easily determine
|
42
|
-
if the behavior is intentional or not.
|
43
|
-
|
44
|
-
Finally, please **DO NOT** submit a report that states a feature simply
|
45
|
-
_"does not work"_ without any additional information in the report. Consider
|
46
|
-
the issue from the maintainer's perspective: in order to fix your bug, we
|
47
|
-
need to drill down to the broken line of code, and in order to do this,
|
48
|
-
we must be able to reproduce the issue on our end to find that line of
|
49
|
-
code. The easier we can do this, the quicker your bug gets fixed. Help
|
50
|
-
us help you by providing as much information as you possibly can. We may
|
51
|
-
not have the tools or environment to properly diagnose your issue, so
|
52
|
-
your help may be required to debug the issue.
|
53
|
-
|
54
|
-
Also **consider opening a pull request** to fix the issue yourself if you can.
|
55
|
-
This will likely speed up the fix time significantly. See below for
|
56
|
-
information on how to do this.
|
57
|
-
|
58
|
-
## Asking a Question
|
59
|
-
|
60
|
-
**Questions are accepted on [GitHub issues][issues], but consider signing up**
|
61
|
-
**for the [YARD mailing list][ml]** and asking it there so that we can organize
|
62
|
-
issues appropriately. You can also hop onto IRC (irc.freenode.net / #yard)
|
63
|
-
for quick questions.
|
64
|
-
|
65
|
-
## Asking for a Feature
|
66
|
-
|
67
|
-
**YARD does not currently accept feature requests filed as GitHub issues**. If
|
68
|
-
you are looking to have a feature implemented into YARD, consider doing this
|
69
|
-
yourself and [submitting a pull request][pr] (PR) with your work. If the work
|
70
|
-
required is involved, consider starting a discussion on the [mailing list][ml]
|
71
|
-
or opening an issue to ask a question; we will be happy to have a conversation
|
72
|
-
and let you know if the feature would be considered. They usually are, but
|
73
|
-
it might be prudent to ask first!
|
74
|
-
|
75
|
-
Please do not fret if your feature request gets closed immediately. We do this
|
76
|
-
to keep our issue tracker clean. **Closing an issue does not mean it would not**
|
77
|
-
**be accepted as a pull request**. If the feature would not be accepted as a
|
78
|
-
PR, this will be communicated in the closed issue.
|
79
|
-
|
80
|
-
## Making a Change via Pull Request
|
81
|
-
|
82
|
-
**You can also submit pull requests on our [GitHub issue tracker][issues]**.
|
83
|
-
|
84
|
-
If you've been working on a patch or feature that you want in YARD, here are
|
85
|
-
some tips to ensure the quickest turnaround time on getting it merged in:
|
86
|
-
|
87
|
-
1. **Keep your changes small**. If your feature is large, consider splitting
|
88
|
-
it up into smaller portions and submit pull requests for each component
|
89
|
-
individually. Feel free to describe this in your first PR or on the
|
90
|
-
mailing list, but note that it will be much easier to review changes
|
91
|
-
if they affect smaller portions of code at a time.
|
92
|
-
|
93
|
-
2. **Keep commits brief and clean**: YARD uses Git and tries to maintain a
|
94
|
-
clean repository. Please ensure that you use [commit conventions][commit]
|
95
|
-
to make things nice and neat both in the description and commit history.
|
96
|
-
Specifically, consider squashing commits if you have partial or complete
|
97
|
-
reverts of code. Each commit should provide an atomic change that moves
|
98
|
-
the project forwards, not back. Any changes that only fix other parts of
|
99
|
-
your PR should be hidden from the commit history.
|
100
|
-
|
101
|
-
3. **Follow our coding conventions**. YARD uses typical Ruby source formatting,
|
102
|
-
though it occasionally has minor differences with other projects you may
|
103
|
-
have seen. Please look through a few files (at least the file you are
|
104
|
-
editing) to ensure that you are consistent in the formatting your PR is
|
105
|
-
using.
|
106
|
-
|
107
|
-
4. **Make sure you have tests**. Not all changes require tests, but if your
|
108
|
-
changes involve code, you should consider adding at least one new test
|
109
|
-
case for your change (and ideally a couple of tests). This will add
|
110
|
-
confidence when reviewing and will make accepting the change much easier.
|
111
|
-
|
112
|
-
5. **Make sure ALL the tests pass**. YARD has a fairly large suite of tests.
|
113
|
-
Please make sure you can run all of the tests (`bundle exec rake`) prior
|
114
|
-
to submitting your PR. Please also remember that YARD supports a number
|
115
|
-
of environments, including OS X, Linux, Windows, and a number of older
|
116
|
-
Ruby versions (1.8+), so if you can test under these environments, that
|
117
|
-
helps (but is not required). At the very least, be aware of this fact
|
118
|
-
when submitting code.
|
119
|
-
|
120
|
-
If your change is large, consider starting a discussion on the [mailing list][ml]
|
121
|
-
or opening an issue to ask a question; we will be happy to have a conversation
|
122
|
-
and let you know if the feature would be considered. They usually are, but
|
123
|
-
it might be prudent to ask first!
|
124
|
-
|
125
|
-
## Maintainers
|
126
|
-
|
127
|
-
**Interested in helping to maintain YARD? Email [lsegal@soen.ca][mail]** for more
|
128
|
-
information. Offering to be a project maintainer is an important contribution
|
129
|
-
to open source software, and your work will be highly valued in the community.
|
130
|
-
If you have been a contributor, consider being a member of the core team to
|
131
|
-
help handle day-to-day operations, such as releases, bug fixes, and triage.
|
132
|
-
You can do some of this as a non-maintainer too, but if you like this project,
|
133
|
-
we can always use more hands on deck!
|
134
|
-
|
135
|
-
[code]: https://github.com/lsegal/yard/blob/main/CODE_OF_CONDUCT.md
|
136
|
-
[issues]: http://github.com/lsegal/yard/issues
|
137
|
-
[commit]: http://chris.beams.io/posts/git-commit/
|
138
|
-
[pr]: https://help.github.com/articles/using-pull-requests/
|
139
|
-
[ml]: https://groups.google.com/forum/#!forum/yardoc
|
140
|
-
[mail]: mailto:lsegal@soen.ca
|
data/Dockerfile.samus
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
FROM lsegal/samus:latest as samus
|
2
|
-
|
3
|
-
FROM ruby:2
|
4
|
-
ARG VERSION
|
5
|
-
ENV VERSION=${VERSION}
|
6
|
-
WORKDIR /github/lsegal/yard
|
7
|
-
ENTRYPOINT samus publish release-v${VERSION}.tar.gz
|
8
|
-
|
9
|
-
# Prepare credential config
|
10
|
-
RUN mkdir -p ~/.ssh
|
11
|
-
RUN echo "Host *" > ~/.ssh/config
|
12
|
-
RUN echo " StrictHostKeyChecking no" >> ~/.ssh/config
|
13
|
-
RUN chmod 400 ~/.ssh/config
|
14
|
-
COPY ./.samusprep/.samus /root/.samus
|
15
|
-
COPY ./.samusprep/.gitconfig /root/.gitconfig
|
16
|
-
|
17
|
-
# Setup Samus
|
18
|
-
ENV PATH=$PATH:/samus/bin
|
19
|
-
COPY --from=samus /samus /samus
|
20
|
-
|
21
|
-
# Install gems
|
22
|
-
ENV BUNDLE_PATH=/var/gems
|
23
|
-
COPY Gemfile /github/lsegal/yard
|
24
|
-
RUN bundle
|
25
|
-
|
26
|
-
# Run build
|
27
|
-
COPY . /github/lsegal/yard
|
28
|
-
RUN samus build --skip-restore ${VERSION}
|
data/Gemfile
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
source 'https://rubygems.org'
|
3
|
-
|
4
|
-
group :development do
|
5
|
-
gem 'rspec'
|
6
|
-
gem 'rake'
|
7
|
-
gem 'rdoc'
|
8
|
-
gem 'json'
|
9
|
-
gem 'simplecov'
|
10
|
-
gem 'samus', '~> 3.0.9', :require => false
|
11
|
-
gem 'coveralls', :require => false
|
12
|
-
gem 'webrick'
|
13
|
-
end
|
14
|
-
|
15
|
-
group :asciidoc do
|
16
|
-
gem 'asciidoctor'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :markdown do
|
20
|
-
gem 'redcarpet'
|
21
|
-
end
|
22
|
-
|
23
|
-
group :textile do
|
24
|
-
gem 'RedCloth'
|
25
|
-
end
|
26
|
-
|
27
|
-
group :server do
|
28
|
-
gem 'rack'
|
29
|
-
end
|
30
|
-
|
31
|
-
group :i18n do
|
32
|
-
gem 'gettext'
|
33
|
-
end
|
data/Rakefile
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require File.dirname(__FILE__) + '/lib/yard'
|
3
|
-
require File.dirname(__FILE__) + '/lib/yard/rubygems/specification'
|
4
|
-
require 'rbconfig'
|
5
|
-
require 'samus'
|
6
|
-
|
7
|
-
YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']
|
8
|
-
|
9
|
-
Dir['tasks/**/*.rake'].each { |task_file| load task_file }
|
10
|
-
|
11
|
-
desc "Builds the gem"
|
12
|
-
task :gem do
|
13
|
-
sh "gem build yard.gemspec"
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Installs the gem"
|
17
|
-
task :install => :gem do
|
18
|
-
sh "gem install yard-#{YARD::VERSION}.gem --no-document"
|
19
|
-
end
|
20
|
-
|
21
|
-
begin
|
22
|
-
require 'rspec/core/rake_task'
|
23
|
-
RSpec::Core::RakeTask.new(:spec)
|
24
|
-
rescue LoadError
|
25
|
-
nil # noop
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Generate documentation for Yard, and fail if there are any warnings"
|
29
|
-
task :test_doc do
|
30
|
-
sh "ruby bin/yard --fail-on-warning #{"--no-progress" if ENV["CI"]}"
|
31
|
-
end
|
32
|
-
|
33
|
-
task :default => [:spec, :test_doc]
|
34
|
-
|
35
|
-
YARD::Rake::YardocTask.new do |t|
|
36
|
-
t.options += ['--title', "YARD #{YARD::VERSION} Documentation"]
|
37
|
-
end
|
38
|
-
|
39
|
-
Samus::Rake::DockerReleaseTask.new
|
data/SECURITY.md
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# Security Policy
|
2
|
-
|
3
|
-
## Supported Versions
|
4
|
-
|
5
|
-
The following versions are supported with security patches for
|
6
|
-
any reported vulnerabilities in YARD or dependent software.
|
7
|
-
|
8
|
-
| Version | Supported |
|
9
|
-
| ------- | ------------------ |
|
10
|
-
| 0.9.x | :white_check_mark: |
|
11
|
-
| < 0.9 | :x: |
|
12
|
-
|
13
|
-
## Reporting a Vulnerability
|
14
|
-
|
15
|
-
If you've discovered a vulnerability in YARD source code, please email
|
16
|
-
lsegal@soen.ca with as much information as possible. You should typically
|
17
|
-
receive a response within 24-48 hours, though depending on scheduling
|
18
|
-
it may take up to a week to respond. If you do not get a response on
|
19
|
-
your initial email within a few days, please re-send your email or
|
20
|
-
reach out on other channels (such as yardoc@googlegroups.com) to
|
21
|
-
try to get a hold of a maintainer. Please do not include sensitive
|
22
|
-
material if you are reaching out through secondary channels unless
|
23
|
-
you first receive confirmation that it is okay.
|
24
|
-
|
25
|
-
Thank you for your help and cooperation in making YARD a stable and
|
26
|
-
safe piece of software.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'benchmark'
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
|
4
|
-
|
5
|
-
TIMES = (ARGV[0] || 10_000).to_i
|
6
|
-
|
7
|
-
def bench_builtins(name)
|
8
|
-
YARD::CodeObjects::BUILTIN_EXCEPTIONS_HASH.key? name
|
9
|
-
end
|
10
|
-
|
11
|
-
def bench_eval(name)
|
12
|
-
eval(name).is_a?(Class)
|
13
|
-
rescue
|
14
|
-
false
|
15
|
-
end
|
16
|
-
|
17
|
-
Benchmark.bmbm do |b|
|
18
|
-
b.report("builtins PASS") { TIMES.times { YARD::CodeObjects::BUILTIN_EXCEPTIONS.each {|y| bench_builtins(y) } } }
|
19
|
-
b.report("eval PASS") { TIMES.times { YARD::CodeObjects::BUILTIN_EXCEPTIONS.each {|y| bench_eval(y) } } }
|
20
|
-
b.report("builtins FAIL") { TIMES.times { YARD::CodeObjects::BUILTIN_MODULES.each {|y| bench_builtins(y) } } }
|
21
|
-
b.report("eval FAIL") { TIMES.times { YARD::CodeObjects::BUILTIN_MODULES.each {|y| bench_eval(y) } } }
|
22
|
-
b.report("builtins ANY") { TIMES.times { YARD::CodeObjects::BUILTIN_CLASSES.each {|y| bench_builtins(y) } } }
|
23
|
-
b.report("eval ANY") { TIMES.times { YARD::CodeObjects::BUILTIN_CLASSES.each {|y| bench_eval(y) } } }
|
24
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "benchmark"
|
3
|
-
|
4
|
-
STR1 = "Hello"
|
5
|
-
JOIN = "::"
|
6
|
-
STR2 = "World"
|
7
|
-
|
8
|
-
TESTS = 100_000
|
9
|
-
Benchmark.bmbm do |results|
|
10
|
-
results.report("concat") { TESTS.times { "".concat(STR1).concat(JOIN).concat(STR2) } }
|
11
|
-
results.report("add ") { TESTS.times { STR1 + JOIN + STR2 } }
|
12
|
-
results.report("join ") { TESTS.times { [STR1, STR2].join(JOIN) } }
|
13
|
-
end
|
data/benchmarks/erb_vs_erubis.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'rubygems'
|
3
|
-
require 'erubis'
|
4
|
-
require 'erubis/tiny'
|
5
|
-
require 'erb'
|
6
|
-
require "benchmark"
|
7
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
|
8
|
-
|
9
|
-
def rungen
|
10
|
-
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
|
11
|
-
YARD::Registry.at("YARD::CodeObjects::Base").format(:format => :html)
|
12
|
-
end
|
13
|
-
|
14
|
-
Benchmark.bmbm do |x|
|
15
|
-
x.report("erubis") do
|
16
|
-
eval <<-eof
|
17
|
-
module YARD; module Templates; module Template
|
18
|
-
def erb_with(str, x) Erubis::Eruby.new(str) end
|
19
|
-
end end end
|
20
|
-
eof
|
21
|
-
|
22
|
-
rungen
|
23
|
-
end
|
24
|
-
|
25
|
-
x.report("fast-erubis") do
|
26
|
-
eval <<-eof
|
27
|
-
module YARD; module Templates; module Template
|
28
|
-
def erb_with(str, x) Erubis::FastEruby.new(str) end
|
29
|
-
end end end
|
30
|
-
eof
|
31
|
-
|
32
|
-
rungen
|
33
|
-
end
|
34
|
-
|
35
|
-
x.report("tiny-erubis") do
|
36
|
-
eval <<-eof
|
37
|
-
module YARD; module Templates; module Template
|
38
|
-
def erb_with(str, x) Erubis::TinyEruby.new(str) end
|
39
|
-
end end end
|
40
|
-
eof
|
41
|
-
|
42
|
-
rungen
|
43
|
-
end
|
44
|
-
|
45
|
-
x.report("erb") do
|
46
|
-
eval <<-eof
|
47
|
-
module YARD; module Templates; module Template
|
48
|
-
def erb_with(str, x) ERB.new(str) end
|
49
|
-
end end end
|
50
|
-
eof
|
51
|
-
|
52
|
-
rungen
|
53
|
-
end
|
54
|
-
end
|
data/benchmarks/format_args.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "benchmark"
|
3
|
-
require 'lib/yard'
|
4
|
-
|
5
|
-
def format_args_regex(object)
|
6
|
-
if object.signature
|
7
|
-
object.signature[/#{Regexp.quote object.name.to_s}\s*(.*)/, 1]
|
8
|
-
else
|
9
|
-
""
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def format_args_parameters(object)
|
14
|
-
if !object.parameters.empty?
|
15
|
-
args = object.parameters.map {|n, v| v ? "#{n} = #{v}" : n.to_s }.join(", ")
|
16
|
-
"(#{args})"
|
17
|
-
else
|
18
|
-
""
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
YARD::Registry.load
|
23
|
-
$object = YARD::Registry.at('YARD::Generators::Base#G')
|
24
|
-
|
25
|
-
log.puts "regex: " + format_args_regex($object)
|
26
|
-
log.puts "params: " + format_args_parameters($object)
|
27
|
-
log.puts
|
28
|
-
|
29
|
-
TIMES = 100_000
|
30
|
-
Benchmark.bmbm do |x|
|
31
|
-
x.report("regex") { TIMES.times { format_args_regex($object) } }
|
32
|
-
x.report("parameters") { TIMES.times { format_args_parameters($object) } }
|
33
|
-
end
|
34
|
-
|
35
|
-
=begin LAST RUN Jun 23 2008
|
36
|
-
regex: (generator, opts = {})
|
37
|
-
params: (generator, opts = {})
|
38
|
-
|
39
|
-
Rehearsal ----------------------------------------------
|
40
|
-
regex 1.270000 0.020000 1.290000 ( 1.294558)
|
41
|
-
parameters 0.690000 0.000000 0.690000 ( 0.693324)
|
42
|
-
------------------------------------- total: 1.980000sec
|
43
|
-
|
44
|
-
user system total real
|
45
|
-
regex 1.260000 0.010000 1.270000 ( 1.268214)
|
46
|
-
parameters 0.670000 0.000000 0.670000 ( 0.679114)
|
47
|
-
=end
|
data/benchmarks/generation.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "benchmark"
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
|
4
|
-
|
5
|
-
unless YARD::CodeObjects::Proxy.private_instance_methods.include?('to_obj')
|
6
|
-
raise "This benchmark is dependent on YARD::CodeObjects::Proxy#to_obj"
|
7
|
-
end
|
8
|
-
|
9
|
-
def rungen
|
10
|
-
YARD::Registry.clear
|
11
|
-
YARD::CLI::Yardoc.run('--quiet', '--use-cache')
|
12
|
-
end
|
13
|
-
|
14
|
-
def redef(lock = false)
|
15
|
-
eval <<-eof
|
16
|
-
class YARD::CodeObjects::Proxy;
|
17
|
-
def to_obj
|
18
|
-
@obj #{lock ? '||' : ''}= YARD::Registry.resolve(@namespace, @name)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
eof
|
22
|
-
end
|
23
|
-
|
24
|
-
Benchmark.bmbm do |x|
|
25
|
-
x.report("gen-w/o-locking") { redef; rungen }
|
26
|
-
x.report("gen-with-locking") { redef(true); rungen }
|
27
|
-
end
|
28
|
-
|
29
|
-
=begin Results from 2008-06-07
|
30
|
-
Rehearsal ----------------------------------------------------
|
31
|
-
gen-w/o-locking 9.650000 0.450000 10.100000 ( 10.150556)
|
32
|
-
gen-with-locking 7.790000 0.400000 8.190000 ( 8.373811)
|
33
|
-
------------------------------------------ total: 18.290000sec
|
34
|
-
|
35
|
-
user system total real
|
36
|
-
gen-w/o-locking 9.820000 0.430000 10.250000 ( 10.293283)
|
37
|
-
gen-with-locking 7.820000 0.380000 8.200000 ( 8.243326)
|
38
|
-
=end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'benchmark'
|
3
|
-
require 'dbm'
|
4
|
-
|
5
|
-
MARSHAL_FILE = "marshal_test.db"
|
6
|
-
DBM_FILE = "dbm_test"
|
7
|
-
WRITE_TIMES = 1
|
8
|
-
READ_TIMES = 100
|
9
|
-
NUM_INDICES = 10_000
|
10
|
-
INDICES = ['33', '857', '5022', '8555']
|
11
|
-
|
12
|
-
def generate_index
|
13
|
-
'0' * (rand * 4096).floor
|
14
|
-
end
|
15
|
-
|
16
|
-
def write_dbm
|
17
|
-
File.unlink(DBM_FILE + ".db") if File.exist?(DBM_FILE + ".db")
|
18
|
-
handle = DBM.new(DBM_FILE)
|
19
|
-
NUM_INDICES.times {|t| handle[t.to_s] = Marshal.dump(generate_index) }
|
20
|
-
handle.close
|
21
|
-
end
|
22
|
-
|
23
|
-
def read_dbm
|
24
|
-
db = DBM.open(DBM_FILE)
|
25
|
-
INDICES.each {|index| Marshal.load(db[index]) }
|
26
|
-
db.close
|
27
|
-
end
|
28
|
-
|
29
|
-
def write_marshal
|
30
|
-
File.unlink(MARSHAL_FILE) if File.exist?(MARSHAL_FILE)
|
31
|
-
handle = {}
|
32
|
-
NUM_INDICES.times {|t| handle[t.to_s] = generate_index }
|
33
|
-
File.open(MARSHAL_FILE, "wb") {|f| f.write(Marshal.dump(handle)) }
|
34
|
-
end
|
35
|
-
|
36
|
-
def read_marshal
|
37
|
-
db = Marshal.load(File.read(MARSHAL_FILE))
|
38
|
-
INDICES.each {|index| db[index] }
|
39
|
-
end
|
40
|
-
|
41
|
-
Benchmark.bmbm do |x|
|
42
|
-
x.report("marshal-write") { WRITE_TIMES.times { write_marshal } }
|
43
|
-
x.report("dbm-write") { WRITE_TIMES.times { write_dbm } }
|
44
|
-
x.report("marshal-read ") { READ_TIMES.times { read_marshal } }
|
45
|
-
x.report("dbm-read ") { READ_TIMES.times { read_dbm } }
|
46
|
-
end
|
47
|
-
|
48
|
-
File.unlink(MARSHAL_FILE)
|
49
|
-
File.unlink(DBM_FILE + ".db")
|
50
|
-
|
51
|
-
__END__
|
52
|
-
|
53
|
-
Rehearsal -------------------------------------------------
|
54
|
-
marshal-write 0.090000 0.070000 0.160000 ( 0.465820)
|
55
|
-
dbm-write 0.560000 0.570000 1.130000 ( 3.045556)
|
56
|
-
marshal-read 4.640000 3.180000 7.820000 ( 7.821978)
|
57
|
-
dbm-read 0.020000 0.020000 0.040000 ( 0.070920)
|
58
|
-
---------------------------------------- total: 9.150000sec
|
59
|
-
|
60
|
-
user system total real
|
61
|
-
marshal-write 0.080000 0.050000 0.130000 ( 0.436561)
|
62
|
-
dbm-write 0.560000 0.550000 1.110000 ( 2.030530)
|
63
|
-
marshal-read 4.670000 3.180000 7.850000 ( 7.842232)
|
64
|
-
dbm-read 0.010000 0.020000 0.030000 ( 0.053928)
|
data/benchmarks/parsing.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "benchmark"
|
3
|
-
require 'yard'
|
4
|
-
require 'logger'
|
5
|
-
|
6
|
-
PATH_ORDER = [
|
7
|
-
'lib/yard/autoload.rb',
|
8
|
-
'lib/yard/code_objects/base.rb',
|
9
|
-
'lib/yard/code_objects/namespace_object.rb',
|
10
|
-
'lib/yard/handlers/base.rb',
|
11
|
-
'lib/yard/generators/helpers/*.rb',
|
12
|
-
'lib/yard/generators/base.rb',
|
13
|
-
'lib/yard/generators/method_listing_generator.rb',
|
14
|
-
'lib/yard/serializers/base.rb',
|
15
|
-
'lib/**/*.rb'
|
16
|
-
]
|
17
|
-
|
18
|
-
Benchmark.bmbm do |x|
|
19
|
-
x.report("parse in order") { YARD::Registry.clear; YARD.parse PATH_ORDER, [], Logger::ERROR }
|
20
|
-
x.report("parse") { YARD::Registry.clear; YARD.parse 'lib/**/*.rb', [], Logger::ERROR }
|
21
|
-
end
|
22
|
-
|
23
|
-
=begin
|
24
|
-
load_order branch (2008-06-07):
|
25
|
-
|
26
|
-
Rehearsal --------------------------------------------------
|
27
|
-
parse in order 6.510000 0.050000 6.560000 ( 6.563223)
|
28
|
-
parse 6.300000 0.040000 6.340000 ( 6.362272)
|
29
|
-
---------------------------------------- total: 12.900000sec
|
30
|
-
|
31
|
-
user system total real
|
32
|
-
parse in order 6.310000 0.060000 6.370000 ( 6.390945)
|
33
|
-
parse 6.300000 0.050000 6.350000 ( 6.366709)
|
34
|
-
|
35
|
-
|
36
|
-
api_changes branch before merge (2008-06-07)
|
37
|
-
|
38
|
-
Rehearsal --------------------------------------------------
|
39
|
-
parse in order 6.330000 0.050000 6.380000 ( 6.397552)
|
40
|
-
parse 6.380000 0.050000 6.430000 ( 6.446954)
|
41
|
-
---------------------------------------- total: 12.810000sec
|
42
|
-
|
43
|
-
user system total real
|
44
|
-
parse in order 6.320000 0.040000 6.360000 ( 6.394460)
|
45
|
-
parse 6.040000 0.040000 6.080000 ( 6.099738)
|
46
|
-
=end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'pathname'
|
3
|
-
require "benchmark"
|
4
|
-
require File.dirname(__FILE__) + '/../lib/yard'
|
5
|
-
|
6
|
-
pathobj = Pathname.new("a/b/c")
|
7
|
-
strobj = "a/b/c"
|
8
|
-
|
9
|
-
TIMES = 1_000
|
10
|
-
|
11
|
-
log.puts "join:"
|
12
|
-
Benchmark.bmbm do |x|
|
13
|
-
x.report("pathname") { TIMES.times { Pathname.new("a/b/c").join("d", "e", "f") } }
|
14
|
-
x.report("string ") { TIMES.times { File.join("a/b/c", "d", "e", "f") } }
|
15
|
-
x.report("pathname-sameobject") { TIMES.times { pathobj.join("d", "e", "f") } }
|
16
|
-
x.report("string-sameobject ") { TIMES.times { File.join(strobj, "d", "e", "f") } }
|
17
|
-
end
|
18
|
-
|
19
|
-
log.puts
|
20
|
-
log.puts
|
21
|
-
log.puts "cleanpath:"
|
22
|
-
Benchmark.bmbm do |x|
|
23
|
-
x.report("pathname") { TIMES.times { Pathname.new("a/b//.././c").cleanpath } }
|
24
|
-
x.report("string ") { TIMES.times { File.cleanpath("a/b//.././c") } }
|
25
|
-
end
|
26
|
-
|
27
|
-
__END__
|
28
|
-
join:
|
29
|
-
Rehearsal -------------------------------------------------------
|
30
|
-
pathname 0.330000 0.020000 0.350000 ( 0.353481)
|
31
|
-
string 0.010000 0.000000 0.010000 ( 0.001390)
|
32
|
-
pathname-sameobject 0.360000 0.020000 0.380000 ( 0.384473)
|
33
|
-
string-sameobject 0.000000 0.000000 0.000000 ( 0.001187)
|
34
|
-
---------------------------------------------- total: 0.740000sec
|
35
|
-
|
36
|
-
user system total real
|
37
|
-
pathname 0.330000 0.020000 0.350000 ( 0.350820)
|
38
|
-
string 0.000000 0.000000 0.000000 ( 0.001055)
|
39
|
-
pathname-sameobject 0.330000 0.010000 0.340000 ( 0.346949)
|
40
|
-
string-sameobject 0.000000 0.000000 0.000000 ( 0.001141)
|
41
|
-
|
42
|
-
|
43
|
-
cleanpath:
|
44
|
-
Rehearsal --------------------------------------------
|
45
|
-
pathname 0.060000 0.000000 0.060000 ( 0.059767)
|
46
|
-
string 0.010000 0.000000 0.010000 ( 0.013775)
|
47
|
-
----------------------------------- total: 0.070000sec
|
48
|
-
|
49
|
-
user system total real
|
50
|
-
pathname 0.060000 0.000000 0.060000 ( 0.059697)
|
51
|
-
string 0.020000 0.000000 0.020000 ( 0.013624)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "benchmark"
|
3
|
-
|
4
|
-
files = Dir.glob(File.dirname(__FILE__) + '/../lib/**/*.rb').join(" ")
|
5
|
-
Benchmark.bmbm do |x|
|
6
|
-
x.report("rdoc") { `rm -rf rdoc && rdoc -q -o rdoc #{files} && rm -rf rdoc` }
|
7
|
-
x.report("yardoc") { `rm -rf yard && ./bin/yardoc -q -o yard #{files} && rm -rf yard` }
|
8
|
-
x.report("yardoc-cached") { `rm -rf yard && ./bin/yardoc -c -q -o yard #{files} && rm -rf yard` }
|
9
|
-
x.report("yardoc-legacy") { `rm -rf yard && ./bin/yardoc --legacy -q -o yard #{files} && rm -rf yard` }
|
10
|
-
x.report("yardoc-legacy-cached") { `rm -rf yard && ./bin/yardoc --legacy -c -q -o yard #{files} && rm -rf yard` }
|
11
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'benchmark'
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
|
4
|
-
|
5
|
-
def parse_and_select_objects
|
6
|
-
YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
|
7
|
-
YARD::Registry.load_all
|
8
|
-
$paths = []
|
9
|
-
4.times { $paths << YARD::Registry.paths[rand(YARD::Registry.paths.size)] }
|
10
|
-
|
11
|
-
$regular_registry = {}
|
12
|
-
$types_registry = {}
|
13
|
-
YARD::Registry.all.each do |object|
|
14
|
-
$regular_registry[object.path] = object
|
15
|
-
($types_registry[object.type] ||= {})[object.path] = object
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def run_lookup
|
20
|
-
$paths.select {|path| $regular_registry[path] }
|
21
|
-
end
|
22
|
-
|
23
|
-
def run_lookup_with_types
|
24
|
-
$paths.select {|path| $types_registry.values.find {|list| list[path] } }
|
25
|
-
end
|
26
|
-
|
27
|
-
TIMES = 100_000
|
28
|
-
|
29
|
-
parse_and_select_objects
|
30
|
-
p $paths
|
31
|
-
Benchmark.bmbm do |x|
|
32
|
-
x.report("normal") { TIMES.times { run_lookup } }
|
33
|
-
x.report("types") { TIMES.times { run_lookup_with_types } }
|
34
|
-
end
|
35
|
-
|
36
|
-
__END__
|
37
|
-
# Run on March 22 2012
|
38
|
-
["YARD::Parser::Ruby::Legacy::RubyToken::TkUnknownChar#initialize",
|
39
|
-
"YARD::Parser::C::CParser#enumerator",
|
40
|
-
"YARD::CodeObjects::ClassObject#inherited_meths",
|
41
|
-
"YARD::Parser::C::Statement#source="]
|
42
|
-
Rehearsal ----------------------------------------------
|
43
|
-
normal 0.180000 0.000000 0.180000 ( 0.182640)
|
44
|
-
types 1.150000 0.010000 1.160000 ( 1.160219)
|
45
|
-
------------------------------------- total: 1.340000sec
|
46
|
-
|
47
|
-
user system total real
|
48
|
-
normal 0.170000 0.000000 0.170000 ( 0.165621)
|
49
|
-
types 1.140000 0.000000 1.140000 ( 1.142269)
|