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.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xcode/install/install.rb', line 23 def initialize(argv) @installer = Installer.new @version = argv.shift_argument @version ||= File.read('.xcode-version') if File.exist?('.xcode-version') @url = argv.option('url') @force = argv.flag?('force', false) @should_clean = argv.flag?('clean', true) @should_install = argv.flag?('install', true) @should_switch = argv.flag?('switch', true) @progress = argv.flag?('progress', true) @show_release_notes = argv.flag?('show-release-notes', true) super end |
Class Method Details
.options ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/xcode/install/install.rb', line 13 def self. [['--url', 'Custom Xcode DMG file path or HTTP URL.'], ['--force', 'Install even if the same version is already installed.'], ['--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.'], ['--no-show-release-notes', 'Don’t open release notes in browser after installation.']].concat(super) end |
Instance Method Details
#run ⇒ Object
49 50 51 52 |
# File 'lib/xcode/install/install.rb', line 49 def run @installer.install_version(@version, @should_switch, @should_clean, @should_install, @progress, @url, @show_release_notes) end |
#validate! ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/xcode/install/install.rb', line 37 def validate! super help! 'A VERSION argument is required.' unless @version if @installer.installed?(@version) && !@force print "Version #{@version} already installed." exit(0) end fail Informative, "Version #{@version} doesn't exist." unless @url || @installer.exist?(@version) fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/ end |