yard 0.9.26 → 0.9.27

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b26148831eae874a1a8f704e19bb86e0f3924ba3482337edfe70d1a1c320a00b
4
- data.tar.gz: 60d089381ca93b8b7b732317eafe7da0f56fbd727effaca34a52d1040a217e09
3
+ metadata.gz: d0e3a62dcbb66515f56fe9a2cb919aa97881dced6e7cf052a7ce0201ff9222cf
4
+ data.tar.gz: 06714cb7f3e754d10fb2e784c0a0d49a5fee20aaee75778565daea8b61c453c1
5
5
  SHA512:
6
- metadata.gz: 6e298247ed74a5db2d7f561feaaa6d84a19914c91bc4b9b7e701fa1e33efd7d07e9284eab6c6aad03b61e89268bb105e01a5dcd88beccaf212507cee794d161d
7
- data.tar.gz: 9207539dc74b76b2f02a384ed97bafafc13a2b42dab3cb5130d927bc3a6c53976e802856d2be6c6f566f7811ca33eaa5c2c52a1357df8d950402fa2d949d7005
6
+ metadata.gz: 4a993609ba381fdc0419ac8332605b10a3995ff818626c20e64095f4f845e28297d38a81c890aa95a187ca8fd7d8e7d9f291d7251ac96ba1bee7a5a249f2db3d
7
+ data.tar.gz: f71cc60bc0fbe36419f8f142e07bbee5fd19b9e539099256bb644f1f61f57e9fa61c96ff95e879d584bdb48b3f988d5e945277acbc6e0f083cf1a6c8584c45df
@@ -1,6 +1,6 @@
1
1
  name: Unit Tests
2
2
 
3
- on: [push, pull_request]
3
+ on: [push, pull_request, workflow_dispatch]
4
4
  jobs:
5
5
  build:
6
6
  name: "Ruby: ${{ matrix.ruby }} OS: ${{ matrix.os }}"
@@ -8,35 +8,23 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- os: [macos-latest, windows-latest, ubuntu-latest]
12
- ruby: ["2.4", "2.5", "2.6", "2.7"]
11
+ os: [ubuntu-20.04, macos-10.15, windows-2019]
12
+ # 3.0 is interpreted as 3
13
+ ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, "3.0"]
14
+ exclude:
15
+ - { os: windows-2019 , ruby: 2.2 }
16
+ - { os: windows-2019 , ruby: 2.3 }
13
17
  steps:
14
18
  - name: Checkout
15
19
  uses: actions/checkout@v2
16
- - name: Select Ruby Version
17
- uses: eregon/use-ruby-action@master
20
+ - name: Install Ruby & 'bundle install'
21
+ uses: ruby/setup-ruby@v1
18
22
  with:
19
23
  ruby-version: ${{ matrix.ruby }}
20
- base: update
21
- - name: Update RubyGems & Bundler
22
- run: gem update --system --no-document --conservative
23
- - name: Install Dependencies
24
- run: bundle install --jobs=3 --retry=3
24
+ bundler-cache: true
25
25
  - name: Run Test
26
26
  run: |
27
27
  ruby -v
28
28
  bundle exec rake
29
29
  env:
30
30
  CI: true
31
- build_ruby3:
32
- name: "Ruby: 3.0 OS: Linux"
33
- runs-on: ubuntu-latest
34
- container: ruby:3.0-rc-alpine
35
- steps:
36
- - uses: actions/checkout@v2
37
- - run: apk add -U build-base
38
- - run: gem update --system --no-document --conservative
39
- - run: bundle install --jobs=3 --retry=3
40
- - run: ruby -v && bundle exec rake
41
- env:
42
- CI: true
@@ -9,18 +9,10 @@ jobs:
9
9
  release_version:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v1
13
- - id: tag
14
- run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)
15
- - run: ruby -e 'tag=ENV["GITHUB_REF"].sub("refs/tags/", "").sub("v", "v?");puts File.read("CHANGELOG.md")[/#\s+#{tag}[^\r\n]+\r?\n(.+?)(^#|\Z)/mi,1].strip' > extracted_changelog.md
16
- - name: Create Release
17
- uses: actions/create-release@v1
12
+ - uses: actions/checkout@v2
13
+ - uses: lsegal/github-release-from-changelog-action@latest
18
14
  env:
19
15
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20
- with:
21
- tag_name: ${{ steps.tag.outputs.TAG }}
22
- release_name: Release ${{ steps.tag.outputs.TAG }}
23
- body_path: extracted_changelog.md
24
16
  - name: Publish RubyGem
25
17
  uses: dawidd6/action-publish-gem@v1
26
18
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # main
2
2
 
3
+ # 0.9.27 - November 29th, 2021
4
+
5
+ [0.9.27]: https://github.com/lsegal/yard/compare/v0.9.26...v0.9.27
6
+
7
+ - Add support for Ruby 3.0 endless method definitions. (#1376, #1381)
8
+ - Add existence check for README file (#1367)
9
+ - Support module_function decorator (#1365)
10
+ - Add CommonMarker markup support (`-m commonmarker`) (#1157, #1388)
11
+ - Fix nested array parsing (#1389)
12
+ - Add WEBrick as a runtime dependency for Ruby 3.0 support (#1400)
13
+ - Support `fail_on_warning` option in `yard stats` command (#1392)
14
+ - Better integration with Sorbet (#1401)
15
+ - Handle include mixins on complex paths (#1386)
16
+ - Fix `@!scope` maintaining state in lone comment blocks (#1411)
17
+ - Remove support for Travis CI
18
+
3
19
  # 0.9.26 - December 26th, 2020
4
20
 
5
21
  [0.9.26]: https://github.com/lsegal/yard/compare/v0.9.25...v0.9.26
data/Gemfile CHANGED
@@ -18,6 +18,7 @@ end
18
18
 
19
19
  group :markdown do
20
20
  gem 'redcarpet'
21
+ gem 'commonmarker'
21
22
  end
22
23
 
23
24
  group :textile do
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Documentation](https://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/yard/frames)
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/yard.svg)](http://github.com/lsegal/yard/releases)
8
- [![Build Status](https://travis-ci.org/lsegal/yard.svg?branch=main)](https://travis-ci.org/lsegal/yard)
8
+ [![Unit Tests](https://github.com/lsegal/yard/actions/workflows/ci.yml/badge.svg)](https://github.com/lsegal/yard/actions/workflows/ci.yml)
9
9
  [![Coverage Status](https://coveralls.io/repos/github/lsegal/yard/badge.svg)](https://coveralls.io/github/lsegal/yard)
10
10
  [![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
11
11
 
data/Rakefile CHANGED
@@ -2,7 +2,6 @@
2
2
  require File.dirname(__FILE__) + '/lib/yard'
3
3
  require File.dirname(__FILE__) + '/lib/yard/rubygems/specification'
4
4
  require 'rbconfig'
5
- require 'samus'
6
5
 
7
6
  YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']
8
7
 
@@ -35,5 +34,3 @@ task :default => [:spec, :test_doc]
35
34
  YARD::Rake::YardocTask.new do |t|
36
35
  t.options += ['--title', "YARD #{YARD::VERSION} Documentation"]
37
36
  end
38
-
39
- Samus::Rake::DockerReleaseTask.new
@@ -43,6 +43,8 @@ module YARD
43
43
 
44
44
  print_statistics
45
45
  print_undocumented_objects
46
+
47
+ abort if fail_on_warning && log.warned
46
48
  end
47
49
 
48
50
  # Prints statistics for different object types
@@ -295,9 +295,10 @@ module YARD
295
295
  self.files = Parser::SourceParser::DEFAULT_PATH_GLOB if files.empty?
296
296
  files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
297
297
  readme = Dir.glob('README{,*[^~]}').
298
+ select {|f| extra_file_valid?(f)}.
298
299
  sort_by {|r| [r.count('.'), r.index('.'), r] }.first
299
300
  readme ||= Dir.glob(files.first).first if options.onefile && !files.empty?
300
- options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme
301
+ options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme && extra_file_valid?(readme)
301
302
  options.files.unshift(options.readme).uniq! if options.readme
302
303
 
303
304
  Tags::Library.visible_tags -= hidden_tags
@@ -67,7 +67,7 @@ class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base
67
67
  end
68
68
 
69
69
  def format_args
70
- args = statement.parameters
70
+ return [] unless args = statement.parameters
71
71
 
72
72
  params = []
73
73
 
@@ -41,7 +41,9 @@ class YARD::Handlers::Ruby::MixinHandler < YARD::Handlers::Ruby::Base
41
41
  end
42
42
 
43
43
  def recipient(mixin)
44
- if statement[0].type == :var_ref && statement[0][0] != s(:kw, "self")
44
+ if statement[0].type == :const_path_ref
45
+ Proxy.new(namespace, statement[0].source)
46
+ elsif statement[0].type == :var_ref && statement[0][0] != s(:kw, "self")
45
47
  statement[0][0].type == :const ?
46
48
  Proxy.new(namespace, statement.namespace.source) :
47
49
  nil
@@ -2,6 +2,8 @@
2
2
  # Handles module_function calls to turn methods into public class methods.
3
3
  # Also creates a private instance copy of the method.
4
4
  class YARD::Handlers::Ruby::ModuleFunctionHandler < YARD::Handlers::Ruby::Base
5
+ include YARD::Handlers::Ruby::DecoratorHandlerMethods
6
+
5
7
  handles method_call(:module_function)
6
8
  namespace_only
7
9
 
@@ -13,15 +15,25 @@ class YARD::Handlers::Ruby::ModuleFunctionHandler < YARD::Handlers::Ruby::Base
13
15
  when :fcall, :command
14
16
  statement[1].traverse do |node|
15
17
  case node.type
18
+ when :def
19
+ process_decorator do |instance_method|
20
+ make_module_function(instance_method, namespace)
21
+ end
22
+ break
16
23
  when :symbol; name = node.first.source
17
24
  when :string_content; name = node.source
18
25
  else next
19
26
  end
27
+
20
28
  instance_method = MethodObject.new(namespace, name)
21
- class_method = MethodObject.new(namespace, name, :module)
22
- instance_method.copy_to(class_method)
23
- class_method.visibility = :public
29
+ make_module_function(instance_method, namespace)
24
30
  end
25
31
  end
26
32
  end
33
+
34
+ def make_module_function(instance_method, namespace)
35
+ class_method = MethodObject.new(namespace, instance_method.name, :module)
36
+ instance_method.copy_to(class_method)
37
+ class_method.visibility = :public
38
+ end
27
39
  end
@@ -480,7 +480,7 @@ module YARD
480
480
  end
481
481
 
482
482
  def parameters(include_block_param = true)
483
- params = self[1 + index_adjust]
483
+ return unless params = self[1 + index_adjust]
484
484
  params = params[0] if params.type == :paren
485
485
  include_block_param ? params : params[0...-1]
486
486
  end
@@ -488,7 +488,7 @@ module YARD
488
488
  def signature
489
489
  params_src = ''
490
490
  params = self[1 + index_adjust]
491
- if params.first
491
+ if params and params.first
492
492
  params_src = params.type == :paren ? '' : ' '
493
493
  params_src += params.source.gsub(/\s+(\s|\))/m, '\1')
494
494
  end
@@ -370,7 +370,7 @@ module YARD
370
370
 
371
371
  def on_aref(*args)
372
372
  @map[:lbracket].pop
373
- ll, lc = *@map[:aref].pop
373
+ ll, lc = *@map[:aref].shift
374
374
  sr = args.first.source_range.first..lc
375
375
  lr = args.first.line_range.first..ll
376
376
  AstNode.new(:aref, args, :char => sr, :line => lr)
@@ -31,7 +31,7 @@ module YARD
31
31
  # @abstract
32
32
  class LibraryCommand < Base
33
33
  begin
34
- Process.fork { exit 0 }
34
+ Process.fork { }
35
35
  CAN_FORK = true
36
36
  rescue Exception # rubocop:disable Lint/RescueException
37
37
  CAN_FORK = false
@@ -74,6 +74,13 @@ module YARD
74
74
  def after_parse; end
75
75
 
76
76
  protected :parser
77
+
78
+ protected
79
+
80
+ def inside_directive?
81
+ return true if parser.state.inside_directive
82
+ parser.directives.any? { |d| d.is_a?(MethodDirective) && d.tag.text.empty? }
83
+ end
77
84
  end
78
85
 
79
86
  # Ends a group listing definition. Group definition automatically end
@@ -574,6 +581,8 @@ module YARD
574
581
  if %w(class instance module).include?(tag.text)
575
582
  if object.is_a?(CodeObjects::MethodObject)
576
583
  object.scope = tag.text.to_sym
584
+ elsif handler && !inside_directive?
585
+ handler.scope = tag.text.to_sym
577
586
  else
578
587
  parser.state.scope = tag.text.to_sym
579
588
  end
@@ -604,7 +613,7 @@ module YARD
604
613
  if %w(public protected private).include?(tag.text)
605
614
  if object.is_a?(CodeObjects::Base)
606
615
  object.visibility = tag.text.to_sym
607
- elsif handler && !parser.state.inside_directive
616
+ elsif handler && !inside_directive?
608
617
  handler.visibility = tag.text.to_sym
609
618
  else
610
619
  parser.state.visibility = tag.text.to_sym
@@ -78,9 +78,10 @@ module YARD
78
78
  def html_markup_markdown(text)
79
79
  # TODO: other libraries might be more complex
80
80
  provider = markup_class(:markdown)
81
- if provider.to_s == 'RDiscount'
81
+ case provider.to_s
82
+ when 'RDiscount'
82
83
  provider.new(text, :autolink).to_html
83
- elsif provider.to_s == 'RedcarpetCompat'
84
+ when 'RedcarpetCompat'
84
85
  provider.new(text, :autolink,
85
86
  :fenced_code,
86
87
  :gh_blockcode,
@@ -88,6 +89,8 @@ module YARD
88
89
  :tables,
89
90
  :with_toc_data,
90
91
  :no_intraemphasis).to_html
92
+ when 'CommonMarker'
93
+ CommonMarker.render_html(text, %i[DEFAULT GITHUB_PRE_LANG], %i[autolink])
91
94
  else
92
95
  provider.new(text).to_html
93
96
  end
@@ -29,7 +29,8 @@ module YARD
29
29
  {:lib => :bluecloth, :const => 'BlueCloth'},
30
30
  {:lib => :maruku, :const => 'Maruku'},
31
31
  {:lib => :'rpeg-markdown', :const => 'PEGMarkdown'},
32
- {:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'}
32
+ {:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'},
33
+ {:lib => :commonmarker, :const => 'CommonMarker'}
33
34
  ],
34
35
  :textile => [
35
36
  {:lib => :redcloth, :const => 'RedCloth'}
data/lib/yard/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module YARD
5
- VERSION = '0.9.26'
5
+ VERSION = '0.9.27'
6
6
  end
data/lib/yard.rb CHANGED
@@ -48,6 +48,9 @@ module YARD
48
48
 
49
49
  # @return [Boolean] whether YARD is being run in Ruby 2.0
50
50
  def self.ruby2?; @ruby2 ||= (RUBY_VERSION >= '2.0.0') end
51
+
52
+ # @return [Boolean] whether YARD is being run in Ruby 3.0
53
+ def self.ruby3?; @ruby3 ||= (RUBY_VERSION >= '3.0.0') end
51
54
  end
52
55
 
53
56
  # Keep track of Ruby version for compatibility code
@@ -0,0 +1,45 @@
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
data/yard.gemspec CHANGED
@@ -20,4 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.executables = ['yard', 'yardoc', 'yri']
21
21
  s.license = 'MIT' if s.respond_to?(:license=)
22
22
  s.metadata['yard.run'] = 'yri'
23
+
24
+ s.add_runtime_dependency 'webrick', '~> 1.7.0'
23
25
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.26
4
+ version: 0.9.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-27 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: webrick
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.7.0
13
27
  description: |2
14
28
  YARD is a documentation generation tool for the Ruby programming language.
15
29
  It enables the user to generate consistent, usable documentation that can be
@@ -33,7 +47,6 @@ files:
33
47
  - ".gitignore"
34
48
  - ".rspec"
35
49
  - ".rubocop.yml"
36
- - ".travis.yml"
37
50
  - ".yardopts"
38
51
  - ".yardopts_guide"
39
52
  - ".yardopts_i18n"
@@ -299,6 +312,7 @@ files:
299
312
  - lib/yard/version.rb
300
313
  - po/ja.po
301
314
  - samus.json
315
+ - tasks/prepare_tag.rake
302
316
  - tasks/update_error_map.rake
303
317
  - templates/default/class/dot/setup.rb
304
318
  - templates/default/class/dot/superklass.erb
@@ -448,8 +462,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
448
462
  - !ruby/object:Gem::Version
449
463
  version: '0'
450
464
  requirements: []
451
- rubyforge_project:
452
- rubygems_version: 2.7.6
465
+ rubygems_version: 3.1.2
453
466
  signing_key:
454
467
  specification_version: 4
455
468
  summary: Documentation tool for consistent and usable documentation in Ruby.
data/.travis.yml DELETED
@@ -1,49 +0,0 @@
1
- # Build for Ruby
2
- language: ruby
3
-
4
- # Enables caching for bundler
5
- cache: bundler
6
-
7
- # Specify which ruby versions you wish to run your tests on, each version will be used
8
- rvm:
9
- - "2.0"
10
- - "2.1"
11
- - "2.2"
12
- - "2.3"
13
- - "2.4"
14
- - "2.5"
15
- - "2.6"
16
- - "2.7"
17
- # - ruby-head
18
- # - jruby
19
-
20
- # Define how to run your tests (defaults to `bundle exec rake` or `rake` depending on whether you have a `Gemfile`)
21
- script: "bundle exec rake"
22
-
23
- # Define tasks to be completed before and after tests run . Will allow folding of content on frontend
24
- #before_script:
25
- # - command_1
26
- # - command_2
27
- #
28
- #after_script:
29
- # - command_1
30
- # - command_2
31
-
32
- # Specify an ENV variable to run before: 'bundle install' and 'rake' (or your defined 'script')
33
- env:
34
- - CI=1
35
-
36
- # Specify the recipients for email notification
37
- #notifications:
38
- # recipients:
39
- # - email-address-1
40
- # - email-address-2
41
-
42
- # Disable email notifications
43
- #notifications:
44
- # disabled: true
45
-
46
- # notifications:
47
- # webhooks:
48
- # urls:
49
- # - https://webhooks.gitter.im/e/c6dbb9323007dfcf81df