Class: XcodeInstall::Command::Install

Inherits:
XcodeInstall::Command show all
Defined in:
lib/xcode/install/install.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Install

Returns a new instance of Install.



19
20
21
22
23
24
25
26
27
28
# File 'lib/xcode/install/install.rb', line 19

def initialize(argv)
  @installer = Installer.new
  @version = argv.shift_argument
  @should_clean = argv.flag?('clean', true)
  @should_install = argv.flag?('install', true)
  @should_switch = argv.flag?('switch', true)
  @progress = argv.flag?('progress', true)
  @components = argv.flag?('components', true)
  super
end

Class Method Details

.optionsObject



11
12
13
14
15
16
17
# File 'lib/xcode/install/install.rb', line 11

def self.options
  [['--no-switch', 'Don’t switch to this version after installation'],
   ['--no-install', 'Only download DMG, but do not install it.'],
   ['--no-progress', 'Don’t show download progress.'],
   ['--no-install-components', 'Don’t install additional components.'],
   ['--no-clean', 'Don’t delete DMG after installation.']].concat(super)
end

Instance Method Details

#runObject



38
39
40
41
42
# File 'lib/xcode/install/install.rb', line 38

def run
  return if @version.nil?
  @installer.install_version(@version, @should_switch, @should_clean, @should_install,
    @progress, @components)
end

#validate!Object



30
31
32
33
34
35
36
# File 'lib/xcode/install/install.rb', line 30

def validate!
  super

  return if @version.nil?
  fail Informative, "Version #{@version} already installed." if @installer.installed?(@version)
  fail Informative, "Version #{@version} doesn't exist." unless @installer.exist?(@version)
end