fastlane-plugin-wpmreleasetoolkit 9.4.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +1 -1
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +2 -2
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +1 -3
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +9 -24
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +8 -19
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +2 -2
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +9 -21
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +9 -21
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +6 -18
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +8 -22
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +7 -20
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +5 -16
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +5 -16
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +2 -5
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +5 -4
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +5 -16
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +2 -2
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +5 -16
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +5 -16
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +5 -16
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +6 -18
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +1 -3
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +4 -4
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +2 -2
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +5 -5
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb +0 -11
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb +0 -11
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/{setfrozentag_action.rb → set_milestone_frozen_marker_action.rb} +14 -18
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/{update_pull_requests_milestone_action.rb → update_assigned_milestone_action.rb} +31 -31
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +3 -3
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +1 -3
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +5 -7
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +10 -12
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +1 -1
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +1 -1
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +4 -4
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +3 -2
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +1 -1
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +1 -1
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +2 -2
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +1 -1
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +1 -1
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +1 -1
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb +3 -3
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +1 -1
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_generate_strings_file_from_code.rb +1 -1
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +1 -1
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_number.rb +1 -1
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +2 -2
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +1 -1
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +3 -3
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_strings_files.rb +1 -1
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb +1 -1
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +1 -1
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +5 -5
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +2 -4
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +2 -2
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb +1 -1
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +0 -3
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +27 -27
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +29 -34
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +20 -21
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +1 -1
  67. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +18 -8
  68. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +8 -8
  69. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +1 -1
  70. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb +1 -1
  71. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +7 -3
  72. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +4 -4
  73. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +4 -4
  74. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +11 -11
  75. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +9 -5
  76. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +14 -16
  77. data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +7 -7
  78. data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +7 -7
  79. data/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb +1 -1
  80. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  81. metadata +14 -17
  82. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +0 -72
  83. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +0 -64
  84. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/deprecated.rb +0 -66
@@ -30,11 +30,10 @@ module Fastlane
30
30
  # - If this version is a hotfix (more than 2 parts and 3rd part is non-zero), returns the "X.Y.Z" formatted string
31
31
  # - Otherwise (not a hotfix / 3rd part of version is 0), returns "X.Y" formatted version number
32
32
  #
33
- def self.get_public_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
33
+ def self.get_public_version(build_gradle_path:, version_properties_path:)
34
34
  version = get_release_version(
35
35
  build_gradle_path: build_gradle_path,
36
- version_properties_path: version_properties_path,
37
- has_alpha_version: has_alpha_version
36
+ version_properties_path: version_properties_path
38
37
  )
39
38
  vp = get_version_parts(version[VERSION_NAME])
40
39
  return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" unless is_hotfix?(version)
@@ -46,13 +45,13 @@ module Fastlane
46
45
  #
47
46
  # @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
48
47
  #
49
- def self.get_release_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
48
+ def self.get_release_version(build_gradle_path:, version_properties_path:)
50
49
  return get_version_from_properties(version_properties_path: version_properties_path) if File.exist?(version_properties_path)
51
50
 
52
- section = has_alpha_version.nil? ? 'defaultConfig' : 'vanilla {'
51
+ section = 'defaultConfig'
53
52
  name = get_version_name_from_gradle_file(build_gradle_path, section)
54
53
  code = get_version_build_from_gradle_file(build_gradle_path, section)
55
- return { VERSION_NAME => name, VERSION_CODE => code }
54
+ { VERSION_NAME => name, VERSION_CODE => code }
56
55
  end
57
56
 
58
57
  # Extract the version name and code from the `version.properties` file in the project root
@@ -71,23 +70,20 @@ module Fastlane
71
70
  name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
72
71
  code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
73
72
 
74
- return name.nil? || code.nil? ? nil : { VERSION_NAME => name, VERSION_CODE => code.to_i }
73
+ name.nil? || code.nil? ? nil : { VERSION_NAME => name, VERSION_CODE => code.to_i }
75
74
  end
76
75
 
77
76
  # Extract the version name and code from the `version.properties` file in the project root
78
77
  #
79
- # @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
80
- # or `nil` if `$HAS_ALPHA_VERSION` is not defined.
78
+ # @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively
81
79
  #
82
- def self.get_alpha_version(build_gradle_path:, version_properties_path:, has_alpha_version:)
80
+ def self.get_alpha_version(build_gradle_path:, version_properties_path:)
83
81
  return get_version_from_properties(version_properties_path: version_properties_path, is_alpha: true) if File.exist?(version_properties_path)
84
82
 
85
- return nil if has_alpha_version.nil?
86
-
87
83
  section = 'defaultConfig'
88
84
  name = get_version_name_from_gradle_file(build_gradle_path, section)
89
85
  code = get_version_build_from_gradle_file(build_gradle_path, section)
90
- return { VERSION_NAME => name, VERSION_CODE => code }
86
+ { VERSION_NAME => name, VERSION_CODE => code }
91
87
  end
92
88
 
93
89
  # Determines if a version name corresponds to an alpha version (starts with `"alpha-"`` prefix)
@@ -185,8 +181,8 @@ module Fastlane
185
181
  # @return [String] The version name for the next release
186
182
  #
187
183
  def self.calc_next_release_short_version(version)
188
- v = self.calc_next_release_base_version(VERSION_NAME => version, VERSION_CODE => nil)
189
- return v[VERSION_NAME]
184
+ v = calc_next_release_base_version(VERSION_NAME => version, VERSION_CODE => nil)
185
+ v[VERSION_NAME]
190
186
  end
191
187
 
192
188
  # Compute the next release version name for the given version, without incrementing the version code
@@ -251,7 +247,7 @@ module Fastlane
251
247
  #
252
248
  def self.calc_prev_release_version(version)
253
249
  vp = get_version_parts(version)
254
- if vp[MINOR_NUMBER] == 0
250
+ if (vp[MINOR_NUMBER]).zero?
255
251
  vp[MAJOR_NUMBER] -= 1
256
252
  vp[MINOR_NUMBER] = 9
257
253
  else
@@ -271,26 +267,23 @@ module Fastlane
271
267
  return false if is_alpha_version?(version)
272
268
 
273
269
  vp = get_version_parts(version[VERSION_NAME])
274
- return (vp.length > 2) && (vp[HOTFIX_NUMBER] != 0)
270
+ (vp.length > 2) && (vp[HOTFIX_NUMBER] != 0)
275
271
  end
276
272
 
277
273
  # Prints the current and next release version names to stdout, then returns the next release version
278
274
  #
279
275
  # @return [String] The next release version name to use after bumping the currently used release version.
280
276
  #
281
- def self.bump_version_release(build_gradle_path:, version_properties_path:, has_alpha_version:)
277
+ def self.bump_version_release(build_gradle_path:, version_properties_path:)
282
278
  # Bump release
283
- current_version = self.get_release_version(
279
+ current_version = get_release_version(
284
280
  build_gradle_path: build_gradle_path,
285
- version_properties_path: version_properties_path,
286
- has_alpha_version: has_alpha_version
281
+ version_properties_path: version_properties_path
287
282
  )
288
283
  UI.message("Current version: #{current_version[VERSION_NAME]}")
289
284
  new_version = calc_next_release_base_version(current_version)
290
285
  UI.message("New version: #{new_version[VERSION_NAME]}")
291
- verified_version = verify_version(new_version[VERSION_NAME])
292
-
293
- return verified_version
286
+ verify_version(new_version[VERSION_NAME])
294
287
  end
295
288
 
296
289
  # Update the `version.properties` file with new `versionName` and `versionCode` values
@@ -298,7 +291,7 @@ module Fastlane
298
291
  # @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
299
292
  # @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
300
293
  #
301
- def self.update_versions(new_version_beta, new_version_alpha, version_properties_path:, has_alpha_version:)
294
+ def self.update_versions(new_version_beta, new_version_alpha, version_properties_path:)
302
295
  if File.exist?(version_properties_path)
303
296
  replacements = {
304
297
  versionName: (new_version_beta || {})[VERSION_NAME],
@@ -314,8 +307,8 @@ module Fastlane
314
307
  end
315
308
  File.write(version_properties_path, content)
316
309
  else
317
- self.update_version(new_version_beta, has_alpha_version.nil? ? 'defaultConfig' : 'vanilla {')
318
- self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
310
+ update_version(new_version_beta, 'defaultConfig')
311
+ update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
319
312
  end
320
313
  end
321
314
 
@@ -328,8 +321,8 @@ module Fastlane
328
321
  #
329
322
  def self.calc_prev_hotfix_version_name(version_name)
330
323
  vp = get_version_parts(version_name)
331
- vp[HOTFIX_NUMBER] -= 1 unless vp[HOTFIX_NUMBER] == 0
332
- return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}" unless vp[HOTFIX_NUMBER] == 0
324
+ vp[HOTFIX_NUMBER] -= 1 unless (vp[HOTFIX_NUMBER]).zero?
325
+ return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}" unless (vp[HOTFIX_NUMBER]).zero?
333
326
 
334
327
  "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}"
335
328
  end
@@ -372,7 +365,7 @@ module Fastlane
372
365
  def self.get_version_parts(version)
373
366
  parts = version.split('.').map(&:to_i)
374
367
  parts.fill(0, parts.length...3) # add 0 if needed to ensure array has at least 3 components
375
- return parts
368
+ parts
376
369
  end
377
370
 
378
371
  # Ensure that a version string is correctly formatted (that is, each of its parts is a number) and returns the 2-parts version number
@@ -399,7 +392,9 @@ module Fastlane
399
392
  # @return [Bool] true if the string is representing an integer value, false if not
400
393
  #
401
394
  def self.is_int?(string)
402
- true if Integer(string) rescue false
395
+ true if Integer(string)
396
+ rescue StandardError
397
+ false
403
398
  end
404
399
 
405
400
  #########
@@ -416,7 +411,7 @@ module Fastlane
416
411
  def self.get_version_name_from_gradle_file(file_path, section)
417
412
  res = get_keyword_from_gradle_file(file_path, section, 'versionName')
418
413
  res = res.tr('\"', '') unless res.nil?
419
- return res
414
+ res
420
415
  end
421
416
 
422
417
  # Extract the versionCode rom a build.gradle file
@@ -428,7 +423,7 @@ module Fastlane
428
423
  #
429
424
  def self.get_version_build_from_gradle_file(file_path, section)
430
425
  res = get_keyword_from_gradle_file(file_path, section, 'versionCode')
431
- return res.to_i
426
+ res.to_i
432
427
  end
433
428
 
434
429
  # Extract the value for a specific keyword in a specific section of a `.gradle` file
@@ -453,7 +448,7 @@ module Fastlane
453
448
  end
454
449
  end
455
450
  end
456
- return nil
451
+ nil
457
452
  end
458
453
 
459
454
  # Update both the versionName and versionCode of the build.gradle file to the specified version.
@@ -1,3 +1,4 @@
1
+ require 'English'
1
2
  require 'fastlane_core/ui/ui'
2
3
  require 'fileutils'
3
4
 
@@ -12,7 +13,7 @@ module Fastlane
12
13
  ### If the file doesn't exist, it'll return an empty Configuration
13
14
  ### that can later be saved to `.configure`.
14
15
  def self.configuration
15
- if self.configuration_path_exists
16
+ if configuration_path_exists
16
17
  Configuration.from_file(FilesystemHelper.configure_file)
17
18
  else
18
19
  Configuration.new
@@ -95,13 +96,13 @@ module Fastlane
95
96
  ### Returns whether or not the `.configure` file has a pinned hash that's older than the most recent
96
97
  ### ~/.mobile-secrets` commit hash.
97
98
  def self.configure_file_is_behind_local
98
- configure_file_commits_behind_repo > 0
99
+ configure_file_commits_behind_repo.positive?
99
100
  end
100
101
 
101
102
  def self.configure_file_commits_behind_repo
102
103
  # Get a sily number of revisions to ensure we don't miss any
103
104
  result = `cd #{repository_path} && git --no-pager log -10000 --pretty=format:"%H" && echo`
104
- hashes = result.each_line.map { |s| s.strip }.reverse
105
+ hashes = result.each_line.map(&:strip).reverse
105
106
 
106
107
  index_of_configure_hash = hashes.find_index(configure_file_commit_hash)
107
108
  index_of_repo_commit_hash = hashes.find_index(repo_commit_hash)
@@ -114,13 +115,13 @@ module Fastlane
114
115
  ### Get a list of files changed in the secrets repo between to commits
115
116
  def self.files_changed_between(commit_hash_1, commit_hash_2)
116
117
  result = `cd #{repository_path} && git diff --name-only #{commit_hash_1}...#{commit_hash_2}`
117
- result.each_line.map { |s| s.strip }
118
+ result.each_line.map(&:strip)
118
119
  end
119
120
 
120
121
  ### Determine whether ~/.mobile-secrets` repository is behind its remote counterpart.
121
122
  ### (ie – the remote repo has changes that the local repo doesn't)
122
123
  def self.repo_is_behind_remote
123
- repo_commits_behind_remote > 0
124
+ repo_commits_behind_remote.positive?
124
125
  end
125
126
 
126
127
  ### Determine how far behind the remote repo the ~/.mobile-secrets` repository is.
@@ -135,7 +136,7 @@ module Fastlane
135
136
  ### Determine whether ~/.mobile-secrets` repository is ahead of its remote counterpart.
136
137
  ### (ie – the local repo has changes that the remote repo doesn't)
137
138
  def self.repo_is_ahead_of_remote
138
- repo_commits_ahead_of_remote > 0
139
+ repo_commits_ahead_of_remote.positive?
139
140
  end
140
141
 
141
142
  ### Determine how far ahead of the remote repo the ~/.mobile-secrets` repository is.
@@ -173,38 +174,36 @@ module Fastlane
173
174
 
174
175
  ### Returns the list of files to copy from `.configure`.
175
176
  def self.files_to_copy
176
- self.configuration.files_to_copy
177
+ configuration.files_to_copy
177
178
  end
178
179
 
179
180
  ### Returns the list of files that this project uses from `.configure`.
180
181
  def self.file_dependencies
181
- file_dependencies = self.configuration.file_dependencies
182
+ file_dependencies = configuration.file_dependencies
182
183
  file_dependencies ||= []
183
184
 
184
185
  # Allows support for specifying directories – they'll be expanded recursively
185
186
  expanded_file_dependencies = file_dependencies.map do |path|
186
- abs_path = self.mobile_secrets_path(path)
187
-
188
- if File.directory?(abs_path)
189
- Dir.glob("#{abs_path}**/*").map do |sub_path|
190
- sub_path.gsub("#{repository_path}/", '')
191
- end
192
- else
193
- return path
187
+ abs_path = mobile_secrets_path(path)
188
+
189
+ return path unless File.directory?(abs_path)
190
+
191
+ Dir.glob("#{abs_path}**/*").map do |sub_path|
192
+ sub_path.gsub("#{repository_path}/", '')
194
193
  end
195
194
  end
196
195
 
197
- self.files_to_copy.map { |o| o.file } + expanded_file_dependencies
196
+ files_to_copy.map(&:file) + expanded_file_dependencies
198
197
  end
199
198
 
200
199
  ## If we specify a directory in `file_dependencies` instead of listing each file
201
200
  ## individually, there may be new files that we don't know about. This method finds those.
202
201
  def self.new_files_in(files)
203
- file_dependencies = self.configuration.file_dependencies
202
+ file_dependencies = configuration.file_dependencies
204
203
  file_dependencies ||= []
205
204
 
206
205
  directory_dependencies = file_dependencies.select do |path|
207
- File.directory?(self.mobile_secrets_path(path))
206
+ File.directory?(mobile_secrets_path(path))
208
207
  end
209
208
 
210
209
  new_files = []
@@ -229,7 +228,7 @@ module Fastlane
229
228
  UI.user_error! "Attempted to add a file to a location which is not ignored under Git (#{params[:destination]}). Please either edit your `.configure` file to use an already-ignored destination, or add that destination to the `.gitignore` manually to fix this."
230
229
  end
231
230
 
232
- new_config = self.configuration
231
+ new_config = configuration
233
232
  new_config.add_file_to_copy(params[:source], params[:destination], encrypt: params[:encrypt])
234
233
  update_configuration(new_config)
235
234
  end
@@ -275,7 +274,7 @@ module Fastlane
275
274
  `cd #{repository_path} && git add keys.json && git commit -m "Update keys.json for #{configuration.project_name}" && git push origin #{repo_branch_name}`
276
275
 
277
276
  # Check command success
278
- UI.user_error!("Failed to update encryption key for #{configuration.project_name}") unless $?.success?
277
+ UI.user_error!("Failed to update encryption key for #{configuration.project_name}") unless $CHILD_STATUS.success?
279
278
  end
280
279
  end
281
280
  end
@@ -66,7 +66,7 @@ module Fastlane
66
66
 
67
67
  ### Returns the path to the `~/.mobile-secrets` directory.
68
68
  def self.secret_store_dir
69
- return "#{Dir.home}/.mobile-secrets"
69
+ "#{Dir.home}/.mobile-secrets"
70
70
  end
71
71
 
72
72
  ### Transforms a relative path within the secret store to an absolute path on disk.
@@ -25,7 +25,7 @@ module Fastlane
25
25
 
26
26
  # If we reached the root, we haven't found a repo.
27
27
  # (Technically, there could be a repo in the root of the system, but that's a usecase that we don't need to support at this time)
28
- return dir.root? == false
28
+ dir.root? == false
29
29
  end
30
30
 
31
31
  # Travels back the hierarchy of the given path until it finds an existing ancestor, or it reaches the root of the file system.
@@ -37,7 +37,7 @@ module Fastlane
37
37
  def self.first_existing_ancestor_of(path:)
38
38
  p = Pathname(path).expand_path
39
39
  p = p.parent until p.exist? || p.root?
40
- return p
40
+ p
41
41
  end
42
42
 
43
43
  # Check if the current directory has git-lfs enabled
@@ -62,14 +62,17 @@ module Fastlane
62
62
  branch = branch.first.join('/') if branch.is_a?(Hash)
63
63
  Action.sh('git', 'checkout', branch)
64
64
  Action.sh('git', 'pull')
65
- return true
66
- rescue
67
- return false
65
+ true
66
+ rescue StandardError
67
+ false
68
68
  end
69
69
 
70
70
  # Update every submodule in the current git repository
71
71
  #
72
+ # @deprecated This method is going to be removed soon. Fastlane has a built-in `git_submodule_update` action that can be used instead.
73
+ #
72
74
  def self.update_submodules
75
+ UI.deprecated("The `update_submodules` method will soon be removed from `release-toolkit`. Please use fastlane's `git_submodule_update` action instead.")
73
76
  Action.sh('git', 'submodule', 'update', '--init', '--recursive')
74
77
  end
75
78
 
@@ -111,9 +114,9 @@ module Fastlane
111
114
  end
112
115
  begin
113
116
  Action.sh('git', 'commit', *args, '-m', message)
114
- return true
115
- rescue
116
- return false
117
+ true
118
+ rescue StandardError
119
+ false
117
120
  end
118
121
  end
119
122
 
@@ -209,7 +212,14 @@ module Fastlane
209
212
  #
210
213
  # @raise [UserError] Raises a user_error! and interrupts the lane if we are not on the expected branch.
211
214
  #
215
+ # @deprecated This method is going to be removed soon. Fastlane has a built-in `ensure_git_branch` action that can be used instead.
216
+ # After updating to Fastlane version `2.217.0` or later, the `FL_GIT_BRANCH_DONT_USE_ENV_VARS` environment
217
+ # variable can be set to `true` to disable the use of environment variables for the `git_branch` action that
218
+ # `ensure_git_branch` relies on. This will make `ensure_git_branch` work as expected in CI environments.
219
+ # See https://github.com/fastlane/fastlane/pull/21597 for more details.
220
+ #
212
221
  def self.ensure_on_branch!(branch_name)
222
+ UI.deprecated("The `ensure_on_branch!` method will soon be removed from `release-toolkit`. Please use fastlane's `ensure_git_branch` action (+ potentially set `FL_GIT_BRANCH_DONT_USE_ENV_VARS=true`) instead.")
213
223
  current_branch_name = Action.sh('git', 'symbolic-ref', '-q', 'HEAD')
214
224
  UI.user_error!("This command works only on #{branch_name} branch") unless current_branch_name.include?(branch_name)
215
225
  end
@@ -37,16 +37,16 @@ module Fastlane
37
37
  end
38
38
  end
39
39
 
40
- # Fetch all the PRs for a given milestone
40
+ # Fetch all the PRs and issues for a given milestone
41
41
  #
42
42
  # @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)
43
43
  # @param [Sawyer::Resource, String] milestone The milestone object, or title of the milestone, we want to fetch the list of PRs for (e.g.: `16.9`)
44
44
  # @param [Boolean] include_closed If set to true, will include both opened and closed PRs. Otherwise, will only include opened PRs.
45
45
  # @return [Array<Sawyer::Resource>] A list of the PRs for the given milestone, sorted by number
46
46
  #
47
- def get_prs_for_milestone(repository:, milestone:, include_closed: false)
47
+ def get_prs_and_issues_for_milestone(repository:, milestone:, include_closed: false)
48
48
  milestone_title = milestone.is_a?(Sawyer::Resource) ? milestone.title : milestone
49
- query = %(repo:#{repository} type:pr milestone:"#{milestone_title}")
49
+ query = %(repo:#{repository} milestone:"#{milestone_title}")
50
50
  query += ' is:open' unless include_closed
51
51
 
52
52
  client.search_issues(query)[:items].sort_by(&:number)
@@ -55,17 +55,17 @@ module Fastlane
55
55
  # Set/Update the milestone assigned to a given PR or issue
56
56
  #
57
57
  # @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)
58
- # @param [Integer] pr_number The PR (or issue) number to update the milestone of
58
+ # @param [Integer] number The PR (or issue) number to update the milestone of
59
59
  # @param [Sawyer::Resource?, Integer?] milestone The milestone object or number to set on this PR, or nil to unset the milestone
60
60
  # @note Use `get_milestone` to get a milestone object from a version number
61
61
  # @raise [Fastlane::UI::Error] UI.user_error! if PR does not exist or milestone provided is invalid
62
62
  #
63
- def set_pr_milestone(repository:, pr_number:, milestone:)
63
+ def set_milestone(repository:, number:, milestone:)
64
64
  milestone_num = milestone.is_a?(Sawyer::Resource) ? milestone.number : milestone
65
65
 
66
- client.update_issue(repository, pr_number, { milestone: milestone_num })
66
+ client.update_issue(repository, number, { milestone: milestone_num })
67
67
  rescue Octokit::NotFound
68
- UI.user_error!("Could not find PR ##{pr_number} in #{repository}")
68
+ UI.user_error!("Could not find PR or issue ##{number} in #{repository}")
69
69
  rescue Octokit::UnprocessableEntity
70
70
  UI.user_error!("Invalid milestone #{milestone_num}")
71
71
  end
@@ -237,7 +237,7 @@ module Fastlane
237
237
  comment.user.id == client.user.id and comment.body.include?(reuse_marker)
238
238
  end
239
239
 
240
- comment_body = reuse_marker + body
240
+ comment_body = "#{reuse_marker}\n\n#{body}"
241
241
 
242
242
  if existing_comment.nil?
243
243
  client.add_comment(project_slug, pr_number, comment_body)
@@ -72,7 +72,7 @@ module Fastlane
72
72
  # 2. Match the info and extract the value in group 1.
73
73
  # 3. Values use comma as thousands separator, so remove it.
74
74
  # 4. Convert to integer.
75
- data.grep(/#{regex}/)[0].match(/#{regex}/)[1].gsub(/,/, '').to_i
75
+ data.grep(/#{regex}/)[0].match(/#{regex}/)[1].gsub(',', '').to_i
76
76
  end
77
77
  end
78
78
  end
@@ -61,7 +61,7 @@ module FastlaneCore
61
61
  # if we replied before the timeout, kill the thread so message won't be triggered
62
62
  thread.kill
63
63
  # If the block given returned a value, pass it
64
- return res
64
+ res
65
65
  end
66
66
 
67
67
  # Monkey-Patch fastlane's `UI.input`, `UI.confirm`, `UI.select` and `UI.password` interactive methods
@@ -21,14 +21,18 @@ module Fastlane
21
21
  UI.message 'Fetching the list of versions...'
22
22
  versions = app.app_store_versions.select { |v| v.version_string == only_version && !v.build.nil? }
23
23
  versions = app.get_app_store_versions.reject { |v| v.build.nil? } if versions.empty?
24
- UI.message "Found #{versions.count} versions." + (limit == 0 ? '' : " Limiting to last #{limit}")
25
- versions = versions.first(limit) unless limit == 0
24
+ UI.message "Found #{versions.count} versions." + (limit.zero? ? '' : " Limiting to last #{limit}")
25
+ versions = versions.first(limit) unless limit.zero?
26
26
 
27
27
  UI.message 'Fetching App Sizes...'
28
28
 
29
29
  builds_details = versions.each_with_index.map do |v, idx|
30
30
  print "Fetching info for: #{v.version_string.rjust(8)} (#{v.build.version.rjust(11)}) [#{idx.to_s.rjust(3)}/#{versions.count}]\r"
31
- Spaceship::Tunes.client.build_details(app_id: app.id, train: v.version_string, build_number: v.build.version, platform: 'ios') rescue nil
31
+ begin
32
+ Spaceship::Tunes.client.build_details(app_id: app.id, train: v.version_string, build_number: v.build.version, platform: 'ios')
33
+ rescue StandardError
34
+ nil
35
+ end
32
36
  end.compact.reverse
33
37
  print("#{' ' * 55}\n")
34
38
 
@@ -30,9 +30,9 @@ module Fastlane
30
30
  return nil unless status.success?
31
31
 
32
32
  case format_desc
33
- when /Apple binary property list/ then return :binary
34
- when /XML/ then return :xml
35
- when /text/ then return :text
33
+ when /Apple binary property list/ then :binary
34
+ when /XML/ then :xml
35
+ when /text/ then :text
36
36
  end
37
37
  end
38
38
 
@@ -173,7 +173,7 @@ module Fastlane
173
173
  rescue StandardError => e
174
174
  UI.error "Error downloading locale `#{locale}` — #{e.message} (#{uri})"
175
175
  retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
176
- return nil
176
+ nil
177
177
  end
178
178
  end
179
179
  end
@@ -31,9 +31,9 @@ module Fastlane
31
31
  # The SwiftGen version string has this format:
32
32
  #
33
33
  # SwiftGen v6.4.0 (Stencil v0.13.1, StencilSwiftKit v2.7.2, SwiftGenKit v6.4.0)
34
- return vers_string.include?("SwiftGen v#{version}")
35
- rescue
36
- return false
34
+ vers_string.include?("SwiftGen v#{version}")
35
+ rescue StandardError
36
+ false
37
37
  end
38
38
 
39
39
  # Download the ZIP of SwiftGen for the requested `version` and install it in the `install_path`
@@ -135,7 +135,7 @@ module Fastlane
135
135
  config_file = File.join(output_dir, CONFIG_FILE_NAME)
136
136
  File.write(config_file, config.to_yaml)
137
137
 
138
- return [config_file, langs]
138
+ [config_file, langs]
139
139
  end
140
140
 
141
141
  # Returns a Hash mapping the list of expected parameter types for each of the keys based in the %… placeholders found in their `.strings` files
@@ -89,7 +89,7 @@ module Fastlane
89
89
  #
90
90
  def self.calc_prev_release_version(version)
91
91
  vp = get_version_parts(version)
92
- if vp[MINOR_NUMBER] == 0
92
+ if (vp[MINOR_NUMBER]).zero?
93
93
  vp[MAJOR_NUMBER] -= 1
94
94
  vp[MINOR_NUMBER] = 9
95
95
  else
@@ -134,7 +134,7 @@ module Fastlane
134
134
  #
135
135
  def self.calc_prev_build_version(version)
136
136
  vp = get_version_parts(version)
137
- vp[BUILD_NUMBER] -= 1 unless vp[BUILD_NUMBER] == 0
137
+ vp[BUILD_NUMBER] -= 1 unless (vp[BUILD_NUMBER]).zero?
138
138
  "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}.#{vp[BUILD_NUMBER]}"
139
139
  end
140
140
 
@@ -147,8 +147,8 @@ module Fastlane
147
147
  #
148
148
  def self.calc_prev_hotfix_version(version)
149
149
  vp = get_version_parts(version)
150
- vp[HOTFIX_NUMBER] -= 1 unless vp[HOTFIX_NUMBER] == 0
151
- return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}" unless vp[HOTFIX_NUMBER] == 0
150
+ vp[HOTFIX_NUMBER] -= 1 unless (vp[HOTFIX_NUMBER]).zero?
151
+ return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}.#{vp[HOTFIX_NUMBER]}" unless (vp[HOTFIX_NUMBER]).zero?
152
152
 
153
153
  "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}"
154
154
  end
@@ -184,7 +184,7 @@ module Fastlane
184
184
  #
185
185
  def self.is_hotfix?(version)
186
186
  vp = get_version_parts(version)
187
- return (vp.length > 2) && (vp[HOTFIX_NUMBER] != 0)
187
+ (vp.length > 2) && (vp[HOTFIX_NUMBER] != 0)
188
188
  end
189
189
 
190
190
  # Returns the current value of the `VERSION_LONG` key from the public xcconfig file
@@ -215,9 +215,7 @@ module Fastlane
215
215
  UI.message("Current version: #{current_version}")
216
216
  new_version = calc_next_release_version(current_version)
217
217
  UI.message("New version: #{new_version}")
218
- verified_version = verify_version(new_version)
219
-
220
- return verified_version
218
+ verify_version(new_version)
221
219
  end
222
220
 
223
221
  # Update the `.xcconfig` files (the public one, and the internal one if it exists) with the new version strings.
@@ -269,10 +267,10 @@ module Fastlane
269
267
  #
270
268
  def self.get_version_parts(version)
271
269
  parts = version.split('.')
272
- parts = parts.fill('0', parts.length...4).map { |chr| chr.to_i }
270
+ parts = parts.fill('0', parts.length...4).map(&:to_i)
273
271
  UI.user_error!("Bad version string: #{version}") if parts.length > 4
274
272
 
275
- return parts
273
+ parts
276
274
  end
277
275
 
278
276
  # Extract the VERSION_LONG entry from an `xcconfig` file
@@ -330,7 +328,9 @@ module Fastlane
330
328
  # @return [Bool] true if the string is representing an integer value, false if not
331
329
  #
332
330
  def self.is_int?(string)
333
- true if Integer(string) rescue false
331
+ true if Integer(string)
332
+ rescue StandardError
333
+ false
334
334
  end
335
335
  end
336
336
  end
@@ -34,8 +34,8 @@ module Fastlane
34
34
  end
35
35
 
36
36
  loc_data.each do |d|
37
- key = d[0].split(/\u0004/).first
38
- source = d[0].split(/\u0004/).last
37
+ key = d[0].split("\u0004").first
38
+ source = d[0].split("\u0004").last
39
39
 
40
40
  target_files.each do |file|
41
41
  next unless file[0].to_s == key
@@ -50,8 +50,8 @@ module Fastlane
50
50
  # Parse JSON data and update the local files
51
51
  def reparse_alternates(target_locale, loc_data, is_source)
52
52
  loc_data.each do |d|
53
- key = d[0].split(/\u0004/).first
54
- source = d[0].split(/\u0004/).last
53
+ key = d[0].split("\u0004").first
54
+ source = d[0].split("\u0004").last
55
55
 
56
56
  @alternates.each do |file|
57
57
  puts "Data: #{file[0]} - key: #{key}"
@@ -109,7 +109,11 @@ module Fastlane
109
109
  # All good, parse the result
110
110
  UI.success("Successfully downloaded `#{locale}`.")
111
111
  @alternates.clear
112
- loc_data = JSON.parse(response.body) rescue loc_data = nil
112
+ loc_data = begin
113
+ JSON.parse(response.body)
114
+ rescue StandardError
115
+ loc_data = nil
116
+ end
113
117
  parse_data(locale, loc_data, is_source)
114
118
  reparse_alternates(target_locale, loc_data, is_source) unless @alternates.empty?
115
119
  when '301'