Class: XcodeInstall::Command::Uninstall
- Inherits:
-
XcodeInstall::Command
- Object
- CLAide::Command
- XcodeInstall::Command
- XcodeInstall::Command::Uninstall
- Defined in:
- lib/xcode/install/uninstall.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Uninstall
constructor
A new instance of Uninstall.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Uninstall
Returns a new instance of Uninstall.
11 12 13 14 |
# File 'lib/xcode/install/uninstall.rb', line 11 def initialize(argv) @installer = Installer.new @version = argv.shift_argument end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/xcode/install/uninstall.rb', line 20 def run installed_path = @installer.installed_versions.select { |x| x.version == @version }.first return if installed_path.nil? || installed_path.path.nil? `sudo rm -rf #{installed_path.path}` if @installer.symlinks_to == '/Applications/Xcode-6.3.app' #installed_path.path newest_version = @installer.installed_versions.last @installer.symlink(newest_version) end end |
#validate! ⇒ Object
16 17 18 |
# File 'lib/xcode/install/uninstall.rb', line 16 def validate! raise Informative, "Version #{@version} is not installed." unless @installer.installed?(@version) end |