File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
lib/commands/build/distribution Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change 33require 'zip'
44require 'rbconfig'
55require 'tmpdir'
6+ require 'tty-prompt'
67
78module EmergeCLI
89 module Commands
@@ -49,10 +50,32 @@ def call(**options)
4950 app_id = response [ 'appId' ]
5051
5152 extension = platform == 'ios' ? 'ipa' : 'apk'
52- Logger . info 'Downloading build...'
5353 output_name = @options [ :output ] || "#{ @options [ :build_id ] } .#{ extension } "
54- `curl --progress-bar -L '#{ download_url } ' -o #{ output_name } `
55- Logger . info "✅ Build downloaded to #{ output_name } "
54+
55+ if File . exist? ( output_name )
56+ Logger . info "Build file already exists at #{ output_name } "
57+ prompt = TTY ::Prompt . new
58+ choice = prompt . select ( 'What would you like to do?' , {
59+ 'Install existing file' => :install ,
60+ 'Overwrite with new download' => :overwrite ,
61+ 'Cancel' => :cancel
62+ } )
63+
64+ case choice
65+ when :install
66+ Logger . info 'Proceeding with existing file...'
67+ when :overwrite
68+ Logger . info 'Downloading new build...'
69+ `curl --progress-bar -L '#{ download_url } ' -o #{ output_name } `
70+ Logger . info "✅ Build downloaded to #{ output_name } "
71+ when :cancel
72+ raise 'Operation cancelled by user'
73+ end
74+ else
75+ Logger . info 'Downloading build...'
76+ `curl --progress-bar -L '#{ download_url } ' -o #{ output_name } `
77+ Logger . info "✅ Build downloaded to #{ output_name } "
78+ end
5679 rescue StandardError => e
5780 Logger . error "❌ Failed to download build: #{ e . message } "
5881 raise e
You can’t perform that action at this time.
0 commit comments