From d4896b44f745be1eb0366af8f3ac1ebd9ee683ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 24 Apr 2023 16:58:23 +0200 Subject: [PATCH] refactor: migrate is_set method in helper (#1) --- .../plugin/android_cd/actions/build_and_deploy.rb | 8 ++------ .../plugin/android_cd/helper/android_cd_helper.rb | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy.rb b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy.rb index c980207..7cad159 100644 --- a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy.rb +++ b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy.rb @@ -1,11 +1,7 @@ require 'fastlane/action' require_relative '../helper/android_cd_helper' -def is_set variable - str_variable = variable - str_variable = variable.strip if variable.class.to_s == "String" - variable && !(str_variable.nil? || str_variable.empty?) -end + module Fastlane module Actions @@ -13,7 +9,7 @@ module Fastlane def self.run(params) # Check parameters - unless is_set(params[:beta_type]) + unless Helper::AndroidCdHelper.is_set(params[:beta_type]) UI.error("Parameters beta_type cannot be null") puts "Error on beta type parameter" end diff --git a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb index 5563430..8b5b256 100644 --- a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb +++ b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb @@ -21,6 +21,12 @@ module Fastlane puts "Erreur lors de la décompression du fichier GPG" end end + + def self.is_set variable + str_variable = variable + str_variable = variable.strip if variable.class.to_s == "String" + variable && !(str_variable.nil? || str_variable.empty?) + end end end end