Skip to content

Commit

Permalink
Merge branch 'master' into type_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
raosush committed Jul 13, 2023
2 parents 4eafdd2 + e8f22ce commit a0155c8
Show file tree
Hide file tree
Showing 151 changed files with 1,982 additions and 388 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
47 changes: 47 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy RDoc site to Pages

on:
push:
branches: [ 'master' ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.repository == 'ruby/rdoc' && !startsWith(github.event_name, 'pull') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
ruby-version: '3.2'
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with RDoc
# Outputs to the './_site' directory by default
run: bundle exec rake rdoc
- name: Upload artifact
uses: actions/upload-pages-artifact@v1

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
38 changes: 28 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,36 @@ name: Test

on: [push, pull_request]

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
build:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master

test:
needs: ruby-versions
strategy:
matrix:
ruby: [ 'head', '3.1', '3.0', '2.7' ]
os:
- windows-latest
- ubuntu-latest
include:
- { ruby: '3.1', os: 'macos-latest' }
- { ruby: 'jruby-9.2.19.0', os: 'ubuntu-latest' }
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: windows-latest
ruby: truffleruby
- os: windows-latest
ruby: truffleruby-head
- os: windows-latest
ruby: jruby
- os: windows-latest
ruby: jruby-head
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# libyaml-dev is needed for psych, see https://github.com/ruby/setup-ruby/issues/409
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install libyaml-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # 'bundle install' and cache
Expand All @@ -28,4 +42,8 @@ jobs:
run: bundle exec rake
env:
RUBYOPT: --enable-frozen_string_literal
- if: ${{ matrix.ruby == 'head' && startsWith(matrix.os, 'ubuntu') }}
run: bundle exec rake rdoc
- if: ${{ matrix.ruby == 'head' && startsWith(matrix.os, 'ubuntu') }}
run: bundle exec rake rubocop

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
.DS_Store
/.rdoc
/.rvmrc
/.ruby-version
/TAGS
/html
/_site
/lib/rdoc/rd/block_parser.rb
/lib/rdoc/rd/inline_parser.rb
/lib/rdoc/markdown.rb
Expand Down
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
DisabledByDefault: true
Exclude:
- rdoc.gemspec

Layout/TrailingWhitespace:
Enabled: true
Layout/TrailingEmptyLines:
Enabled: true
3 changes: 1 addition & 2 deletions CONTRIBUTING.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ RDoc uses bundler for development. To get ready to work on RDoc run:
This will install all the necessary dependencies for development with rake,
generate documentation and run the tests for the first time.

If the tests don't pass on the first run check the {Travis CI page for
RDoc}[https://travis-ci.org/ruby/rdoc] to see if there are any known failures
If the tests don't pass on the first run check the {GitHub Actions page}[https://github.com/ruby/rdoc/actions] to see if there are any known failures
(there shouldn't be).

You can now use `rake` and `autotest` to run the tests.
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ gemspec
group :development do
gem 'rake'
gem 'racc', '> 1.4.10'
gem 'kpeg', github: 'evanphx/kpeg'
gem 'kpeg', '>= 1.3.3'
gem 'test-unit'
gem 'rubocop'
gem 'rubocop', '>= 1.31.0'
gem 'gettext'
end
4 changes: 2 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
home :: https://github.com/ruby/rdoc
rdoc :: https://ruby.github.io/rdoc
bugs :: https://github.com/ruby/rdoc/issues
code quality :: {<img src="https://codeclimate.com/github/ruby/rdoc/badges/gpa.svg" alt="Code Climate">}[https://codeclimate.com/github/ruby/rdoc]
code quality :: https://codeclimate.com/github/ruby/rdoc

== Description

Expand Down Expand Up @@ -46,7 +46,7 @@ contain just Markup-style markup (with or without leading '#' comment
markers). If directory names are passed to RDoc, they are scanned
recursively for C and Ruby source files only.

To generate documentation using +rake+ see RDoc::Task[https://ruby.github.io/rdoc/RDocTask.html].
To generate documentation using +rake+ see RDoc::Task[https://ruby.github.io/rdoc/RDoc/Task.html].

To generate documentation programmatically:

Expand Down
22 changes: 7 additions & 15 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require_relative 'lib/rdoc/task'
require 'bundler/gem_tasks'
require 'rake/testtask'

task :docs => :generate
task :test => [:normal_test, :rubygems_test]

PARSER_FILES = %w[
Expand All @@ -20,31 +19,23 @@ $rdoc_rakefile = true

task :default => :test

task rdoc: :generate
RDoc::Task.new do |doc|
doc.main = 'README.rdoc'
doc.title = "rdoc #{RDoc::VERSION} Documentation"
doc.rdoc_dir = 'html'
doc.rdoc_dir = '_site' # for github pages
doc.rdoc_files = FileList.new %w[lib/**/*.rb *.rdoc doc/rdoc/markup_reference.rb] - PARSER_FILES
end

task ghpages: :rdoc do
`git checkout gh-pages`
require "fileutils"
FileUtils.rm_rf "/tmp/html"
FileUtils.mv "html", "/tmp"
FileUtils.rm_rf "*"
FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
end

Rake::TestTask.new(:normal_test) do |t|
t.libs = []
t.verbose = true
t.deps = :generate
t.libs << "test/lib"
t.ruby_opts << "-rhelper"
t.test_files = FileList["test/**/test_*.rb"].exclude("test/rdoc/test_rdoc_rubygems_hook.rb")
end

Rake::TestTask.new(:rubygems_test) do |t|
t.libs = []
t.verbose = true
t.deps = :generate
t.pattern = "test/rdoc/test_rdoc_rubygems_hook.rb"
Expand Down Expand Up @@ -73,7 +64,7 @@ parsed_files = PARSER_FILES.map do |parser_file|
when '.ry' # need racc
racc = Gem.bin_path 'racc', 'racc'
rb_file = parser_file.gsub(/\.ry\z/, ".rb")
ruby "#{racc} -l -o #{rb_file} #{parser_file}"
ruby "#{racc} -l -E -o #{rb_file} #{parser_file}"
open(rb_file, 'r+') do |f|
newtext = "# frozen_string_literal: true\n#{f.read}"
f.rewind
Expand All @@ -83,6 +74,7 @@ parsed_files = PARSER_FILES.map do |parser_file|
kpeg = Gem.bin_path 'kpeg', 'kpeg'
rb_file = parser_file.gsub(/\.kpeg\z/, ".rb")
ruby "#{kpeg} -fsv -o #{rb_file} #{parser_file}"
File.write(rb_file, File.read(rb_file).gsub(/ +$/, '')) # remove trailing spaces
end
end

Expand All @@ -106,5 +98,5 @@ else
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = [*parsed_files]
end
task :build => [:generate, "rubocop:auto_correct"]
task :build => [:generate, "rubocop:autocorrect"]
end
2 changes: 1 addition & 1 deletion TODO.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Nice to have:
* Global variable support
* Provide the code_object to directive handlers

=== 4
=== More Future

API changes to RDoc

Expand Down
6 changes: 3 additions & 3 deletions doc/rdoc/markup_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# - Single-line or multi-line comments that precede certain definitions;
# see {Markup in Comments}[rdoc-ref:RDoc::MarkupReference@Markup+in+Comments].
# - \RDoc directives in trailing comments (on the same line as code);
# see <tt>:nodoc:</tt>, <tt>:doc:</tt>, and <tt>:notnew</tt>.
# see <tt>:nodoc:</tt>, <tt>:doc:</tt>, and <tt>:notnew:</tt>.
# - \RDoc directives in single-line comments;
# see other {Directives}[rdoc-ref:RDoc::MarkupReference@Directives].
# - The Ruby code itself (but not from C code);
Expand Down Expand Up @@ -66,7 +66,7 @@
# In a multi-line comment,
# \RDoc looks for the comment's natural left margin,
# which becomes the <em>base margin</em> for the comment
# and is the initial <em>current margin</em> for for the comment.
# and is the initial <em>current margin</em> for the comment.
#
# The current margin can change, and does so, for example in a list.
#
Expand Down Expand Up @@ -346,7 +346,7 @@
#
# ===== Lettered Lists
#
# A numbered list item begins with a letters and a period.
# A lettered list item begins with letters and a period.
#
# The items are automatically "re-lettered."
#
Expand Down
1 change: 0 additions & 1 deletion lib/rdoc/alias.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,3 @@ def to_s # :nodoc:
end

end

1 change: 0 additions & 1 deletion lib/rdoc/anon_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@

class RDoc::AnonClass < RDoc::ClassModule
end

1 change: 0 additions & 1 deletion lib/rdoc/attr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,3 @@ def token_stream # :nodoc:
end

end

1 change: 0 additions & 1 deletion lib/rdoc/class_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -809,4 +809,3 @@ def update_extends
end

end

50 changes: 17 additions & 33 deletions lib/rdoc/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,42 +97,26 @@ def extract_call_seq method
# comment. The difficulty is to make sure not to match lines starting
# with ARGF at the same indent, but that are after the first description
# paragraph.
if @text =~ /^\s*:?call-seq:(.*?(?:\S).*?)^\s*$/m then
if /^(?<S> ((?!\n)\s)*+ (?# whitespaces except newline))
:?call-seq:
(?<B> \g<S>(?<N>\n|\z) (?# trailing spaces))?
(?<seq>
(\g<S>(?!\w)\S.*\g<N>)*
(?>
(?<H> \g<S>\w+ (?# ' # ARGF' in the example above))
.*\g<N>)?
(\g<S>\S.*\g<N> (?# other non-blank line))*+
(\g<B>+(\k<H>.*\g<N> (?# ARGF.to_a lines))++)*+
)
(?m:^\s*$|\z)
/x =~ @text
seq = $~[:seq]

all_start, all_stop = $~.offset(0)
seq_start, seq_stop = $~.offset(1)

# we get the following lines that start with the leading word at the
# same indent, even if they have blank lines before
if $1 =~ /(^\s*\n)+^(\s*\w+)/m then
leading = $2 # ' * ARGF' in the example above
re = %r%
\A(
(^\s*\n)+
(^#{Regexp.escape leading}.*?\n)+
)+
^\s*$
%xm

if @text[seq_stop..-1] =~ re then
all_stop = seq_stop + $~.offset(0).last
seq_stop = seq_stop + $~.offset(1).last
end
end

seq = @text[seq_start..seq_stop]
seq.gsub!(/^\s*(\S|\n)/m, '\1')
@text.slice! all_start...all_stop

method.call_seq = seq.chomp

else
regexp = /^\s*:?call-seq:(.*?)(^\s*$|\z)/m
if regexp =~ @text then
@text = @text.sub(regexp, '')
seq = $1
seq.gsub!(/^\s*/, '')
method.call_seq = seq
end
seq.gsub!(/^\s*/, '')
method.call_seq = seq
end

method
Expand Down
1 change: 0 additions & 1 deletion lib/rdoc/constant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,3 @@ def to_s # :nodoc:
end

end

1 change: 0 additions & 1 deletion lib/rdoc/context/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,3 @@ def remove_comment comment
end

end

1 change: 0 additions & 1 deletion lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,3 @@ def resolve name, text
end

end

1 change: 0 additions & 1 deletion lib/rdoc/erb_partial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ def set_eoutvar compiler, eoutvar = '_erbout'
end

end

1 change: 0 additions & 1 deletion lib/rdoc/erbio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ def set_eoutvar compiler, io_variable
end

end

1 change: 0 additions & 1 deletion lib/rdoc/extend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
class RDoc::Extend < RDoc::Mixin

end

2 changes: 1 addition & 1 deletion lib/rdoc/generator/darkfish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def setup

@classes = @store.all_classes_and_modules.sort
@files = @store.all_files.sort
@methods = @classes.map { |m| m.method_list }.flatten.sort
@methods = @classes.flat_map { |m| m.method_list }.sort
@modsort = get_sorted_module_list @classes
end

Expand Down

0 comments on commit a0155c8

Please sign in to comment.