From c00cb10a8afdda0b61fa91576aafd39e8c1de6d4 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Fri, 7 Nov 2014 09:29:55 +0000 Subject: [PATCH] Added support for apps, not yet publicly available --- lib/assets/DeliverfileDefault | 1 + lib/deliver/app.rb | 11 +++++++++-- lib/deliver/deliverfile/deliverfile_creator.rb | 1 + spec/deliverfile_creator_spec.rb | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/assets/DeliverfileDefault b/lib/assets/DeliverfileDefault index 897a073..ec4d37d 100644 --- a/lib/assets/DeliverfileDefault +++ b/lib/assets/DeliverfileDefault @@ -9,6 +9,7 @@ email '[[EMAIL]]' # The app identifier is required app_identifier "[[APP_IDENTIFIER]]" +apple_id "[[APPLE_ID]]" # This folder has to include one folder for each language diff --git a/lib/deliver/app.rb b/lib/deliver/app.rb index 6268077..b835d37 100644 --- a/lib/deliver/app.rb +++ b/lib/deliver/app.rb @@ -43,8 +43,15 @@ def initialize(apple_id: nil, app_identifier: nil) begin self.apple_id = Deliver::ItunesSearchApi.fetch_by_identifier(app_identifier)['trackId'] rescue - Helper.log.fatal "Could not find Apple ID based on the app identifier '#{app_identifier}'. Maybe the app is not in the AppStore yet?" - raise "Please pass a valid Apple ID using 'apple_id'".red + unless Helper.is_test? + Helper.log.info "Could not find Apple ID based on the app identifier in the US App Store. Maybe the app is not yet in the store?".yellow + + while ((self.apple_id || '').to_s.length == 0) || ((self.apple_id || 0).to_i == 0) + self.apple_id = ask("\nApple ID of your app (e.g. 284882215): ") + end + else + raise "Please pass a valid Apple ID using 'apple_id'".red + end end end end diff --git a/lib/deliver/deliverfile/deliverfile_creator.rb b/lib/deliver/deliverfile/deliverfile_creator.rb index 5525389..3fd698e 100644 --- a/lib/deliver/deliverfile/deliverfile_creator.rb +++ b/lib/deliver/deliverfile/deliverfile_creator.rb @@ -86,6 +86,7 @@ def self.generate_deliver_file(app, path, project_name) deliver = File.read("#{gem_path}/lib/assets/DeliverfileDefault") deliver.gsub!("[[APP_IDENTIFIER]]", app.app_identifier) deliver.gsub!("[[APP_NAME]]", project_name) + deliver.gsub!("[[APPLE_ID]]", app.apple_id.to_s) deliver.gsub!("[[EMAIL]]", PasswordManager.shared_manager.username) return deliver diff --git a/spec/deliverfile_creator_spec.rb b/spec/deliverfile_creator_spec.rb index c5c6ad7..03202b3 100644 --- a/spec/deliverfile_creator_spec.rb +++ b/spec/deliverfile_creator_spec.rb @@ -60,6 +60,7 @@ correct.gsub!("[[APP_IDENTIFIER]]", 'net.sunapps.54') correct.gsub!("[[APP_NAME]]", project_name) correct.gsub!("[[EMAIL]]", ENV["DELIVER_USER"]) + correct.gsub!("[[APPLE_ID]]", apple_id.to_s) expect(File.read("/tmp/Deliverfile")).to eq(correct) expect(File.directory?([deliver_path, "screenshots"].join("/"))).to eq(true)