lib/xcode/install/install.rb in xcode-install-2.6.6 vs lib/xcode/install/install.rb in xcode-install-2.6.7
- old
+ new
@@ -15,11 +15,12 @@
['--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)
+ ['--no-show-release-notes', 'Don’t open release notes in browser after installation.'],
+ ['--retry-download-count', 'Count of retrying download when curl is failed.']].concat(super)
end
def initialize(argv)
@installer = Installer.new
@version = argv.shift_argument
@@ -29,10 +30,11 @@
@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)
+ @retry_download_count = argv.option('retry-download-count', '3')
super
end
def validate!
super
@@ -42,14 +44,15 @@
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/
+ fail Informative, "Invalid Retry: `#{@retry_download_count} is not positive number.`" if (@retry_download_count =~ /\A[0-9]*\z/).nil?
end
def run
@installer.install_version(@version, @should_switch, @should_clean, @should_install,
- @progress, @url, @show_release_notes)
+ @progress, @url, @show_release_notes, nil, @retry_download_count.to_i)
end
end
end
end