Class: XcodeInstall::Command::Install
- Inherits:
-
XcodeInstall::Command
- Object
- CLAide::Command
- XcodeInstall::Command
- XcodeInstall::Command::Install
- Defined in:
- lib/xcode/install/install.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Install
constructor
A new instance of Install.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from XcodeInstall::Command
Constructor Details
#initialize(argv) ⇒ Install
Returns a new instance of Install.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/xcode/install/install.rb', line 21 def initialize(argv) @installer = Installer.new @version = argv.shift_argument @url = argv.option('url') @should_clean = argv.flag?('clean', true) @should_install = argv.flag?('install', true) @should_switch = argv.flag?('switch', true) @progress = argv.flag?('progress', true) super end |
Class Method Details
.options ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/xcode/install/install.rb', line 13 def self. [['--url', 'Custom Xcode DMG file path or HTTP URL.'], ['--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-clean', 'Don’t delete DMG after installation.']].concat(super) end |
Instance Method Details
#run ⇒ Object
41 42 43 44 |
# File 'lib/xcode/install/install.rb', line 41 def run @installer.install_version(@version, @should_switch, @should_clean, @should_install, @progress, @url) end |
#validate! ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/xcode/install/install.rb', line 32 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) fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/ end |