Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing the cli option retry_download_count to support simulator #405

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/xcode/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def fetch(url: nil,
progress_log_file = File.join(CACHE_DIR, "progress.#{Time.now.to_i}.progress")
FileUtils.rm_f(progress_log_file)

retry_options = ['--retry', '3']
gunesmes marked this conversation as resolved.
Show resolved Hide resolved
retry_options = ['--retry', retry_download_count]
command = [
'curl',
'--disable',
Expand Down
6 changes: 4 additions & 2 deletions lib/xcode/install/simulators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def self.options
[['--install=name', 'Install simulator beginning with name, e.g. \'iOS 8.4\', \'tvOS 9.0\'.'],
['--force', 'Install even if the same version is already installed.'],
['--no-install', 'Only download DMG, but do not install it.'],
['--no-progress', 'Don’t show download progress.']].concat(super)
['--no-progress', 'Don’t show download progress.'],
['--retry-download-count', 'Count of retrying download when curl is failed.']].concat(super)
gunesmes marked this conversation as resolved.
Show resolved Hide resolved
end

def initialize(argv)
Expand All @@ -19,6 +20,7 @@ def initialize(argv)
@force = argv.flag?('force', false)
@should_install = argv.flag?('install', true)
@progress = argv.flag?('progress', true)
@retry_download_count = argv.option('retry-download-count', '3')
super
end

Expand All @@ -42,7 +44,7 @@ def install
simulator = filtered_simulators.first
fail Informative, "#{simulator.name} is already installed." if simulator.installed? && !@force
puts "Installing #{simulator.name} for Xcode #{simulator.xcode.bundle_version}..."
simulator.install(@progress, @should_install)
simulator.install(@progress, @should_install, @retry_download_count.to_i)
gunesmes marked this conversation as resolved.
Show resolved Hide resolved
else
puts "[!] More than one simulator matching #{@install} was found. Please specify the full version.".ansi.red
filtered_simulators.each do |candidate|
Expand Down