Class: Gem::Commands::CtagsCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCtagsCommand

Returns a new instance of CtagsCommand.



4
5
6
# File 'lib/rubygems/commands/ctags_command.rb', line 4

def initialize
  super 'ctags', 'Generate ctags for gems'
end

Class Method Details

.index(spec) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/rubygems/commands/ctags_command.rb', line 16

def self.index(spec)
  Dir.chdir(spec.full_gem_path) do
    unless File.exist?('tags')
      yield if block_given?
      paths = spec.require_paths.select { |p| File.directory?(p) }
      system('ctags', '-R', '--languages=ruby', *paths)
    end
  end
end

Instance Method Details

#executeObject



8
9
10
11
12
13
14
# File 'lib/rubygems/commands/ctags_command.rb', line 8

def execute
  Gem::Specification.each do |spec|
    self.class.index(spec) do
      say "Generating ctags for #{spec.full_name}"
    end
  end
end