class XcodeInstall::Command::Uninstall

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/xcode/install/uninstall.rb, line 11
def initialize(argv)
  @installer = Installer.new
  @version = argv.shift_argument
  super
end

Public Instance Methods

run() click to toggle source
# File lib/xcode/install/uninstall.rb, line 24
def run
  installed_path = @installer.installed_versions.find { |x| x.version == @version }
  return if installed_path.nil? || installed_path.path.nil?

  `sudo rm -rf #{installed_path.path}`

  return unless @installer.symlinks_to == installed_path.path
  newest_version = @installer.installed_versions.last
  @installer.symlink(newest_version)
end
validate!() click to toggle source
Calls superclass method
# File lib/xcode/install/uninstall.rb, line 17
def validate!
  super
  help! 'A VERSION argument is required.' unless @version

  fail Informative, "Version #{@version} is not installed." unless @installer.installed?(@version)
end