Class: Gem::Commands::EitCommand

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

Instance Method Summary collapse

Constructor Details

#initializeEitCommand



15
16
17
# File 'lib/rubygems/commands/eit_command.rb', line 15

def initialize
  super('eit', description)
end

Instance Method Details

#descriptionObject



11
12
13
# File 'lib/rubygems/commands/eit_command.rb', line 11

def description
  'Edit the gem for a given name or edit the file for a given require path'
end

#eitObject



32
33
34
# File 'lib/rubygems/commands/eit_command.rb', line 32

def eit
  ENV['GEM_EDITOR'] || ENV['EDITOR'] || 'vim'
end

#exec(*args) ⇒ Object



27
28
29
30
# File 'lib/rubygems/commands/eit_command.rb', line 27

def exec *args
  say(args.join(' '))
  super
end

#executeObject



19
20
21
22
23
24
25
# File 'lib/rubygems/commands/eit_command.rb', line 19

def execute
  ui = CapturedUI.new
  Gem::DefaultUserInteraction.use_ui(ui) do
    Gem::GemRunner.new.run(['path'] + options[:args])
  end
  exec(eit, ui.outs.string.strip)
end