Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions lib/rdoc/markup/pre_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,6 @@ def handle_directive(prefix, directive, param, code_object = nil,
when 'include' then
filename = param.split(' ', 2).first
include_file filename, prefix, encoding
when 'main' then
@options.main_page = param if @options.respond_to? :main_page
warn <<~MSG
The :main: directive is deprecated and will be removed in RDoc 7.

You can use these options to specify the initial page displayed instead:
- `--main=#{param}` via the command line
- `rdoc.main = "#{param}"` if you use `RDoc::Task`
- `main_page: #{param}` in your `.rdoc_options` file
MSG

blankline
when 'nodoc' then
return blankline unless code_object
code_object.document_self = nil # notify nodoc
Expand All @@ -245,19 +233,6 @@ def handle_directive(prefix, directive, param, code_object = nil,

code_object.stop_doc

blankline
when 'title' then
@options.default_title = param if @options.respond_to? :default_title=

warn <<~MSG
The :title: directive is deprecated and will be removed in RDoc 7.

You can use these options to specify the title displayed instead:
- `--title=#{param}` via the command line
- `rdoc.title = "#{param}"` if you use `RDoc::Task`
- `title: #{param}` in your `.rdoc_options` file
MSG

blankline
when 'yield', 'yields' then
return blankline unless code_object
Expand Down
46 changes: 1 addition & 45 deletions lib/rdoc/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@

class RDoc::Options

##
# The deprecated options.

DEPRECATED = {
'--accessor' => 'support discontinued',
'--diagram' => 'support discontinued',
'--help-output' => 'support discontinued',
'--image-format' => 'was an option for --diagram',
'--inline-source' => 'source code is now always inlined',
'--merge' => 'ri now always merges class information',
'--one-file' => 'support discontinued',
'--op-name' => 'support discontinued',
'--opname' => 'support discontinued',
'--promiscuous' => 'files always only document their content',
'--ri-system' => 'Ruby installers use other techniques',
}

##
# RDoc options ignored (or handled specially) by --write-options

Expand All @@ -113,7 +96,6 @@ class RDoc::Options
rdoc_include
root
static_path
stylesheet_url
template
template_dir
update_output_dir
Expand Down Expand Up @@ -430,7 +412,6 @@ def init_ivars # :nodoc:
@root = Pathname(Dir.pwd)
@show_hash = false
@static_path = []
@stylesheet_url = nil # TODO remove in RDoc 4
@tab_width = 8
@template = nil
@template_dir = nil
Expand Down Expand Up @@ -769,14 +750,6 @@ def parse(argv)
end
opt.banner += " - TomDoc: Only in ruby files\n"

opt.banner += "\n The following options are deprecated:\n\n"

name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length

DEPRECATED.sort_by { |k,| k }.each do |name, reason|
opt.banner += " %*1$2$s %3$s\n" % [-name_length, name, reason]
end

opt.accept Template do |template|
template_dir = template_dir_for template

Expand Down Expand Up @@ -1013,14 +986,6 @@ def parse(argv)
@op_dir = value
end

opt.separator nil

opt.on("-d",
"Deprecated --diagram option.",
"Prevents firing debug mode",
"with legacy invocation.") do |value|
end

opt.separator nil
opt.separator 'HTML generator options:'
opt.separator nil
Expand Down Expand Up @@ -1230,15 +1195,12 @@ def parse(argv)
opt.separator nil
end

deprecated = []
invalid = []

begin
opts.parse! argv
rescue OptionParser::ParseError => e
if DEPRECATED[e.args.first] then
deprecated << e.args.first
elsif %w[--format --ri -r --ri-site -R].include? e.args.first then
if %w[--format --ri -r --ri-site -R].include? e.args.first then
raise
else
invalid << e.args.join(' ')
Expand All @@ -1254,12 +1216,6 @@ def parse(argv)
invalid << '-p (with files)'
end

unless quiet then
deprecated.each do |opt|
$stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt]
end
end

unless invalid.empty? then
invalid = "invalid options: #{invalid.join ', '}"

Expand Down
3 changes: 1 addition & 2 deletions lib/rdoc/parser/c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1089,11 +1089,10 @@ def load_variable_map(map_name)
# Look for directives in a normal comment block:
#
# /*
# * :title: My Awesome Project
# * :nodoc:
# */
#
# This method modifies the +comment+
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.

def look_for_directives_in(context, comment)
comment.text, format = @preprocess.run_pre_processes(comment.text, context, comment.line || 1, :c)
Expand Down
15 changes: 0 additions & 15 deletions lib/rdoc/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,6 @@ def defaults
@options = []
end

##
# All source is inline now. This method is deprecated

def inline_source # :nodoc:
warn "RDoc::Task#inline_source is deprecated"
true
end

##
# All source is inline now. This method is deprecated

def inline_source=(value) # :nodoc:
warn "RDoc::Task#inline_source is deprecated"
end

##
# Create the tasks defined by this task lib.

Expand Down
36 changes: 14 additions & 22 deletions test/rdoc/markup/pre_process_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,20 @@ def test_include_file_in_other_directory
end

def test_handle
text = "# :main: M\n"
output = nil
_, err = capture_output do
output = @pp.handle text
end
text = "# :stopdoc:\n"
code_object = RDoc::CodeObject.new
output = @pp.handle text, code_object

assert_include err, "The :main: directive is deprecated and will be removed in RDoc 7."
assert_equal "#\n", output
end

def test_handle_comment
text = "# :main: M\n"
text = "# :stopdoc:\n"
c = comment text
code_object = RDoc::CodeObject.new

output = nil
_, err = capture_output do
output = @pp.handle c
end
output = @pp.handle c, code_object

assert_include err, "The :main: directive is deprecated and will be removed in RDoc 7."
assert_equal "#\n", output
end

Expand Down Expand Up @@ -253,12 +247,11 @@ def test_handle_directive_include
def test_handle_directive_main
@pp.options = RDoc::Options.new

_, err = capture_output do
@pp.handle_directive '', 'main', 'M'
end
# :main: directive was removed; it is now treated as unhandled metadata
code_object = RDoc::CodeObject.new
@pp.handle_directive '', 'main', 'M', code_object

assert_include err, "The :main: directive is deprecated and will be removed in RDoc 7."
assert_equal 'M', @pp.options.main_page
assert_equal 'M', code_object.metadata['main']
end

def test_handle_directive_notnew
Expand Down Expand Up @@ -396,12 +389,11 @@ def test_handle_directive_stopdoc
def test_handle_directive_title
@pp.options = RDoc::Options.new

_, err = capture_output do
@pp.handle_directive '', 'title', 'T'
end
# :title: directive was removed; it is now treated as unhandled metadata
code_object = RDoc::CodeObject.new
@pp.handle_directive '', 'title', 'T', code_object

assert_include err, "The :title: directive is deprecated and will be removed in RDoc 7."
assert_equal 'T', @pp.options.title
assert_equal 'T', code_object.metadata['title']
end

def test_handle_directive_unhandled
Expand Down
15 changes: 0 additions & 15 deletions test/rdoc/rdoc_options_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,21 +281,6 @@ def test_parse_default
assert_match %r%rdoc/generator/template/aliki$%, @options.template_dir
end

def test_parse_deprecated
dep_hash = RDoc::Options::DEPRECATED
options = dep_hash.keys.sort

out, err = capture_output do
@options.parse options
end

dep_hash.each_pair do |opt, message|
assert_match %r%.*#{opt}.+#{message}%, err
end

assert_empty out
end

def test_parse_dry_run
@options.parse %w[--dry-run]

Expand Down
18 changes: 0 additions & 18 deletions test/rdoc/rdoc_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,6 @@ def test_clobber_task_description
assert_equal 'Remove RDoc HTML files', @t.clobber_task_description
end

def test_inline_source
_, err = verbose_capture_output do
assert @t.inline_source
end

assert_include err, "RDoc::Task#inline_source is deprecated\n"

_, err = verbose_capture_output do
@t.inline_source = false
end

assert_include err, "RDoc::Task#inline_source is deprecated\n"

capture_output do
assert @t.inline_source
end
end

def test_markup_option
rdoc_task = RDoc::Task.new do |rd|
rd.markup = "tomdoc"
Expand Down
Loading