Class: Gem::Uninstaller

Inherits:
Object show all
Defined in:
lib/bowline/dependencies/lib/ext/rubygems.rb

Class Method Summary collapse

Class Method Details

._uninstall(source_index, name, op, version) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bowline/dependencies/lib/ext/rubygems.rb', line 40

def self._uninstall(source_index, name, op, version)
  unless source_index.find_name(name, "#{op} #{version}").empty?
    uninstaller = Gem::Uninstaller.new(
      name,
      :version => "#{op} #{version}",
      :install_dir => File.join(Dir.pwd, "vendor", "gems"),
      :all => true,
      :ignore => true,
      :executables => true
    )
    _with_silent_ui { uninstaller.uninstall }
  end
end

._uninstall_others(source_index, name, version) ⇒ Object



54
55
56
57
# File 'lib/bowline/dependencies/lib/ext/rubygems.rb', line 54

def self._uninstall_others(source_index, name, version)
  _uninstall(source_index, name, "<", version)
  _uninstall(source_index, name, ">", version)
end

._with_silent_uiObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bowline/dependencies/lib/ext/rubygems.rb', line 26

def self._with_silent_ui

  ui = Gem::DefaultUserInteraction.ui
  def ui.say(str)
    puts "- #{str}"
  end

  yield

  class << Gem::DefaultUserInteraction.ui
    remove_method :say
  end
end