From 289802d9bcb997e7889f3782ed78fc084364f193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Wed, 5 Jul 2023 16:40:45 +0200 Subject: [PATCH] docs: add some comments --- .../plugin/ios_cd/helper/ios_cd_helper.rb | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb index 24178ad..e7b2ccf 100644 --- a/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb +++ b/plugins/fastlane-plugin-ios_cd/lib/fastlane/plugin/ios_cd/helper/ios_cd_helper.rb @@ -41,27 +41,30 @@ module Fastlane UI.user_error!("❌ Ios credentials doesn't exist") puts("json file doesn't exist") end + end - def self.check_required_fields(required_fields, json) - missing_fields = required_fields - json + # Check json fields + def self.check_required_fields(required_fields, json) + missing_fields = required_fields - json - unless missing_fields.empty? - raise ArgumentError, "❌ missing keys in credential json file : #{missing_fields}" + unless missing_fields.empty? + raise ArgumentError, "❌ missing keys in credential json file : #{missing_fields}" + end + end + + # Check if set of environment variables are defined + def self.check_environment_variables(variables) + variables.each do |variable| + unless ENV.key?(variable) + raise "❌ The environment variable '#{variable}' is not defined." end end + end - def self.check_environment_variables(variables) - variables.each do |variable| - unless ENV.key?(variable) - raise "❌ The environment variable '#{variable}' is not defined." - end - end - end - - def self.delete_artifacts(artifacts) - artifacts.each do |file| - File.delete(file) if File.exist?(file) - end + # Delete built files + def self.delete_artifacts(artifacts) + artifacts.each do |file| + File.delete(file) if File.exist?(file) end end end