Sha256: 14a809598bb820496e65a819313f55c14939ce1d833e23b86b3d88513fa99496

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

require 'stringio'

class CapturedUI < Gem::StreamUI
  def initialize
    super($stdin, StringIO.new, $stderr, false)
  end
end

class Gem::Commands::EitCommand < Gem::Command
  def description
    'Edit the gem for a given name or edit the file for a given require path'
  end

  def initialize
    super('eit', description)
  end

  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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-eit-0.6.0 lib/rubygems/commands/eit_command.rb