Sha256: 5bc9a5ccfd7fe508205fcf7bacddff6bd01f5acf19828d8dcc7d1234bf21b808

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

require 'fileutils'

class Uninstaller
  def initialize(version)
    @version = version
  end

  def uninstall
    current  = get_current_dir
    vims_dir = get_vims_dir(@version)
    src_dir  = get_src_dir(@version)
    if Dir.exists?(current)
      target = File.readlink(current)
      if target == vims_dir
        abort "#{@version} can not be uninstalled; it is currently used."
      end
    end
    if Dir.exists?(src_dir)
      FileUtils.rm_rf(src_dir)
    end
    if Dir.exists?(vims_dir)
      FileUtils.rm_rf(vims_dir)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vvm-rb-0.0.4 lib/vvm-rb/uninstaller.rb