Sha256: c81b2869935a27dfa498b77fab3d62298e7b2f13391f57040e59f2ee9ab311c6
Contents?: true
Size: 1.97 KB
Versions: 24
Compression:
Stored size: 1.97 KB
Contents
require 'fastlane_core/languages' module Deliver module Loader # The directory 'appleTV' and `iMessage` are special folders that will cause our screenshot gathering code to iterate # through it as well searching for language folders. APPLE_TV_DIR_NAME = "appleTV".freeze IMESSAGE_DIR_NAME = "iMessage".freeze DEFAULT_DIR_NAME = "default".freeze SPECIAL_DIR_NAMES = [APPLE_TV_DIR_NAME, IMESSAGE_DIR_NAME, DEFAULT_DIR_NAME].freeze EXCEPTION_DIRECTORIES = UploadMetadata::ALL_META_SUB_DIRS.map(&:downcase).freeze def self.language_folders(root, ignore_validation) folders = Dir.glob(File.join(root, '*')) if Helper.is_test? available_languages = FastlaneCore::Languages::ALL_LANGUAGES else available_languages = Spaceship::Tunes.client.available_languages.sort end allowed_directory_names_with_case = (available_languages + SPECIAL_DIR_NAMES) allowed_directory_names = allowed_directory_names_with_case.map(&:downcase).freeze selected_folders = folders.select do |path| File.directory?(path) && allowed_directory_names.include?(File.basename(path).downcase) end.sort # Gets list of folders that are not supported languages rejected_folders = folders.select do |path| normalized_path = File.basename(path).downcase File.directory?(path) && !allowed_directory_names.include?(normalized_path) && !EXCEPTION_DIRECTORIES.include?(normalized_path) end.sort if !ignore_validation && !rejected_folders.empty? rejected_folders = rejected_folders.map { |path| File.basename(path) } UI.user_error! "Unsupported directory name(s) for screenshots/metadata in '#{root}': #{rejected_folders.join(', ')}" \ "\nValid directory names are: #{allowed_directory_names_with_case}" \ "\n\nEnable 'ignore_language_directory_validation' to prevent this validation from happening" end selected_folders end end end
Version data entries
24 entries across 24 versions & 1 rubygems