pilot/lib/pilot/build_manager.rb in fastlane-2.28.9 vs pilot/lib/pilot/build_manager.rb in fastlane-2.29.0.beta.20170421010107

- old
+ new

@@ -35,45 +35,26 @@ end UI.message("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option") latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete(app_id: app.apple_id, platform: platform) - distribute(options, build: latest_build) + distribute(options, latest_build) end - def distribute(options, build: nil) + def distribute(options, build) start(options) if config[:apple_id].to_s.length == 0 and config[:app_identifier].to_s.length == 0 config[:app_identifier] = UI.input("App Identifier: ") end - build ||= Spaceship::TestFlight::Build.latest(app_id: app.apple_id, platform: fetch_app_platform) - if build.nil? - UI.user_error!("No build to distribute!") - end - - if should_update_app_test_information?(options) - app_test_info = Spaceship::TestFlight::AppTestInfo.find(app_id: build.app_id) - app_test_info.test_info.feedback_email = options[:beta_app_feedback_email] if options[:beta_app_feedback_email] - app_test_info.test_info.description = options[:beta_app_description] if options[:beta_app_description] - begin - app_test_info.save_for_app!(app_id: build.app_id) - UI.success "Successfully set the beta_app_feedback_email and/or beta_app_description" - rescue => ex - UI.user_error!("Could not set beta_app_feedback_email and/or beta_app_description: #{ex}") + unless config[:update_build_info_on_upload] + if should_update_build_information(options) + build.update_build_information!(whats_new: options[:changelog], description: options[:beta_app_description], feedback_email: options[:beta_app_feedback_email]) + UI.success "Successfully set the changelog and/or description for build" end end - if should_update_build_information?(options) - begin - build.update_build_information!(whats_new: options[:changelog]) - UI.success "Successfully set the changelog for build" - rescue => ex - UI.user_error!("Could not set changelog: #{ex}") - end - end - return if config[:skip_submission] distribute_build(build, options) type = options[:distribute_external] ? 'External' : 'Internal' UI.success("Successfully distributed build to #{type} testers 🚀") end @@ -118,45 +99,37 @@ build.session_count] return row end - def should_update_build_information?(options) - options[:changelog].to_s.length > 0 + def should_update_build_information(options) + options[:changelog].to_s.length > 0 or options[:beta_app_description].to_s.length > 0 or options[:beta_app_feedback_email].to_s.length > 0 end - def should_update_app_test_information?(options) - options[:beta_app_description].to_s.length > 0 || options[:beta_app_feedback_email].to_s.length > 0 - end - def distribute_build(uploaded_build, options) UI.message("Distributing new build to testers: #{uploaded_build.train_version} - #{uploaded_build.build_version}") # This is where we could add a check to see if encryption is required and has been updated uploaded_build.export_compliance.encryption_updated = false + uploaded_build.beta_review_info.demo_account_required = false + uploaded_build.submit_for_testflight_review! if options[:distribute_external] - uploaded_build.beta_review_info.demo_account_required = false - uploaded_build.submit_for_testflight_review! external_group = Spaceship::TestFlight::Group.default_external_group(app_id: uploaded_build.app_id) uploaded_build.add_group!(external_group) unless external_group.nil? if external_group.nil? && options[:groups].nil? UI.user_error!("You must specify at least one group using the `:groups` option to distribute externally") end - if options[:groups] - groups = Spaceship::TestFlight::Group.filter_groups(app_id: uploaded_build.app_id) do |group| - options[:groups].include?(group.name) - end - groups.each do |group| - uploaded_build.add_group!(group) - end + end + + if options[:groups] + groups = Group.filter_groups(app_id: uploaded_build.app_id) do |group| + options[:groups].include?(group.name) end - else # distribute internally - # in case any changes to export_compliance are required - if uploaded_build.export_compliance_missing? - uploaded_build.save! + groups.each do |group| + uploaded_build.add_group!(group) end end true end