From b87aa69a4b9c32f9effc3d9cc2b99853d69ccb8d Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Fri, 22 Feb 2019 14:40:46 +0300 Subject: [PATCH] small refactor --- xcode/commonFastfile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xcode/commonFastfile b/xcode/commonFastfile index f1eebb4..ccd1d76 100644 --- a/xcode/commonFastfile +++ b/xcode/commonFastfile @@ -93,13 +93,8 @@ end private_lane :syncCodeSigning do |options| type = options[:type] || "development" - configurations_path = "./fastlane/configurations.yaml" - if File.exists? configurations_path - require "yaml" - - configurations = YAML.load_file(configurations_path) - options.merge(configurations[type]) - end + options_override = load_options_from("configurations.yaml")[type] + options.merge(options_override) match( app_identifier: options[:app_identifier], @@ -131,3 +126,13 @@ private_lane :updateCodeSigning do |options| options[:readonly] = false syncCodeSigning(options) end + +def load_options_from(file_path) + if File.exists? file_path + require "yaml" + + return YAML.load_file(file_path) + end + + return nil +end