fastlane-plugin-wpmreleasetoolkit 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/ext/drawText/extconf.rb +1 -1
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +3 -3
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +5 -5
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +4 -4
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +2 -2
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +2 -2
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +1 -1
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +2 -2
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +2 -2
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +2 -2
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +2 -2
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +1 -1
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +2 -2
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +5 -5
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +1 -1
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +1 -1
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +1 -1
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +5 -5
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +1 -1
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +2 -2
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +1 -1
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +3 -3
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb +99 -0
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +1 -1
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +6 -5
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +2 -2
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +3 -3
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +3 -3
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +1 -1
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +5 -5
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +2 -2
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +1 -1
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +5 -5
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +2 -2
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +1 -1
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +4 -4
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +5 -5
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +1 -1
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +2 -2
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +5 -5
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +1 -1
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +1 -1
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +5 -5
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +1 -1
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +1 -1
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +4 -4
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +2 -2
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +1 -1
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +3 -3
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +2 -2
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +3 -3
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +11 -2
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +9 -9
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +1 -1
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +2 -2
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +1 -1
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +4 -6
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +3 -3
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +3 -4
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +1 -1
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +2 -2
  67. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  68. metadata +4 -3
@@ -2,8 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosValidateCiBuildAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/ios/ios_git_helper.rb'
6
- require_relative '../../helper/ios/ios_version_helper.rb'
5
+ require_relative '../../helper/ios/ios_git_helper'
6
+ require_relative '../../helper/ios/ios_version_helper'
7
7
 
8
8
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version()
9
9
  head_tags = Fastlane::Helper::GitHelper.list_tags_on_current_commit()
@@ -91,7 +91,7 @@ module Fastlane
91
91
 
92
92
  def is_handler_for(key)
93
93
  values = key.split('_')
94
- key.start_with?(@rel_note_key) && values.length == 3 && is_int?(values[2].sub(/^[0]*/, ''))
94
+ key.start_with?(@rel_note_key) && values.length == 3 && is_int?(values[2].sub(/^0*/, ''))
95
95
  end
96
96
 
97
97
  def handle_line(fw, line)
@@ -123,7 +123,7 @@ module Fastlane
123
123
  end
124
124
 
125
125
  def extract_key(line)
126
- line.split(' ')[1].tr('\"', '')
126
+ line.split[1].tr('\"', '')
127
127
  end
128
128
 
129
129
  def is_int?(value)
@@ -141,7 +141,7 @@ module Fastlane
141
141
 
142
142
  def is_handler_for(key)
143
143
  values = key.split('_')
144
- key.start_with?(@rel_note_key) && values.length == 4 && is_int?(values[3].sub(/^[0]*/, ''))
144
+ key.start_with?(@rel_note_key) && values.length == 4 && is_int?(values[3].sub(/^0*/, ''))
145
145
  end
146
146
 
147
147
  def generate_block(fw)
@@ -154,7 +154,7 @@ module Fastlane
154
154
  def self.verify_local_diff(main, library, main_strings, lib_strings)
155
155
  `git diff #{main}`.each_line do |line|
156
156
  if line.start_with?('+ ') || line.start_with?('- ')
157
- diffs = line.gsub(/\s+/m, ' ').strip.split(' ')
157
+ diffs = line.gsub(/\s+/m, ' ').strip.split
158
158
  diffs.each do |diff|
159
159
  verify_diff(diff, main_strings, lib_strings, library)
160
160
  end
@@ -165,7 +165,7 @@ module Fastlane
165
165
  def self.verify_pr_diff(main, library, main_strings, lib_strings, source_diff)
166
166
  source_diff.each_line do |line|
167
167
  if line.start_with?('+ ') || line.start_with?('- ')
168
- diffs = line.gsub(/\s+/m, ' ').strip.split(' ')
168
+ diffs = line.gsub(/\s+/m, ' ').strip.split
169
169
  diffs.each do |diff|
170
170
  verify_diff(diff, main_strings, lib_strings, library)
171
171
  end
@@ -299,6 +299,15 @@ module Fastlane
299
299
  #
300
300
  def self.apply_substitutions(tag)
301
301
  tag.content = tag.content.gsub('...', '…')
302
+
303
+ # Typography en-dash
304
+ if tag.content.include?('-')
305
+ tag.content = tag.content.gsub(/(\d+\s*)-(\s*\d+)/) do |str|
306
+ match = Regexp.last_match # of type `MatchData`. match[0] == str == whole match, match[1] = 1st capture group (left part of the range), match[2] = second capture group (right part of the range)
307
+ is_negative_number = match[2][0] != ' ' && match[1][-1] == ' ' # if right part of range does not start with a space (e.g. `-3`), but left part of range does end with space, it's not a range after all but more likely a list containing negative numbers in it (e.g. `2 -3`)
308
+ is_negative_number ? str : "#{match[1]}\u{2013}#{match[2]}"
309
+ end
310
+ end
302
311
  end
303
312
  private_class_method :apply_substitutions
304
313
 
@@ -377,10 +377,10 @@ module Fastlane
377
377
  found_section = false
378
378
  File.open(file_path, 'r') do |file|
379
379
  file.each_line do |line|
380
- if !found_section
381
- found_section = true if line.include?(section)
380
+ if found_section
381
+ return line.split[1] if line.include?(keyword) && !line.include?("\"#{keyword}\"") && !line.include?("P#{keyword}")
382
382
  else
383
- return line.split(' ')[1] if line.include?(keyword) && !line.include?("\"#{keyword}\"") && !line.include?("P#{keyword}")
383
+ found_section = true if line.include?(section)
384
384
  end
385
385
  end
386
386
  end
@@ -442,24 +442,24 @@ module Fastlane
442
442
  version_updated = 0
443
443
  File.open(gradle_path, 'r') do |file|
444
444
  file.each_line do |line|
445
- if !found_section
446
- temp_file.puts line
447
- found_section = true if line.include? section
448
- else
445
+ if found_section
449
446
  if version_updated < 2
450
447
  if line.include?('versionName') && !line.include?('"versionName"') && !line.include?('PversionName')
451
- version_name = line.split(' ')[1].tr('\"', '')
448
+ version_name = line.split[1].tr('\"', '')
452
449
  line.sub!(version_name, version[VERSION_NAME].to_s)
453
450
  version_updated = version_updated + 1
454
451
  end
455
452
 
456
453
  if line.include? 'versionCode'
457
- version_code = line.split(' ')[1]
454
+ version_code = line.split[1]
458
455
  line.sub!(version_code, version[VERSION_CODE].to_s)
459
456
  version_updated = version_updated + 1
460
457
  end
461
458
  end
462
459
  temp_file.puts line
460
+ else
461
+ temp_file.puts line
462
+ found_section = true if line.include? section
463
463
  end
464
464
  end
465
465
  file.close
@@ -80,7 +80,7 @@ module Fastlane
80
80
 
81
81
  Net::HTTP.start(command_uri.host, command_uri.port, use_ssl: true) do |http|
82
82
  request = Net::HTTP::Post.new(command_uri.request_uri, headers)
83
- body = { "branch": branch, "parameters": parameters }
83
+ body = { branch: branch, parameters: parameters }
84
84
  request.body = body.to_json
85
85
  response = http.request(request)
86
86
  return response
@@ -187,7 +187,7 @@ module Fastlane
187
187
 
188
188
  if File.directory?(abs_path)
189
189
  Dir.glob("#{abs_path}**/*").map do |sub_path|
190
- sub_path.gsub(repository_path + '/', '')
190
+ sub_path.gsub("#{repository_path}/", '')
191
191
  end
192
192
  else
193
193
  return path
@@ -230,7 +230,7 @@ module Fastlane
230
230
  end
231
231
 
232
232
  new_config = self.configuration
233
- new_config.add_file_to_copy(params[:source], params[:destination], params[:encrypt])
233
+ new_config.add_file_to_copy(params[:source], params[:destination], encrypt: params[:encrypt])
234
234
  update_configuration(new_config)
235
235
  end
236
236
 
@@ -9,7 +9,7 @@ module Fastlane
9
9
  end
10
10
 
11
11
  def self.cipher(op_type)
12
- cipher = OpenSSL::Cipher::AES256.new :CBC
12
+ cipher = OpenSSL::Cipher.new('aes-256-cbc')
13
13
 
14
14
  cipher.encrypt if op_type == OperationType::ENCRYPT
15
15
  cipher.decrypt if op_type == OperationType::DECRYPT
@@ -50,15 +50,13 @@ module Fastlane
50
50
 
51
51
  last_stone = nil
52
52
  milestones.each do |mile|
53
+ mile_vcomps = mile[:title].split[0].split('.')
53
54
  if last_stone.nil?
54
- last_stone = mile unless mile[:title].split(' ')[0].split('.').length < 2
55
+ last_stone = mile unless mile_vcomps.length < 2
55
56
  else
56
57
  begin
57
- if mile[:title].split(' ')[0].split('.')[0] > last_stone[:title].split(' ')[0].split('.')[0]
58
- last_stone = mile
59
- elsif mile[:title].split(' ')[0].split('.')[1] > last_stone[:title].split(' ')[0].split('.')[1]
60
- last_stone = mile
61
- end
58
+ last_vcomps = last_stone[:title].split[0].split('.')
59
+ last_stone = mile if mile_vcomps[0] > last_vcomps[0] || mile_vcomps[1] > last_vcomps[1]
62
60
  rescue StandardError
63
61
  puts 'Found invalid milestone'
64
62
  end
@@ -30,7 +30,7 @@ module Fastlane
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
31
  Spaceship::Tunes.client.build_details(app_id: app.id, train: v.version_string, build_number: v.build.version, platform: 'ios') rescue nil
32
32
  end.compact.reverse
33
- print(' ' * 55 + "\n")
33
+ print("#{' ' * 55}\n")
34
34
 
35
35
  builds_details
36
36
  end
@@ -40,12 +40,12 @@ module Fastlane
40
40
  end
41
41
 
42
42
  def self.sz_mb(bytes)
43
- sz(bytes).to_s.rjust(5) + ' MB'
43
+ "#{sz(bytes).to_s.rjust(5)} MB"
44
44
  end
45
45
 
46
46
  def self.format_csv(app_sizes, devices: nil)
47
47
  devices = DEFAULT_DEVICES if devices.nil? || devices.empty?
48
- csv = "Version\t" + devices.join("\t") + "\n"
48
+ csv = "Version\t#{devices.join("\t")}\n"
49
49
  app_sizes.each do |details|
50
50
  build_number = details['cfBundleVersion']
51
51
  sizes = details['sizesInBytes'].select { |name, _| devices.include?(name) }
@@ -9,8 +9,7 @@ module Fastlane
9
9
  DEFAULT_BASE_LANG = 'en'
10
10
  CONFIG_FILE_NAME = 'swiftgen-stringtypes.yml'
11
11
 
12
- attr_reader :install_path
13
- attr_reader :version
12
+ attr_reader :install_path, :version
14
13
 
15
14
  # @param [String] install_path The path to install SwiftGen to. Usually something like "$PROJECT_DIR/vendor/swiftgen/#{SWIFTGEN_VERSION}".
16
15
  # It's recommended to provide an absolute path here rather than a relative one, to ensure it's not dependant on where the action is run from.
@@ -175,7 +174,7 @@ module Fastlane
175
174
  # Run diffs
176
175
  base_file = sort_file_lines!(tmpdir, base_lang)
177
176
  langs.delete(base_lang)
178
- return Hash[langs.map do |lang|
177
+ return langs.map do |lang|
179
178
  file = sort_file_lines!(tmpdir, lang)
180
179
  # If the lang ends up not having any translation at all (e.g. a `.lproj` without any `.strings` file in it but maybe just a storyboard or assets catalog), ignore it
181
180
  next nil if file.nil? || only_empty_lines?(file)
@@ -189,7 +188,7 @@ module Fastlane
189
188
  # file instead, but they can still give an indication at the index in the list of keys at which this difference is located.
190
189
  diff.gsub!(/^(---|\+\+\+).*\n/, '')
191
190
  diff.empty? ? nil : [lang, diff]
192
- end.compact]
191
+ end.compact.to_h
193
192
  end
194
193
  end
195
194
 
@@ -127,7 +127,7 @@ module Fastlane
127
127
  end
128
128
 
129
129
  def extract_key(line)
130
- line.split(' ')[1].tr('\"', '')
130
+ line.split[1].tr('\"', '')
131
131
  end
132
132
  end
133
133
 
@@ -1,5 +1,5 @@
1
1
  require 'json'
2
- require_relative 'file_reference.rb'
2
+ require_relative 'file_reference'
3
3
 
4
4
  module Fastlane
5
5
  class Configuration
@@ -22,7 +22,7 @@ module Fastlane
22
22
  File.write(path, JSON.pretty_generate(to_hash))
23
23
  end
24
24
 
25
- def add_file_to_copy(source, destination, encrypt = false)
25
+ def add_file_to_copy(source, destination, encrypt: false)
26
26
  file = FileReference.new(file: source, destination: destination, encrypt: encrypt)
27
27
  self.files_to_copy << file
28
28
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Wpmreleasetoolkit
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-wpmreleasetoolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorenzo Mattei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -384,6 +384,7 @@ files:
384
384
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb
385
385
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb
386
386
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb
387
+ - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb
387
388
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb
388
389
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb
389
390
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb
@@ -462,7 +463,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
462
463
  requirements:
463
464
  - - ">="
464
465
  - !ruby/object:Gem::Version
465
- version: '0'
466
+ version: '2.6'
466
467
  required_rubygems_version: !ruby/object:Gem::Requirement
467
468
  requirements:
468
469
  - - ">="