Skip to content
Browse files

Encapsulate ctags invocation

  • Loading branch information...
1 parent 494b96c commit 16d4e86d71fdc84eb72ff7233e79833e43e126a1 @tpope committed Aug 22, 2011
Showing with 13 additions and 8 deletions.
  1. +11 −5 lib/rubygems/commands/ctags_command.rb
  2. +2 −3 lib/rubygems_plugin.rb
View
16 lib/rubygems/commands/ctags_command.rb
@@ -7,11 +7,17 @@ def initialize
def execute
Gem::Specification.each do |spec|
- Dir.chdir(spec.full_gem_path) do
- unless File.exist?('tags')
- say "Generating ctags for #{spec.full_name}"
- system('ctags', '-R', *spec.require_paths)
- end
+ self.class.index(spec) do
+ say "Generating ctags for #{spec.full_name}"
+ end
+ end
+ end
+
+ def self.index(spec)
+ Dir.chdir(spec.full_gem_path) do
+ unless File.exist?('tags')
+ yield if block_given?
+ system('ctags', '-R', *spec.require_paths)
end
end
end
View
5 lib/rubygems_plugin.rb
@@ -3,7 +3,6 @@
Gem::CommandManager.instance.register_command :ctags
Gem.post_install do |installer|
- Dir.chdir(installer.spec.full_gem_path) do
- system('ctags', '-R', *installer.spec.require_paths)
- end
+ require 'rubygems/commands/ctags_command'
+ Gem::Commands::CtagsCommand.index(installer.spec)
end

0 comments on commit 16d4e86

Please sign in to comment.
Something went wrong with that request. Please try again.