Class: Gem::Commands::YardocCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/rubygems/commands/yardoc_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeYardocCommand

Returns a new instance of YardocCommand.



6
7
8
# File 'lib/rubygems/commands/yardoc_command.rb', line 6

def initialize
  super 'yardoc', 'Generate YARD documentations for specified gems into doc directory'
end

Class Method Details

.run_yardoc(spec) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/rubygems/commands/yardoc_command.rb', line 25

def run_yardoc(spec)
  yardoc_dir = File.join(spec.doc_dir, 'yardoc')
  Dir.chdir spec.gem_dir do
    YARD::CLI::Yardoc.run '--output-dir', yardoc_dir
  end
  $stderr.puts 'YARD documentation is generated to:'
  $stderr.puts yardoc_dir
end

Instance Method Details

#argumentsObject

:nodoc:



10
11
12
# File 'lib/rubygems/commands/yardoc_command.rb', line 10

def arguments # :nodoc:
  'GEMNAME [GEMNAME ...]       gem to generate YARD documentation'
end

#executeObject



18
19
20
21
22
# File 'lib/rubygems/commands/yardoc_command.rb', line 18

def execute
  get_all_gem_names.each do |name|
    self.class.run_yardoc Gem::Specification.find_by_name(name)
  end
end

#usageObject

:nodoc:



14
15
16
# File 'lib/rubygems/commands/yardoc_command.rb', line 14

def usage # :nodoc:
  "#{program_name} GEMNAME [GEMNAME ...]"
end