Class: Gem::DocManager
- Inherits:
-
Object
- Object
- Gem::DocManager
- Defined in:
- lib/yard/rubygems/doc_manager.rb
Class Method Summary collapse
Instance Method Summary collapse
- #install_rdoc_yard ⇒ Object (also: #install_rdoc)
- #install_ri_yard ⇒ Object (also: #install_ri)
- #install_yardoc ⇒ Object
- #run_yardoc(*args) ⇒ Object
- #setup_rdoc ⇒ Object
Class Method Details
.load_yardoc ⇒ Object
4 5 6 |
# File 'lib/yard/rubygems/doc_manager.rb', line 4 def self.load_yardoc require File.dirname(__FILE__) + '/../../yard' end |
Instance Method Details
#install_rdoc_yard ⇒ Object Also known as: install_rdoc
66 67 68 69 70 71 72 |
# File 'lib/yard/rubygems/doc_manager.rb', line 66 def install_rdoc_yard if @spec.has_rdoc? install_rdoc_yard_orig elsif @spec.has_yardoc? install_yardoc end end |
#install_ri_yard ⇒ Object Also known as: install_ri
54 55 56 57 58 59 60 61 62 |
# File 'lib/yard/rubygems/doc_manager.rb', line 54 def install_ri_yard install_ri_yard_orig if @spec.has_rdoc? return if @spec.has_rdoc? == false return if @spec.has_yardoc? self.class.load_yardoc say "Building YARD (yri) index for #{@spec.full_name}..." run_yardoc '-c', '-n' end |
#install_yardoc ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/yard/rubygems/doc_manager.rb', line 45 def install_yardoc rdoc_dir = File.join(@doc_dir, 'rdoc') FileUtils.rm_rf rdoc_dir say "Installing YARD documentation for #{@spec.full_name}..." run_yardoc '-o', rdoc_dir end |
#run_yardoc(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/yard/rubygems/doc_manager.rb', line 8 def run_yardoc(*args) args << '--quiet' args << @spec.require_paths if @spec.extra_rdoc_files.size > 0 args << '-' args += @spec.extra_rdoc_files end args = args.flatten.map {|arg| arg.to_s } old_pwd = Dir.pwd Dir.chdir(@spec.full_gem_path) YARD::CLI::Yardoc.run(*args) rescue Errno::EACCES => e dirname = File.dirname e..split("-")[1].strip raise Gem::FilePermissionError.new(dirname) rescue => ex alert_error "While generating documentation for #{@spec.full_name}" ui.errs.puts "... MESSAGE: #{ex}" ui.errs.puts "... YARDDOC args: #{args.join(' ')}" ui.errs.puts "\t#{ex.backtrace.join("\n\t")}" if Gem.configuration.backtrace ui.errs.puts "(continuing with the rest of the installation)" ensure Dir.chdir(old_pwd) end |
#setup_rdoc ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/yard/rubygems/doc_manager.rb', line 34 def setup_rdoc if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then raise Gem::FilePermissionError.new(@doc_dir) end FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) self.class.load_rdoc if @spec.has_rdoc? self.class.load_yardoc if @spec.has_yardoc? end |