gym/lib/gym/detect_values.rb in fastlane-2.98.0 vs gym/lib/gym/detect_values.rb in fastlane-2.99.0
- old
+ new
@@ -24,10 +24,12 @@
Dir.chdir(project_path) do
config.load_configuration_file(Gym.gymfile_name)
end
end
+ ensure_export_options_is_hash
+
detect_scheme
detect_platform # we can only do that *after* we have the scheme
detect_selected_provisioning_profiles # we can only do that *after* we have the platform
detect_configuration
detect_toolchain
@@ -141,8 +143,29 @@
# Convert the aliases to the full string to make it easier for the user #justfastlanethings
if Gym.config[:toolchain].to_s == "swift_2_3"
Gym.config[:toolchain] = "com.apple.dt.toolchain.Swift_2_3"
end
+ end
+
+ def self.ensure_export_options_is_hash
+ return if Gym.config[:export_options].nil? || Gym.config[:export_options].kind_of?(Hash)
+
+ # Reads options from file
+ plist_file_path = Gym.config[:export_options]
+ UI.user_error!("Couldn't find plist file at path #{File.expand_path(plist_file_path)}") unless File.exist?(plist_file_path)
+ hash = Plist.parse_xml(plist_file_path)
+ UI.user_error!("Couldn't read provided plist at path #{File.expand_path(plist_file_path)}") if hash.nil?
+ # Convert keys to symbols
+ Gym.config[:export_options] = keys_to_symbols(hash)
+ end
+
+ def self.keys_to_symbols(hash)
+ # Convert keys to symbols
+ hash = hash.each_with_object({}) do |(k, v), memo|
+ memo[k.b.to_s.to_sym] = v
+ memo
+ end
+ hash
end
end
end