symbolize hash keys

This commit is contained in:
Ivan Smolin 2019-02-22 15:33:16 +03:00
parent b87aa69a4b
commit da9e84731b
1 changed files with 23 additions and 4 deletions

View File

@ -93,8 +93,8 @@ end
private_lane :syncCodeSigning do |options|
type = options[:type] || "development"
options_override = load_options_from("configurations.yaml")[type]
options.merge(options_override)
options_override = load_options_from("configurations.yaml")[type.to_sym]
options = options.merge(options_override)
match(
app_identifier: options[:app_identifier],
@ -107,7 +107,8 @@ private_lane :syncCodeSigning do |options|
git_branch: "fastlane_certificates",
keychain_password: options[:keychain_password],
skip_docs: true,
platform: "ios"
platform: "ios",
verbose: true
)
end
@ -131,8 +132,26 @@ def load_options_from(file_path)
if File.exists? file_path
require "yaml"
return YAML.load_file(file_path)
options = YAML.load_file(file_path)
return symbolize_keys(options)
end
return nil
end
# http://www.virtuouscode.com/2009/07/14/recursively-symbolize-keys/
def symbolize_keys(hash)
hash.inject({}){|result, (key, value)|
new_key = case key
when String then key.to_sym
else key
end
new_value = case value
when Hash then symbolize_keys(value)
else value
end
result[new_key] = new_value
result
}
end