yard 0.9.26 → 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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +104 -8
  3. data/LEGAL +29 -1
  4. data/LICENSE +1 -1
  5. data/README.md +9 -2
  6. data/docs/Tags.md +1 -1
  7. data/docs/WhatsNew.md +2 -2
  8. data/lib/yard/autoload.rb +3 -1
  9. data/lib/yard/cli/command.rb +1 -1
  10. data/lib/yard/cli/stats.rb +4 -1
  11. data/lib/yard/cli/yardoc.rb +5 -3
  12. data/lib/yard/code_objects/base.rb +5 -1
  13. data/lib/yard/code_objects/macro_object.rb +0 -1
  14. data/lib/yard/config.rb +5 -1
  15. data/lib/yard/docstring_parser.rb +1 -2
  16. data/lib/yard/handlers/processor.rb +0 -1
  17. data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
  18. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
  19. data/lib/yard/handlers/ruby/method_handler.rb +2 -2
  20. data/lib/yard/handlers/ruby/mixin_handler.rb +15 -6
  21. data/lib/yard/handlers/ruby/module_function_handler.rb +15 -3
  22. data/lib/yard/handlers/ruby/visibility_handler.rb +13 -1
  23. data/lib/yard/i18n/locale.rb +1 -1
  24. data/lib/yard/i18n/message.rb +2 -2
  25. data/lib/yard/i18n/messages.rb +1 -1
  26. data/lib/yard/i18n/pot_generator.rb +1 -1
  27. data/lib/yard/logging.rb +116 -61
  28. data/lib/yard/open_struct.rb +67 -0
  29. data/lib/yard/options.rb +1 -1
  30. data/lib/yard/parser/ruby/ast_node.rb +9 -2
  31. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +19 -4
  32. data/lib/yard/parser/ruby/ruby_parser.rb +9 -3
  33. data/lib/yard/parser/source_parser.rb +4 -5
  34. data/lib/yard/registry_resolver.rb +2 -1
  35. data/lib/yard/server/commands/base.rb +1 -1
  36. data/lib/yard/server/commands/library_command.rb +9 -9
  37. data/lib/yard/server/commands/static_file_helpers.rb +1 -2
  38. data/lib/yard/server/http_utils.rb +512 -0
  39. data/lib/yard/server/rack_adapter.rb +13 -5
  40. data/lib/yard/tags/default_factory.rb +1 -0
  41. data/lib/yard/tags/directives.rb +10 -2
  42. data/lib/yard/tags/tag.rb +3 -2
  43. data/lib/yard/tags/types_explainer.rb +1 -1
  44. data/lib/yard/templates/engine.rb +0 -1
  45. data/lib/yard/templates/helpers/html_helper.rb +5 -2
  46. data/lib/yard/templates/helpers/markup_helper.rb +2 -1
  47. data/lib/yard/templates/helpers/method_helper.rb +3 -1
  48. data/lib/yard/templates/template.rb +3 -1
  49. data/lib/yard/templates/template_options.rb +0 -1
  50. data/lib/yard/version.rb +1 -1
  51. data/lib/yard.rb +6 -0
  52. data/po/ja.po +19 -19
  53. data/templates/default/fulldoc/html/css/full_list.css +3 -3
  54. data/templates/default/fulldoc/html/css/style.css +6 -0
  55. data/templates/default/fulldoc/html/frames.erb +9 -4
  56. data/templates/default/fulldoc/html/full_list.erb +5 -2
  57. data/templates/default/fulldoc/html/js/app.js +294 -264
  58. data/templates/default/fulldoc/html/js/full_list.js +30 -4
  59. data/templates/default/fulldoc/html/setup.rb +10 -2
  60. data/templates/default/layout/html/footer.erb +1 -1
  61. data/templates/default/onefile/html/headers.erb +2 -0
  62. data/templates/default/tags/html/example.erb +2 -2
  63. data/templates/default/tags/html/option.erb +1 -1
  64. metadata +5 -41
  65. data/.dockerignore +0 -2
  66. data/.gitattributes +0 -4
  67. data/.github/FUNDING.yml +0 -3
  68. data/.github/ISSUE_TEMPLATE.md +0 -33
  69. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  70. data/.github/workflows/ci.yml +0 -42
  71. data/.github/workflows/gem.yml +0 -27
  72. data/.gitignore +0 -14
  73. data/.rspec +0 -2
  74. data/.rubocop.yml +0 -112
  75. data/.travis.yml +0 -49
  76. data/CODE_OF_CONDUCT.md +0 -15
  77. data/CONTRIBUTING.md +0 -140
  78. data/Dockerfile.samus +0 -28
  79. data/Gemfile +0 -33
  80. data/Rakefile +0 -39
  81. data/SECURITY.md +0 -26
  82. data/benchmarks/builtins_vs_eval.rb +0 -24
  83. data/benchmarks/concat_vs_join.rb +0 -13
  84. data/benchmarks/erb_vs_erubis.rb +0 -54
  85. data/benchmarks/format_args.rb +0 -47
  86. data/benchmarks/generation.rb +0 -38
  87. data/benchmarks/marshal_vs_dbm.rb +0 -64
  88. data/benchmarks/parsing.rb +0 -46
  89. data/benchmarks/pathname_vs_string.rb +0 -51
  90. data/benchmarks/rdoc_vs_yardoc.rb +0 -11
  91. data/benchmarks/registry_store_types.rb +0 -49
  92. data/benchmarks/ri_vs_yri.rb +0 -19
  93. data/benchmarks/ripper_parser.rb +0 -13
  94. data/benchmarks/splat_vs_flatten.rb +0 -13
  95. data/benchmarks/template_erb.rb +0 -23
  96. data/benchmarks/template_format.rb +0 -7
  97. data/benchmarks/template_profile.rb +0 -18
  98. data/benchmarks/yri_cache.rb +0 -20
  99. data/samus.json +0 -49
  100. data/tasks/update_error_map.rake +0 -53
  101. data/yard.gemspec +0 -23
@@ -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
- }
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Script to generate the Error class name map in:
4
- # lib/yard/handlers/c/base.rb
5
-
6
- require 'open-uri'
7
- require 'stringio'
8
-
9
- desc 'Update the error class names map'
10
- task :update_error_map do
11
-
12
- ERROR_C_URL = 'https://raw.githubusercontent.com/ruby/ruby/master/error.c'
13
-
14
- INIT_MATCH = /void\s+Init_Exception\(void\)\s*\{(.+?)^\}/m
15
- NAME_MATCH = /(\w+)\s*=\s*rb_define_class\("([^"]+)"/
16
-
17
- $stderr.puts "Downloading #{ERROR_C_URL} ..."
18
- content = open(ERROR_C_URL) { |io| io.read }
19
-
20
- $stderr.puts "Extracting class names ..."
21
- init_source = content.match(INIT_MATCH).captures.first
22
- map = init_source.scan(NAME_MATCH).sort_by { |key, value| key }
23
-
24
- $stderr.puts "Generating new lookup table ..."
25
- indent = ' ' * 4
26
- source = StringIO.new
27
- source.puts "#{indent}ERROR_CLASS_NAMES = {"
28
- map.each do |variable, name|
29
- source.puts "#{indent} '#{variable}' => '#{name}',"
30
- end
31
- source.puts "#{indent}}"
32
-
33
- $stderr.puts source.string
34
-
35
- $stderr.puts "Patching 'lib/yard/handlers/c/base.rb' ..."
36
- CLASS_NAME_MAP_MATCH = /^\s+ERROR_CLASS_NAMES = {[^}]+}/
37
-
38
- PROJECT_PATH = File.expand_path('..', __dir__)
39
- C_BASE_HANDLER = File.join(PROJECT_PATH, 'lib/yard/handlers/c/base.rb')
40
-
41
- File.open(C_BASE_HANDLER, 'r+') { |file|
42
- content = file.read
43
- # .rstrip is added to avoid adding new empty lines due to the new lines
44
- # added by `.puts` when building the string.
45
- content.gsub!(CLASS_NAME_MAP_MATCH, source.string.rstrip)
46
- file.rewind
47
- file.truncate(0)
48
- file.write(content)
49
- }
50
-
51
- $stderr.puts "Done!"
52
-
53
- end
data/yard.gemspec DELETED
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- require File.expand_path('../lib/yard/version', __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "yard"
6
- s.summary = "Documentation tool for consistent and usable documentation in Ruby."
7
- s.description = <<-eof
8
- YARD is a documentation generation tool for the Ruby programming language.
9
- It enables the user to generate consistent, usable documentation that can be
10
- exported to a number of formats very easily, and also supports extending for
11
- custom Ruby constructs such as custom class level definitions.
12
- eof
13
- s.version = YARD::VERSION
14
- s.author = "Loren Segal"
15
- s.email = "lsegal@soen.ca"
16
- s.homepage = "http://yardoc.org"
17
- s.platform = Gem::Platform::RUBY
18
- s.files = `git ls-files`.strip.split(/\s+/).reject {|f| f.match(%r{^spec/}) }
19
- s.require_paths = ['lib']
20
- s.executables = ['yard', 'yardoc', 'yri']
21
- s.license = 'MIT' if s.respond_to?(:license=)
22
- s.metadata['yard.run'] = 'yri'
23
- end