lib/deliver/upload_metadata.rb in deliver-1.3.0 vs lib/deliver/upload_metadata.rb in deliver-1.3.1
- old
+ new
@@ -16,19 +16,20 @@
:secondary_first_sub_category, :secondary_first_sub_category
]
# Make sure to call `load_from_filesystem` before calling upload
def upload(options)
+ return if options[:skip_metadata]
verify_available_languages!(options)
app = options[:app]
details = app.details
v = app.edit_version
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
- current = options[key]
+ current = options[key].to_s.strip
next unless current
unless current.kind_of?(Hash)
Helper.log.error "Error with provided '#{key}'. Must be a hash, the key being the language.".red
next
@@ -40,11 +41,11 @@
details.send(key)[language] = value if LOCALISED_APP_VALUES.include?(key)
end
end
(NON_LOCALISED_VERSION_VALUES + NON_LOCALISED_APP_VALUES).each do |key|
- current = options[key]
+ current = options[key].to_s.strip
next unless current.to_s.length > 0
v.send("#{key}=", current) if NON_LOCALISED_VERSION_VALUES.include?(key)
details.send("#{key}=", current) if NON_LOCALISED_APP_VALUES.include?(key)
end
@@ -59,10 +60,12 @@
Helper.log.info "Successfully uploaded initial set of metadata to iTunes Connect".green
end
# Makes sure all languages we need are actually created
def verify_available_languages!(options)
+ return if options[:skip_metadata]
+
# Collect all languages we need
# We only care about languages from user provided values
# as the other languages are on iTC already anyway
v = options[:app].edit_version
raise "Could not find a version to edit for app '#{options[:app].name}', the app metadata is read-only currently".red unless v
@@ -86,9 +89,11 @@
true
end
# Loads the metadata files and stores them into the options object
def load_from_filesystem(options)
+ return if options[:skip_metadata]
+
# Load localised data
Dir.glob(File.join(options[:metadata_path], "*")).each do |lng_folder|
next unless File.directory?(lng_folder) # We don't want to read txt as they are non localised
language = File.basename(lng_folder)