How to exclude some classes from the rdoc and ri generation during gem installation in ruby?

I wrote this stone, which contains more than 10,000 generated classes. When installing this gem, you need to install ri and rdoc forever.

I know that I can disable the ri and rdoc installation by passing the -no-ri and -no-rdoc commands to the gem install, but I need to do something during the gem build process, specify a list of rb files and then exclude the rest.

I want the gem install command to automatically generate ri and rdoc only for these files.

I tried

Rake::RDocTask.new do |rdoc|
  files =['README.rdoc', 'LICENSE', 'lib/myclass.rb']
  rdoc.rdoc_files.add(files)
  rdoc.main = "README.rdoc" # page to start on
  rdoc.title = "mobilesrepo Docs"
  rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
  rdoc.options << '--line-numbers'
end

enable myclass.rb to generate rdoc and ri, but still the gem installation command tries to generate rdoc and ri for all my * .rb files.

Any help would be appreciated.

+3
source share
1

Rake::RDocTask rubygems. html

% rake rdoc

doc/rdoc.

rdoc gem, :

require 'rake/gempackagetask'
spec = Gem::Specification.new {|i|
  ...
  i.rdoc_options += ['-m', 'README.rdoc', '-x', 'lib/(?!myclass.rb).*',
                     'lib/myclass.rb', 'LICENSE', 'README.rdoc']
  i.extra_rdoc_files = []
  ...
}

Rake::GemPackageTask.new(spec).define

lib/(?!myclass.rb).*, rubygems lib rdoc,

  • (-x);
  • lib/myclass.rb .

, .

+3

Source: https://habr.com/ru/post/1784666/


All Articles