@@ -10,6 +10,8 @@ USER_ENV_FILE_PATH = File.join(Dir.home, '.wcios-env.default')
1010SECRETS_DIR = File . join ( Dir . home , '.configure' , 'woocommerce-ios' , 'secrets' )
1111PROJECT_ENV_FILE_PATH = File . join ( SECRETS_DIR , 'project.env' )
1212
13+ GHHELPER_REPO = 'woocommerce/woocommerce-ios'
14+
1315# Constants
1416PROJECT_ROOT_FOLDER = File . dirname ( File . expand_path ( __dir__ ) )
1517RESOURCES_FOLDER = File . join ( PROJECT_ROOT_FOLDER , 'WooCommerce' , 'Resources' )
@@ -89,7 +91,7 @@ GLOTPRESS_TO_ASC_METADATA_LOCALE_CODES = {
8991 'sv' => 'sv' ,
9092 'tr' => 'tr' ,
9193 'zh-cn' => 'zh-Hans' ,
92- 'zh-tw' => 'zh-Hant' ,
94+ 'zh-tw' => 'zh-Hant'
9395} . freeze
9496
9597ASC_KEY_PATH = File . join ( SECRETS_DIR , 'app_store_connect_fastlane_api_key.json' )
@@ -100,7 +102,7 @@ def get_required_env(key)
100102 unless ENV . key? ( key )
101103 UI . user_error! ( "Environment variable '#{ key } ' is not set. Have you setup #{ USER_ENV_FILE_PATH } correctly?" )
102104 end
103- ENV [ key ]
105+ ENV . fetch ( key )
104106end
105107
106108before_all do |lane |
@@ -127,17 +129,12 @@ platform :ios do
127129 ########################################################################
128130 Dotenv . load ( USER_ENV_FILE_PATH )
129131 Dotenv . load ( PROJECT_ENV_FILE_PATH )
130- ENV [ GHHELPER_REPO = 'woocommerce/woocommerce-iOS' ]
131132 ENV [ 'PROJECT_NAME' ] = 'WooCommerce'
132133 ENV [ 'PUBLIC_CONFIG_FILE' ] = 'config/Version.Public.xcconfig'
133134 ENV [ 'PROJECT_ROOT_FOLDER' ] = './'
134135 ENV [ 'APP_STORE_STRINGS_FILE_NAME' ] = 'AppStoreStrings.pot'
135136 ENV [ 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH' ] = 'trunk'
136137
137- # Other defines used across multiple lanes
138- REPOSITORY_NAME = 'woocommerce-ios'
139- GH_ORG_NAME = 'woocommerce'
140-
141138 ########################################################################
142139 # Release Lanes
143140 ########################################################################
@@ -334,7 +331,7 @@ platform :ios do
334331 version = ios_get_app_version
335332 removebranchprotection ( repository : GHHELPER_REPO , branch : "release/#{ version } " )
336333 setfrozentag ( repository : GHHELPER_REPO , milestone : version , freeze : false )
337- create_new_milestone ( repository :GHHELPER_REPO , need_appstore_submission : true , milestone_duration :7 , number_of_days_from_code_freeze_to_release : 10 )
334+ create_new_milestone ( repository : GHHELPER_REPO , need_appstore_submission : true , milestone_duration : 7 , number_of_days_from_code_freeze_to_release : 10 )
338335 close_milestone ( repository : GHHELPER_REPO , milestone : version )
339336
340337 # Start the build
@@ -502,7 +499,7 @@ platform :ios do
502499 export_method : 'enterprise' ,
503500 clean : true ,
504501 output_directory : 'build' ,
505- export_team_id : ENV [ 'INT_EXPORT_TEAM_ID' ] ,
502+ export_team_id : ENV . fetch ( 'INT_EXPORT_TEAM_ID' ) ,
506503 export_options : { method : 'enterprise' , iCloudContainerEnvironment : 'Production' }
507504 )
508505
@@ -540,7 +537,7 @@ platform :ios do
540537
541538 comment_on_pr (
542539 project : 'woocommerce/woocommerce-ios' ,
543- pr_number : Integer ( ENV [ 'BUILDKITE_PULL_REQUEST' ] ) ,
540+ pr_number : Integer ( ENV . fetch ( 'BUILDKITE_PULL_REQUEST' ) ) ,
544541 reuse_identifier : 'installable-build-link' ,
545542 body : comment_body
546543 )
@@ -727,7 +724,7 @@ platform :ios do
727724 runtime = SimCtl . runtime ( name : "iOS #{ SIMULATOR_VERSION } " )
728725 devicetype = SimCtl . devicetype ( name : device )
729726
730- device = SimCtl . create_device device , devicetype , runtime
727+ SimCtl . create_device ( device , devicetype , runtime )
731728 end
732729 end
733730
@@ -793,11 +790,11 @@ platform :ios do
793790 # FIXME: Replace this with a call to the future replacement of `gp_downloadmetadata` once it's implemented in the release-toolkit (see paaHJt-31O-p2).
794791 locales_map = GLOTPRESS_TO_ASC_METADATA_LOCALE_CODES
795792 target_files = {
796- "v#{ ios_get_app_version } -whats-new" : { desc : " release_notes.txt" , max_size : 4000 } ,
797- app_store_name : { desc : " name.txt" , max_size : 30 } ,
798- app_store_subtitle : { desc : " subtitle.txt" , max_size : 30 } ,
799- app_store_desc : { desc : " description.txt" , max_size : 4000 } ,
800- app_store_keywords : { desc : " keywords.txt" , max_size : 100 } ,
793+ "v#{ ios_get_app_version } -whats-new" : { desc : ' release_notes.txt' , max_size : 4000 } ,
794+ app_store_name : { desc : ' name.txt' , max_size : 30 } ,
795+ app_store_subtitle : { desc : ' subtitle.txt' , max_size : 30 } ,
796+ app_store_desc : { desc : ' description.txt' , max_size : 4000 } ,
797+ app_store_keywords : { desc : ' keywords.txt' , max_size : 100 }
801798 }
802799
803800 gp_downloadmetadata (
@@ -811,14 +808,17 @@ platform :ios do
811808 # Ensure that none of the `.txt` files in `en-US` would accidentally override our originals in `default`
812809 target_files . values . map { |h | h [ :desc ] } . each do |file |
813810 en_file_path = File . join ( metadata_directory , 'en-US' , file )
814- UI . user_error! ( "File `#{ en_file_path } ` would override the same one in `#{ metadata_directory } /default`, but `default/` is the source of truth. " \
815- + "Delete the `#{ en_file_path } ` file, ensure the `default/` one has the expected original copy, and try again." ) if File . exist? ( en_file_path )
811+ if File . exist? ( en_file_path )
812+ UI . user_error! ( "File `#{ en_file_path } ` would override the same one in `#{ metadata_directory } /default`, but `default/` is the source of truth. " \
813+ + "Delete the `#{ en_file_path } ` file, ensure the `default/` one has the expected original copy, and try again." )
814+ end
816815 end
817816
818817 # Ensure even empty locale folders have an empty `.gitkeep` file (in case we don't have any translation at all ready for some locales)
819- locales_map . values . each do |locale |
818+ locales_map . each_value do |locale |
820819 gitkeep = File . join ( metadata_directory , locale , '.gitkeep' )
821820 next if File . exist? ( gitkeep )
821+
822822 FileUtils . mkdir_p ( File . dirname ( gitkeep ) )
823823 FileUtils . touch ( gitkeep )
824824 files_to_commit . append ( gitkeep )
@@ -966,11 +966,11 @@ platform :ios do
966966 'Pods/WordPress*/' ,
967967 'Storage/Storage/' ,
968968 'Networking/Networking/' ,
969- 'Hardware/Hardware/' ,
969+ 'Hardware/Hardware/'
970970 ] ,
971971 exclude : [
972972 '*Vendor*' ,
973- 'WooCommerce/WooCommerceTests/**' , # Some unit tests include localized strings, but we don't want to crowd GlotPress with them
973+ 'WooCommerce/WooCommerceTests/**' # Some unit tests include localized strings, but we don't want to crowd GlotPress with them
974974 ] ,
975975 output_dir : en_lproj_path
976976 )
@@ -1081,10 +1081,10 @@ end
10811081# Generates Installable Build Version Numbers in a Buildkite-specific way
10821082# -----------------------------------------------------------------------------------
10831083def generate_installable_build_number
1084- if ENV [ 'BUILDKITE' ]
1085- commit = ENV [ 'BUILDKITE_COMMIT' ] [ 0 , 7 ]
1086- branch = ENV [ 'BUILDKITE_BRANCH' ]
1087- pr_num = ENV [ 'BUILDKITE_PULL_REQUEST' ]
1084+ if ENV . key? ( 'BUILDKITE' )
1085+ commit = ENV . fetch ( 'BUILDKITE_COMMIT' ) [ 0 , 7 ]
1086+ branch = ENV . fetch ( 'BUILDKITE_BRANCH' )
1087+ pr_num = ENV . fetch ( 'BUILDKITE_PULL_REQUEST' )
10881088
10891089 pr_num == 'false' ? "#{ branch } -#{ commit } " : "pr#{ pr_num } -#{ commit } "
10901090 else
0 commit comments