yard 0.9.28 → 0.9.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/LEGAL +29 -1
  4. data/README.md +8 -1
  5. data/docs/Tags.md +1 -1
  6. data/docs/WhatsNew.md +2 -2
  7. data/lib/yard/autoload.rb +3 -1
  8. data/lib/yard/cli/command.rb +1 -1
  9. data/lib/yard/cli/yardoc.rb +1 -1
  10. data/lib/yard/code_objects/base.rb +5 -1
  11. data/lib/yard/code_objects/macro_object.rb +0 -1
  12. data/lib/yard/docstring_parser.rb +1 -2
  13. data/lib/yard/handlers/processor.rb +0 -1
  14. data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
  15. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
  16. data/lib/yard/handlers/ruby/mixin_handler.rb +13 -6
  17. data/lib/yard/handlers/ruby/visibility_handler.rb +13 -1
  18. data/lib/yard/i18n/locale.rb +1 -1
  19. data/lib/yard/i18n/message.rb +2 -2
  20. data/lib/yard/i18n/messages.rb +1 -1
  21. data/lib/yard/i18n/pot_generator.rb +1 -1
  22. data/lib/yard/logging.rb +116 -61
  23. data/lib/yard/open_struct.rb +67 -0
  24. data/lib/yard/options.rb +1 -1
  25. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +19 -4
  26. data/lib/yard/parser/ruby/ruby_parser.rb +8 -2
  27. data/lib/yard/parser/source_parser.rb +4 -5
  28. data/lib/yard/registry_resolver.rb +2 -1
  29. data/lib/yard/server/commands/base.rb +1 -1
  30. data/lib/yard/server/commands/library_command.rb +8 -8
  31. data/lib/yard/server/commands/static_file_helpers.rb +1 -2
  32. data/lib/yard/server/http_utils.rb +512 -0
  33. data/lib/yard/server/rack_adapter.rb +13 -5
  34. data/lib/yard/tags/default_factory.rb +1 -0
  35. data/lib/yard/tags/directives.rb +0 -1
  36. data/lib/yard/tags/tag.rb +3 -2
  37. data/lib/yard/tags/types_explainer.rb +1 -1
  38. data/lib/yard/templates/engine.rb +0 -1
  39. data/lib/yard/templates/helpers/html_helper.rb +1 -1
  40. data/lib/yard/templates/template_options.rb +0 -1
  41. data/lib/yard/version.rb +1 -1
  42. data/po/ja.po +19 -19
  43. data/templates/default/fulldoc/html/css/full_list.css +3 -3
  44. data/templates/default/fulldoc/html/css/style.css +6 -0
  45. data/templates/default/fulldoc/html/frames.erb +9 -4
  46. data/templates/default/fulldoc/html/full_list.erb +5 -2
  47. data/templates/default/fulldoc/html/js/app.js +294 -264
  48. data/templates/default/fulldoc/html/js/full_list.js +30 -4
  49. data/templates/default/fulldoc/html/setup.rb +10 -2
  50. data/templates/default/onefile/html/headers.erb +2 -0
  51. data/templates/default/tags/html/example.erb +2 -2
  52. data/templates/default/tags/html/option.erb +1 -1
  53. metadata +6 -55
  54. data/.dockerignore +0 -2
  55. data/.gitattributes +0 -4
  56. data/.github/FUNDING.yml +0 -3
  57. data/.github/ISSUE_TEMPLATE.md +0 -33
  58. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  59. data/.github/workflows/ci.yml +0 -30
  60. data/.github/workflows/gem.yml +0 -19
  61. data/.gitignore +0 -14
  62. data/.rspec +0 -2
  63. data/.rubocop.yml +0 -112
  64. data/CODE_OF_CONDUCT.md +0 -15
  65. data/CONTRIBUTING.md +0 -140
  66. data/Dockerfile.samus +0 -28
  67. data/Gemfile +0 -34
  68. data/Rakefile +0 -36
  69. data/SECURITY.md +0 -26
  70. data/benchmarks/builtins_vs_eval.rb +0 -24
  71. data/benchmarks/concat_vs_join.rb +0 -13
  72. data/benchmarks/erb_vs_erubis.rb +0 -54
  73. data/benchmarks/format_args.rb +0 -47
  74. data/benchmarks/generation.rb +0 -38
  75. data/benchmarks/marshal_vs_dbm.rb +0 -64
  76. data/benchmarks/parsing.rb +0 -46
  77. data/benchmarks/pathname_vs_string.rb +0 -51
  78. data/benchmarks/rdoc_vs_yardoc.rb +0 -11
  79. data/benchmarks/registry_store_types.rb +0 -49
  80. data/benchmarks/ri_vs_yri.rb +0 -19
  81. data/benchmarks/ripper_parser.rb +0 -13
  82. data/benchmarks/splat_vs_flatten.rb +0 -13
  83. data/benchmarks/template_erb.rb +0 -23
  84. data/benchmarks/template_format.rb +0 -7
  85. data/benchmarks/template_profile.rb +0 -18
  86. data/benchmarks/yri_cache.rb +0 -20
  87. data/samus.json +0 -49
  88. data/tasks/prepare_tag.rake +0 -45
  89. data/tasks/update_error_map.rake +0 -53
  90. data/yard.gemspec +0 -25
data/Gemfile DELETED
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- source 'https://rubygems.org'
3
-
4
- group :development do
5
- gem 'rspec', '>= 3.11.0'
6
- gem 'rake'
7
- gem 'rdoc'
8
- gem 'json'
9
- gem 'simplecov'
10
- gem 'samus', '~> 3.0.9', :require => false
11
- gem 'coveralls_reborn', :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
- gem 'commonmarker'
22
- end
23
-
24
- group :textile do
25
- gem 'RedCloth'
26
- end
27
-
28
- group :server do
29
- gem 'rack'
30
- end
31
-
32
- group :i18n do
33
- gem 'gettext'
34
- end
data/Rakefile DELETED
@@ -1,36 +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
-
6
- YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']
7
-
8
- Dir['tasks/**/*.rake'].each { |task_file| load task_file }
9
-
10
- desc "Builds the gem"
11
- task :gem do
12
- sh "gem build yard.gemspec"
13
- end
14
-
15
- desc "Installs the gem"
16
- task :install => :gem do
17
- sh "gem install yard-#{YARD::VERSION}.gem --no-document"
18
- end
19
-
20
- begin
21
- require 'rspec/core/rake_task'
22
- RSpec::Core::RakeTask.new(:spec)
23
- rescue LoadError
24
- nil # noop
25
- end
26
-
27
- desc "Generate documentation for Yard, and fail if there are any warnings"
28
- task :test_doc do
29
- sh "ruby bin/yard --fail-on-warning #{"--no-progress" if ENV["CI"]}"
30
- end
31
-
32
- task :default => [:spec, :test_doc]
33
-
34
- YARD::Rake::YardocTask.new do |t|
35
- t.options += ['--title', "YARD #{YARD::VERSION} Documentation"]
36
- end
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
@@ -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
@@ -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
@@ -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)
@@ -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)
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
- require "benchmark"
3
-
4
- TIMES = 10
5
- Benchmark.bmbm do |x|
6
- x.report("ri") { TIMES.times { `ri -T YARD::Tags::Library` } }
7
- x.report("yri") { TIMES.times { `./bin/yri -T YARD::Tags::Library` } }
8
- end
9
-
10
- __END__
11
-
12
- Rehearsal ---------------------------------------
13
- ri 0.000000 0.020000 6.880000 ( 6.929591)
14
- yri 0.000000 0.000000 1.060000 ( 1.074840)
15
- ------------------------------ total: 7.940000sec
16
-
17
- user system total real
18
- ri 0.000000 0.020000 6.850000 ( 6.871660)
19
- yri 0.000000 0.010000 1.060000 ( 1.067585)
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: true
3
- require 'benchmark'
4
- require File.dirname(__FILE__) + '/../lib/yard'
5
-
6
- $files = Dir[File.dirname(__FILE__) + '/../lib/**/*.rb'].map {|f| File.read(f) }
7
- $files_rip = Dir[File.dirname(__FILE__) + '/../lib/**/*.rb'].map {|f| [File.read(f), f] }
8
-
9
- TIMES = 2
10
- Benchmark.bmbm do |x|
11
- x.report("rip-parser") { TIMES.times { $files_rip.each {|f| YARD::Parser::Ruby::RubyParser.parse(*f) } } }
12
- x.report("yard-parser ") { TIMES.times { $files.each {|f| YARD::Parser::Ruby::Legacy::StatementList.new(f) } } }
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
- require "benchmark"
3
-
4
- # To prove that flattening a small list is not significantly slower than
5
- # calling *list (used to get around create_tag list issue)
6
- $a = "FOO BAR BAZ"
7
- def foo(*args) args.last.inspect end
8
-
9
- TESTS = 10_000
10
- Benchmark.bmbm do |x|
11
- x.report("splat") { TESTS.times { foo(*$a) } }
12
- x.report("flatten") { TESTS.times { foo(*[$a].flatten) } }
13
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- require "benchmark"
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
4
-
5
- YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
6
- obj = YARD::Registry.at("YARD::CodeObjects::Base")
7
-
8
- TIMES = 3
9
- Benchmark.bm do |x|
10
- x.report("trim-line") { TIMES.times { obj.format(:format => :html) } }
11
- module YARD
12
- module Templates
13
- module Template
14
- def erb(section, &block)
15
- erb = ERB.new(cache(section))
16
- erb.filename = cache_filename(section).to_s
17
- erb.result(binding, &block)
18
- end
19
- end
20
- end
21
- end
22
- x.report("no-trim ") { TIMES.times { obj.format(:format => :html) } }
23
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
- require "benchmark"
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
4
-
5
- YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
6
- obj = YARD::Registry.at("YARD::CodeObjects::Base")
7
- log.puts Benchmark.measure { obj.format(:format => :html) }
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'ruby-prof'
4
- # require 'benchmark'
5
- require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')
6
-
7
- YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
8
- obj = YARD::Registry.at("YARD::CodeObjects::Base")
9
-
10
- # PerfTools::CpuProfiler.start("template_profile") do
11
- # end
12
-
13
- result = RubyProf.profile do
14
- obj.format(:format => :html, :no_highlight => true)
15
- end
16
-
17
- printer = RubyProf::CallTreePrinter.new(result)
18
- printer.print(STDOUT)
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- require File.dirname(__FILE__) + "/../lib/yard"
3
- require "benchmark"
4
- include YARD::CLI
5
-
6
- class YARD::CLI::YRI
7
- def print_object(object) end
8
- end
9
-
10
- def remove_cache
11
- File.unlink(YRI::CACHE_FILE)
12
- end
13
-
14
- TIMES = 10
15
- NAME = 'YARD'
16
- remove_cache; YRI.run(NAME)
17
- Benchmark.bmbm do |x|
18
- x.report("cache ") { TIMES.times { YRI.run(NAME) } }
19
- x.report("no-cache") { TIMES.times { remove_cache; YRI.run(NAME) } }
20
- end
data/samus.json DELETED
@@ -1,49 +0,0 @@
1
- {
2
- "actions": [
3
- {
4
- "action": "fs-sedfiles",
5
- "files": [
6
- "lib/*/version.rb"
7
- ],
8
- "arguments": {
9
- "search": "VERSION = ['\"](.+?)['\"]",
10
- "replace": "VERSION = '$version'"
11
- }
12
- },
13
- {
14
- "action": "chmod-files",
15
- "files": [
16
- "**/*,644",
17
- "bin/*,755"
18
- ]
19
- },
20
- {
21
- "action": "changelog-rotate",
22
- "files": [
23
- "CHANGELOG.md"
24
- ],
25
- "arguments": {
26
- "title_format": "$version - %B %-d$day_nth, %Y"
27
- }
28
- },
29
- {
30
- "action": "git-commit",
31
- "files": [
32
- "CHANGELOG.md",
33
- "lib/*/version.rb"
34
- ]
35
- },
36
- {
37
- "action": "git-merge",
38
- "arguments": {
39
- "branch": "main"
40
- }
41
- },
42
- {
43
- "action": "ruby-bundle"
44
- },
45
- {
46
- "action": "rake-task"
47
- }
48
- ]
49
- }