Sha256: 9ef8701e093fb5a2523f8d76f3e2262515b49b1b0b9e05f06b7cb1fd8914ee45

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

module XcodeInstall
  class Command
    class Uninstall < Command
      self.command = 'uninstall'
      self.summary = 'Uninstall a specific version of Xcode.'

      self.arguments = [
        CLAide::Argument.new('VERSION', :true)
      ]

      def initialize(argv)
        @installer = Installer.new
        @version = argv.shift_argument
      end

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

      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}`

        if @installer.symlinks_to == installed_path.path
          newest_version = @installer.installed_versions.last
          @installer.symlink(newest_version)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcode-install-0.3.3 lib/xcode/install/uninstall.rb
xcode-install-0.3.2 lib/xcode/install/uninstall.rb
xcode-install-0.3.1 lib/xcode/install/uninstall.rb