yard 0.9.27 → 0.9.35

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.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -9
  3. data/LEGAL +29 -1
  4. data/LICENSE +1 -1
  5. data/docs/WhatsNew.md +2 -2
  6. data/lib/yard/autoload.rb +2 -1
  7. data/lib/yard/cli/command.rb +1 -1
  8. data/lib/yard/cli/stats.rb +2 -1
  9. data/lib/yard/cli/yardoc.rb +3 -2
  10. data/lib/yard/code_objects/base.rb +5 -1
  11. data/lib/yard/config.rb +5 -1
  12. data/lib/yard/docstring_parser.rb +1 -1
  13. data/lib/yard/handlers/ruby/attribute_handler.rb +1 -1
  14. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
  15. data/lib/yard/handlers/ruby/method_handler.rb +1 -1
  16. data/lib/yard/handlers/ruby/mixin_handler.rb +13 -6
  17. data/lib/yard/i18n/locale.rb +1 -1
  18. data/lib/yard/i18n/message.rb +2 -2
  19. data/lib/yard/i18n/messages.rb +1 -1
  20. data/lib/yard/i18n/pot_generator.rb +1 -1
  21. data/lib/yard/options.rb +1 -1
  22. data/lib/yard/parser/ruby/ast_node.rb +7 -0
  23. data/lib/yard/parser/ruby/ruby_parser.rb +8 -2
  24. data/lib/yard/parser/source_parser.rb +2 -3
  25. data/lib/yard/registry_resolver.rb +2 -1
  26. data/lib/yard/server/commands/base.rb +1 -1
  27. data/lib/yard/server/commands/library_command.rb +8 -8
  28. data/lib/yard/server/commands/static_file_helpers.rb +1 -2
  29. data/lib/yard/server/http_utils.rb +512 -0
  30. data/lib/yard/server/rack_adapter.rb +13 -5
  31. data/lib/yard/tags/tag.rb +2 -2
  32. data/lib/yard/tags/types_explainer.rb +1 -1
  33. data/lib/yard/templates/helpers/html_helper.rb +1 -1
  34. data/lib/yard/templates/helpers/method_helper.rb +3 -1
  35. data/lib/yard/templates/template.rb +3 -1
  36. data/lib/yard/version.rb +1 -1
  37. data/lib/yard.rb +3 -0
  38. data/po/ja.po +19 -19
  39. data/templates/default/fulldoc/html/frames.erb +3 -3
  40. data/templates/default/layout/html/footer.erb +1 -1
  41. data/templates/default/tags/html/option.erb +1 -1
  42. metadata +5 -55
  43. data/.dockerignore +0 -2
  44. data/.gitattributes +0 -4
  45. data/.github/FUNDING.yml +0 -3
  46. data/.github/ISSUE_TEMPLATE.md +0 -33
  47. data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
  48. data/.github/workflows/ci.yml +0 -30
  49. data/.github/workflows/gem.yml +0 -19
  50. data/.gitignore +0 -14
  51. data/.rspec +0 -2
  52. data/.rubocop.yml +0 -112
  53. data/CODE_OF_CONDUCT.md +0 -15
  54. data/CONTRIBUTING.md +0 -140
  55. data/Dockerfile.samus +0 -28
  56. data/Gemfile +0 -34
  57. data/Rakefile +0 -36
  58. data/SECURITY.md +0 -26
  59. data/benchmarks/builtins_vs_eval.rb +0 -24
  60. data/benchmarks/concat_vs_join.rb +0 -13
  61. data/benchmarks/erb_vs_erubis.rb +0 -54
  62. data/benchmarks/format_args.rb +0 -47
  63. data/benchmarks/generation.rb +0 -38
  64. data/benchmarks/marshal_vs_dbm.rb +0 -64
  65. data/benchmarks/parsing.rb +0 -46
  66. data/benchmarks/pathname_vs_string.rb +0 -51
  67. data/benchmarks/rdoc_vs_yardoc.rb +0 -11
  68. data/benchmarks/registry_store_types.rb +0 -49
  69. data/benchmarks/ri_vs_yri.rb +0 -19
  70. data/benchmarks/ripper_parser.rb +0 -13
  71. data/benchmarks/splat_vs_flatten.rb +0 -13
  72. data/benchmarks/template_erb.rb +0 -23
  73. data/benchmarks/template_format.rb +0 -7
  74. data/benchmarks/template_profile.rb +0 -18
  75. data/benchmarks/yri_cache.rb +0 -20
  76. data/samus.json +0 -49
  77. data/tasks/prepare_tag.rake +0 -45
  78. data/tasks/update_error_map.rake +0 -53
  79. data/yard.gemspec +0 -25
@@ -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,45 +0,0 @@
1
- require 'json'
2
- require 'tempfile'
3
-
4
- namespace :release do
5
- desc 'Updates repository and tags VERSION=X.Y.Z'
6
- task :tag do
7
- restore_file = Tempfile.new
8
- restore_file.close
9
- at_exit { restore_file.unlink }
10
-
11
- version = ENV['VERSION']
12
- build_path = File.expand_path(File.join(`gem which samus`.strip, '..', '..', 'commands', 'build'))
13
- samus_contents = File.read(File.join(__dir__, '..', 'samus.json'))
14
- samus_json = JSON.parse(samus_contents.gsub('$version', version))
15
-
16
- samus_json['actions'].each do |action|
17
- env = {
18
- '_VERSION' => version,
19
- '__ORIG_BRANCH' => `git rev-parse --abbrev-ref HEAD`.strip,
20
- '__RESTORE_FILE' => restore_file.path,
21
- }
22
- (action['arguments'] || {}).each {|k, v| env["_#{k.upcase}"] = v }
23
- cmd = [File.join(build_path, action['action']), *action['files']]
24
- puts "[C] #{action['action']} #{(action['files'] || []).join(' ')}"
25
- output = ""
26
- IO.popen(env, cmd) {|io| output = io.read }
27
- status = $?
28
- unless status.success?
29
- puts "[F] Last command failed with: #{status.to_i}"
30
- puts output
31
- exit(status.to_i)
32
- end
33
- end
34
-
35
- puts ""
36
- puts "Tag v#{version} created. To publish, type the following:"
37
- puts ""
38
- puts " bundle exec rake release:push VERSION=#{version}"
39
- end
40
-
41
- desc 'Pushes the main branch and tag for VERSION=X.Y.Z'
42
- task :push do
43
- sh "git push main v#{ENV['VERSION']}"
44
- end
45
- end
@@ -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,25 +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
-
24
- s.add_runtime_dependency 'webrick', '~> 1.7.0'
25
- end