fastlane-plugin-wpmreleasetoolkit 1.3.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +8 -14
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +5 -10
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +9 -16
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +8 -15
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +13 -22
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +11 -18
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +4 -10
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +2 -8
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +1 -7
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +1 -5
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +1 -7
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +1 -7
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +1 -7
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +4 -4
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +2 -8
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +1 -1
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +1 -1
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +30 -15
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +1 -1
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +1 -1
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +37 -52
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +3 -1
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +28 -5
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb +93 -0
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  28. metadata +25 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee442d259b9c2e9f6ade7505aa2a7cf4a87d01e13ae68abc6d93d1b45b67b931
4
- data.tar.gz: caca4af2ab1e2d1b973c199a8a2bf2907f21403fa862e1439047b3740471a8da
3
+ metadata.gz: ccdaad31840825f4e31a868d02be5bd94a50b8dfe08905b75a07d9c2de187158
4
+ data.tar.gz: 679d9fe6250aeadd808ddbd2d5baf23ce8ff0f920dd52a99cabf1b751ec74fc2
5
5
  SHA512:
6
- metadata.gz: e0a43dc1b67ce99bb8afb213bf0826fa51c6241ebc4ab406c885d37dcfb5821b6a4fd7d0b23dcb2005d42efd14f07af59b4cc6401738b5de10e1b0bc8cce0d56
7
- data.tar.gz: 3acc819e9b7cc00eb406fbae062910d638bdc799fbc26e53f20d6c07b51bdd1a20ddaa41b83dcc20b323bc3cd333ea93e5f365494792e8ec7f47a8abdf852f22
6
+ metadata.gz: f972a9987b33dad7bf2eee79e378fb40ba5ed174c4885b983dccd1ee86ddb1ca3cdc998c50c3ce0d7dddaec5d0c4508d4baab3a81ef62f5e3e6759b70f68954f
7
+ data.tar.gz: bf06d3515cd1994574d4b0e0d01b67c4554106c342d86cf87dd7e72d572b5b1e6129cc7757a7d64b42adaab0c791185b9d3544f244cf338bf77cb10de0ac99da
@@ -11,13 +11,11 @@ module Fastlane
11
11
  # Checkout develop and update
12
12
  Fastlane::Helper::GitHelper.checkout_and_pull('develop')
13
13
 
14
- app = params[:app]
15
-
16
14
  # Check versions
17
- release_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
18
- message = "[#{app}] The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
19
- alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
20
- message << "[#{app}] The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
15
+ release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
16
+ message = "The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
17
+ alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
18
+ message << "The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
21
19
 
22
20
  # Check branch
23
21
  app_version = Fastlane::Helper::Android::VersionHelper.get_public_version
@@ -25,7 +23,7 @@ module Fastlane
25
23
 
26
24
  # Check user overwrite
27
25
  unless params[:base_version].nil?
28
- overwrite_version = get_user_build_version(params[:base_version], message)
26
+ overwrite_version = get_user_build_version(version: params[:base_version], message: message)
29
27
  release_version = overwrite_version[0]
30
28
  alpha_release_version = overwrite_version[1]
31
29
  end
@@ -49,10 +47,10 @@ module Fastlane
49
47
  [next_beta_version, next_alpha_version]
50
48
  end
51
49
 
52
- def self.get_user_build_version(version, message)
53
- UI.user_error!("[#{app}] Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
50
+ def self.get_user_build_version(version:, message:)
51
+ UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
54
52
  release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
55
- message << "#{app}] Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
53
+ message << "Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
56
54
  alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
57
55
  message << "and Alpha Version: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
58
56
  [release_version, alpha_release_version]
@@ -82,10 +80,6 @@ module Fastlane
82
80
  description: 'Skips confirmation',
83
81
  is_string: false, # true: verifies the input is a string, false: every kind of value
84
82
  default_value: false), # the default value if the user didn't provide one
85
- FastlaneCore::ConfigItem.new(key: :app,
86
- env_name: 'PROJECT_NAME',
87
- description: 'The name of the app to get the release version for',
88
- is_string: true), # true: verifies the input is a string, false: every kind of value
89
83
  ]
90
84
  end
91
85
 
@@ -9,16 +9,15 @@ module Fastlane
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
11
11
 
12
- app = params[:app]
13
12
  message = ''
14
- beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version(app) unless !params[:beta] && !params[:final]
15
- alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app) if params[:alpha]
13
+ beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version unless !params[:beta] && !params[:final]
14
+ alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version if params[:alpha]
16
15
 
17
16
  UI.user_error!("Can't build a final release out of this branch because it's configured as a beta release!") if params[:final] && Fastlane::Helper::Android::VersionHelper.is_beta_version?(beta_version)
18
17
 
19
- message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
20
- message << "[#{app}] Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
21
- message << "[#{app}] Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
18
+ message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
19
+ message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
20
+ message << "Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
22
21
 
23
22
  if params[:skip_confirm]
24
23
  UI.message(message)
@@ -64,10 +63,6 @@ module Fastlane
64
63
  description: 'True if this is for a final build',
65
64
  is_string: false,
66
65
  default_value: false),
67
- FastlaneCore::ConfigItem.new(key: :app,
68
- env_name: 'PROJECT_NAME',
69
- description: 'The name of the app to get the release version for',
70
- is_string: true), # true: verifies the input is a string, false: every kind of value
71
66
  ]
72
67
  end
73
68
 
@@ -8,22 +8,21 @@ module Fastlane
8
8
  require_relative '../../helper/android/android_version_helper'
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release')
11
- app = params[:app]
12
11
 
13
- current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
14
- current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
12
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
13
+ current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
15
14
  new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(current_version, current_version_alpha)
16
15
  new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
17
16
 
18
17
  vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
19
18
  vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
20
- UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
21
- UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
22
- UI.message("New beta version[#{app}]: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
23
- UI.message("New alpha version[#{app}]: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
19
+ UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
20
+ UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
21
+ UI.message("New beta version: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
22
+ UI.message("New alpha version: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
24
23
 
25
24
  UI.message 'Updating app version...'
26
- Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version_beta, new_version_alpha)
25
+ Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
27
26
  UI.message 'Done!'
28
27
 
29
28
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
@@ -34,21 +33,15 @@ module Fastlane
34
33
  #####################################################
35
34
 
36
35
  def self.description
37
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
36
+ 'Bumps the version of the app for a new beta.'
38
37
  end
39
38
 
40
39
  def self.details
41
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
40
+ 'Bumps the version of the app for a new beta.'
42
41
  end
43
42
 
44
43
  def self.available_options
45
44
  # Define all options your action supports.
46
- [
47
- FastlaneCore::ConfigItem.new(key: :app,
48
- env_name: 'PROJECT_NAME',
49
- description: 'The name of the app to get the release version for',
50
- is_string: true), # true: verifies the input is a string, false: every kind of value
51
- ]
52
45
  end
53
46
 
54
47
  def self.output
@@ -8,20 +8,19 @@ module Fastlane
8
8
  require_relative '../../helper/android/android_version_helper'
9
9
 
10
10
  Fastlane::Helper::GitHelper.ensure_on_branch!('release')
11
- app = params[:app]
12
11
 
13
- current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
14
- current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
12
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
13
+ current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
15
14
  final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(current_version, current_version_alpha)
16
15
 
17
16
  vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
18
17
  vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
19
- UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
20
- UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
21
- UI.message("New release version[#{app}]: #{final_version[vname]}(#{final_version[vcode]})")
18
+ UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
19
+ UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
20
+ UI.message("New release version: #{final_version[vname]}(#{final_version[vcode]})")
22
21
 
23
22
  UI.message 'Updating app version...'
24
- Fastlane::Helper::Android::VersionHelper.update_versions(app, final_version, current_version_alpha)
23
+ Fastlane::Helper::Android::VersionHelper.update_versions(final_version, current_version_alpha)
25
24
  UI.message 'Done!'
26
25
 
27
26
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
@@ -32,21 +31,15 @@ module Fastlane
32
31
  #####################################################
33
32
 
34
33
  def self.description
35
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
34
+ 'Bumps the version of the app for a new beta.'
36
35
  end
37
36
 
38
37
  def self.details
39
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
38
+ 'Bumps the version of the app for a new beta.'
40
39
  end
41
40
 
42
41
  def self.available_options
43
42
  # Define all options your action supports.
44
- [
45
- FastlaneCore::ConfigItem.new(key: :app,
46
- env_name: 'PROJECT_NAME',
47
- description: 'The name of the app to get the release version for',
48
- is_string: true), # true: verifies the input is a string, false: every kind of value
49
- ]
50
43
  end
51
44
 
52
45
  def self.authors
@@ -7,20 +7,18 @@ module Fastlane
7
7
  require_relative '../../helper/android/android_git_helper'
8
8
  Fastlane::Helper::GitHelper.create_branch("release/#{params[:version_name]}", from: params[:previous_version_name])
9
9
 
10
- app = params[:app]
10
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
11
+ new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(params[:version_name], params[:version_code]) # NOTE: this just puts the name/code values in a tuple, unchanged (no actual calc/bumping)
12
+ new_release_branch = "release/#{params[:version_name]}"
11
13
 
12
- current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
13
- current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
14
- new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(params[:version_name], params[:version_code])
15
- new_short_version = new_version_name
16
- new_release_branch = "release/#{new_short_version}"
17
-
18
- UI.message("Current version[#{app}]: #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
19
- UI.message("New hotfix version[#{app}]: #{new_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{new_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]})")
14
+ name_key = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
15
+ code_key = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
16
+ UI.message("Current version: #{current_version[name_key]} (#{current_version[code_key]})")
17
+ UI.message("New hotfix version: #{new_version[name_key]} (#{new_version[code_key]})")
20
18
  UI.message("Release branch: #{new_release_branch}")
21
19
 
22
20
  UI.message 'Updating app version...'
23
- Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version, current_version_alpha)
21
+ Fastlane::Helper::Android::VersionHelper.update_versions(new_version, nil)
24
22
  UI.message 'Done!'
25
23
 
26
24
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
@@ -33,33 +31,26 @@ module Fastlane
33
31
  #####################################################
34
32
 
35
33
  def self.description
36
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
34
+ 'Bumps the version of the app for a new beta.'
37
35
  end
38
36
 
39
37
  def self.details
40
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
38
+ 'Bumps the version of the app for a new beta.'
41
39
  end
42
40
 
43
41
  def self.available_options
44
- # Define all options your action supports.
45
-
46
- # Below a few examples
47
42
  [
48
43
  FastlaneCore::ConfigItem.new(key: :version_name,
49
44
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_VERSION',
50
- description: 'The version of the hotfix',
45
+ description: 'The version name for the hotfix',
51
46
  is_string: true),
52
47
  FastlaneCore::ConfigItem.new(key: :version_code,
53
48
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_CODE',
54
- description: 'The version of the hotfix'),
49
+ description: 'The version code for the hotfix'),
55
50
  FastlaneCore::ConfigItem.new(key: :previous_version_name,
56
51
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
57
52
  description: 'The version to branch from',
58
- is_string: true), # the default value if the user didn't provide one
59
- FastlaneCore::ConfigItem.new(key: :app,
60
- env_name: 'PROJECT_NAME',
61
- description: 'The name of the app to get the release version for',
62
- is_string: true), # true: verifies the input is a string, false: every kind of value
53
+ is_string: true),
63
54
  ]
64
55
  end
65
56
 
@@ -11,22 +11,21 @@ module Fastlane
11
11
  other_action.ensure_git_branch(branch: 'develop')
12
12
 
13
13
  # Create new configuration
14
- app = params[:app]
15
- new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release(app)
14
+ new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release
16
15
 
17
- current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
18
- current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
16
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
17
+ current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version
19
18
  new_version_beta = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_version_alpha)
20
19
  new_version_alpha = current_version_alpha.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(new_version_beta, current_version_alpha)
21
20
  new_release_branch = "release/#{new_short_version}"
22
21
 
23
22
  vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
24
23
  vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
25
- UI.message("Current version[#{app}]: #{current_version[vname]}(#{current_version[vcode]})")
26
- UI.message("Current alpha version[#{app}]: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
27
- UI.message("New beta version[#{app}]: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
28
- UI.message("New alpha version[#{app}]: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
29
- UI.message("New version[#{app}]: #{new_short_version}")
24
+ UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
25
+ UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
26
+ UI.message("New beta version: #{new_version_beta[vname]}(#{new_version_beta[vcode]})")
27
+ UI.message("New alpha version: #{new_version_alpha[vname]}(#{new_version_alpha[vcode]})") unless current_version_alpha.nil?
28
+ UI.message("New version: #{new_short_version}")
30
29
  UI.message("Release branch: #{new_release_branch}")
31
30
 
32
31
  # Update local develop and branch
@@ -35,7 +34,7 @@ module Fastlane
35
34
  UI.message 'Done!'
36
35
 
37
36
  UI.message 'Updating app version...'
38
- Fastlane::Helper::Android::VersionHelper.update_versions(app, new_version_beta, new_version_alpha)
37
+ Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
39
38
  Fastlane::Helper::Android::GitHelper.commit_version_bump()
40
39
  UI.message 'Done.'
41
40
  end
@@ -45,21 +44,15 @@ module Fastlane
45
44
  #####################################################
46
45
 
47
46
  def self.description
48
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
47
+ 'Bumps the version of the app for a new beta.'
49
48
  end
50
49
 
51
50
  def self.details
52
- 'Bumps the version of the app for a new beta. Requires the `updateVersionProperties` gradle task to update the keys if you are using a `version.properties` file.'
51
+ 'Bumps the version of the app for a new beta.'
53
52
  end
54
53
 
55
54
  def self.available_options
56
55
  # Define all options your action supports.
57
- [
58
- FastlaneCore::ConfigItem.new(key: :app,
59
- env_name: 'PROJECT_NAME',
60
- description: 'The name of the app to get the release version for',
61
- is_string: true), # true: verifies the input is a string, false: every kind of value
62
- ]
63
56
  end
64
57
 
65
58
  def self.output
@@ -14,18 +14,16 @@ module Fastlane
14
14
  # Checkout develop and update
15
15
  Fastlane::Helper::GitHelper.checkout_and_pull('develop')
16
16
 
17
- app = params[:app]
18
-
19
17
  # Create versions
20
- current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: app)
21
- current_alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
18
+ current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
19
+ current_alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
22
20
  next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_version(current_version, current_alpha_version)
23
21
  next_alpha_version = current_alpha_version.nil? ? nil : Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(next_version, current_alpha_version)
24
22
 
25
23
  no_alpha_version_message = "No alpha version configured. If you wish to configure an alpha version please update version.properties to include an alpha key for this app\n"
26
24
  # Ask user confirmation
27
25
  unless params[:skip_confirm]
28
- confirm_message = "[#{app}]Building a new release branch starting from develop.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
26
+ confirm_message = "Building a new release branch starting from develop.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
29
27
  confirm_message += current_alpha_version.nil? ? no_alpha_version_message : "Current Alpha version is #{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
30
28
  confirm_message += "After codefreeze the new version will be: #{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
31
29
  confirm_message += current_alpha_version.nil? ? '' : "After codefreeze the new Alpha will be: #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
@@ -37,7 +35,7 @@ module Fastlane
37
35
  other_action.ensure_git_status_clean()
38
36
 
39
37
  # Return the current version
40
- Fastlane::Helper::Android::VersionHelper.get_public_version(app)
38
+ Fastlane::Helper::Android::VersionHelper.get_public_version
41
39
  end
42
40
 
43
41
  #####################################################
@@ -60,10 +58,6 @@ module Fastlane
60
58
  description: 'Skips confirmation before codefreeze',
61
59
  is_string: false, # true: verifies the input is a string, false: every kind of value
62
60
  default_value: false), # the default value if the user didn't provide one
63
- FastlaneCore::ConfigItem.new(key: :app,
64
- env_name: 'PROJECT_NAME',
65
- description: 'The name of the app to get the release version for',
66
- is_string: true), # true: verifies the input is a string, false: every kind of value
67
61
  ]
68
62
  end
69
63
 
@@ -9,10 +9,8 @@ module Fastlane
9
9
 
10
10
  UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
11
11
 
12
- app = params[:app]
13
-
14
- version = Fastlane::Helper::Android::VersionHelper.get_public_version(app)
15
- message = "Completing code freeze for: [#{app}]#{version}\n"
12
+ version = Fastlane::Helper::Android::VersionHelper.get_public_version
13
+ message = "Completing code freeze for: #{version}\n"
16
14
  unless params[:skip_confirm]
17
15
  UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
18
16
  else
@@ -44,10 +42,6 @@ module Fastlane
44
42
  description: 'Skips confirmation',
45
43
  is_string: false, # true: verifies the input is a string, false: every kind of value
46
44
  default_value: false), # the default value if the user didn't provide one
47
- FastlaneCore::ConfigItem.new(key: :app,
48
- env_name: 'PROJECT_NAME',
49
- description: 'The name of the app to get the release version for',
50
- is_string: true), # true: verifies the input is a string, false: every kind of value
51
45
  ]
52
46
  end
53
47
 
@@ -7,7 +7,7 @@ module Fastlane
7
7
  class AndroidCurrentBranchIsHotfixAction < Action
8
8
  def self.run(params)
9
9
  require_relative '../../helper/android/android_version_helper'
10
- version = Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: params[:app])
10
+ version = Fastlane::Helper::Android::VersionHelper.get_release_version
11
11
  Fastlane::Helper::Android::VersionHelper.is_hotfix?(version)
12
12
  end
13
13
 
@@ -25,12 +25,6 @@ module Fastlane
25
25
 
26
26
  def self.available_options
27
27
  # Define all options your action supports.
28
- [
29
- FastlaneCore::ConfigItem.new(key: :app,
30
- env_name: 'PROJECT_NAME',
31
- description: 'The name of the app to get the release version for',
32
- is_string: true), # true: verifies the input is a string, false: every kind of value
33
- ]
34
28
  end
35
29
 
36
30
  def self.output
@@ -27,7 +27,7 @@ module Fastlane
27
27
 
28
28
  def self.details
29
29
  'This action extracts the version of the library which is imported by the client app' \
30
- 'and downloads the request file from the relevant GitHub release'
30
+ 'and downloads the request file from the relevant GitHub release'
31
31
  end
32
32
 
33
33
  def self.available_options
@@ -13,7 +13,7 @@ module Fastlane
13
13
 
14
14
  UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
15
15
 
16
- version = Fastlane::Helper::Android::VersionHelper.get_public_version(params[:app])
16
+ version = Fastlane::Helper::Android::VersionHelper.get_public_version
17
17
  message = "Finalizing release: #{version}\n"
18
18
  if params[:skip_confirm]
19
19
  UI.message(message)
@@ -49,10 +49,6 @@ module Fastlane
49
49
  description: 'Skips confirmation',
50
50
  is_string: false, # true: verifies the input is a string, false: every kind of value
51
51
  default_value: false), # the default value if the user didn't provide one
52
- FastlaneCore::ConfigItem.new(key: :app,
53
- env_name: 'PROJECT_NAME',
54
- description: 'The name of the app to get the release version for',
55
- is_string: true), # true: verifies the input is a string, false: every kind of value
56
52
  ]
57
53
  end
58
54
 
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class AndroidGetAlphaVersionAction < Action
4
4
  def self.run(params)
5
5
  require_relative '../../helper/android/android_version_helper'
6
- Fastlane::Helper::Android::VersionHelper.get_alpha_version(params[:app])
6
+ Fastlane::Helper::Android::VersionHelper.get_alpha_version
7
7
  end
8
8
 
9
9
  #####################################################
@@ -20,12 +20,6 @@ module Fastlane
20
20
 
21
21
  def self.available_options
22
22
  # Define all options your action supports.
23
- [
24
- FastlaneCore::ConfigItem.new(key: :app,
25
- env_name: 'PROJECT_NAME',
26
- description: 'The name of the app to get the release version for',
27
- is_string: true), # true: verifies the input is a string, false: every kind of value
28
- ]
29
23
  end
30
24
 
31
25
  def self.output
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class AndroidGetAppVersionAction < Action
4
4
  def self.run(params)
5
5
  require_relative '../../helper/android/android_version_helper'
6
- Fastlane::Helper::Android::VersionHelper.get_public_version(params[:app])
6
+ Fastlane::Helper::Android::VersionHelper.get_public_version
7
7
  end
8
8
 
9
9
  #####################################################
@@ -20,12 +20,6 @@ module Fastlane
20
20
 
21
21
  def self.available_options
22
22
  # Define all options your action supports.
23
- [
24
- FastlaneCore::ConfigItem.new(key: :app,
25
- env_name: 'PROJECT_NAME',
26
- description: 'The name of the app to get the release version for',
27
- is_string: true), # true: verifies the input is a string, false: every kind of value
28
- ]
29
23
  end
30
24
 
31
25
  def self.output
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class AndroidGetReleaseVersionAction < Action
4
4
  def self.run(params)
5
5
  require_relative '../../helper/android/android_version_helper'
6
- Fastlane::Helper::Android::VersionHelper.get_release_version(product_name: params[:app])
6
+ Fastlane::Helper::Android::VersionHelper.get_release_version
7
7
  end
8
8
 
9
9
  #####################################################
@@ -20,12 +20,6 @@ module Fastlane
20
20
 
21
21
  def self.available_options
22
22
  # Define all options your action supports.
23
- [
24
- FastlaneCore::ConfigItem.new(key: :app,
25
- env_name: 'PROJECT_NAME',
26
- description: 'The name of the app to get the release version for',
27
- is_string: true), # true: verifies the input is a string, false: every kind of value
28
- ]
29
23
  end
30
24
 
31
25
  def self.output
@@ -14,7 +14,7 @@ module Fastlane
14
14
 
15
15
  # Confirm
16
16
  message = "Requested Hotfix version: #{new_ver}\n"
17
- message << "Branching from: #{prev_ver}\n"
17
+ message << "Branching from tag: #{prev_ver}\n"
18
18
 
19
19
  if params[:skip_confirm]
20
20
  UI.message(message)
@@ -50,13 +50,13 @@ module Fastlane
50
50
  [
51
51
  FastlaneCore::ConfigItem.new(key: :version_name,
52
52
  env_name: 'FL_ANDROID_HOTFIX_PRECHECKS_VERSION',
53
- description: 'The version to work on', # a short description of this parameter
53
+ description: 'The hotfix version number to create',
54
54
  is_string: true),
55
55
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
56
56
  env_name: 'FL_ANDROID_HOTFIX_PRECHECKS_SKIPCONFIRM',
57
57
  description: 'Skips confirmation',
58
- is_string: false, # true: verifies the input is a string, false: every kind of value
59
- default_value: false), # the default value if the user didn't provide one
58
+ is_string: false, # Boolean
59
+ default_value: false),
60
60
  ]
61
61
  end
62
62
 
@@ -5,10 +5,8 @@ module Fastlane
5
5
  require_relative '../../helper/android/android_version_helper'
6
6
  require_relative '../../helper/android/android_git_helper'
7
7
 
8
- app = ENV['PROJECT_NAME'].nil? ? params[:app] : ENV['PROJECT_NAME']
9
-
10
- release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version(app)
11
- alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version(app)
8
+ release_ver = Fastlane::Helper::Android::VersionHelper.get_release_version
9
+ alpha_ver = Fastlane::Helper::Android::VersionHelper.get_alpha_version
12
10
  Fastlane::Helper::GitHelper.create_tag(release_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME])
13
11
  Fastlane::Helper::GitHelper.create_tag(alpha_ver[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]) unless alpha_ver.nil? || (params[:tag_alpha] == false)
14
12
  end
@@ -32,10 +30,6 @@ module Fastlane
32
30
  description: 'True to skip tagging the alpha version',
33
31
  is_string: false,
34
32
  default_value: true),
35
- FastlaneCore::ConfigItem.new(key: :app,
36
- env_name: 'PROJECT_NAME',
37
- description: 'The name of the app to get the release version for',
38
- is_string: true), # true: verifies the input is a string, false: every kind of value
39
33
  ]
40
34
  end
41
35
 
@@ -98,7 +98,7 @@ module Fastlane
98
98
 
99
99
  def self.details
100
100
  'This actions checks the current status of the translations on GlotPress ' \
101
- 'and raises an error if it\'s below the provided threshold'
101
+ 'and raises an error if it\'s below the provided threshold'
102
102
  end
103
103
 
104
104
  def self.available_options
@@ -10,7 +10,7 @@ module Fastlane
10
10
  repository = params[:repository]
11
11
  version = params[:version]
12
12
  assets = params[:release_assets]
13
- release_notes = params[:release_notes_file_path].nil? ? '' : IO.read(params[:release_notes_file_path])
13
+ release_notes = params[:release_notes_file_path].nil? ? '' : File.read(params[:release_notes_file_path])
14
14
  prerelease = params[:prerelease]
15
15
 
16
16
  UI.message("Creating draft release #{version} in #{repository}.")
@@ -9,14 +9,18 @@ module Fastlane
9
9
  create_config(params[:previous_version], params[:version])
10
10
  show_config()
11
11
 
12
- UI.message 'Updating Fastlane deliver file...'
13
- Fastlane::Helper::Ios::VersionHelper.update_fastlane_deliver(@new_short_version)
14
- UI.message 'Done!'
12
+ update_deliverfile = params[:skip_deliver] == false
13
+ if update_deliverfile
14
+ UI.message 'Updating Fastlane deliver file...'
15
+ Fastlane::Helper::Ios::VersionHelper.update_fastlane_deliver(@new_short_version)
16
+ UI.message 'Done!'
17
+ end
18
+
15
19
  UI.message 'Updating XcConfig...'
16
20
  Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal)
17
21
  UI.message 'Done!'
18
22
 
19
- Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: true, include_metadata: false)
23
+ Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile, include_metadata: false)
20
24
 
21
25
  UI.message 'Done.'
22
26
  end
@@ -34,18 +38,29 @@ module Fastlane
34
38
  end
35
39
 
36
40
  def self.available_options
37
- # Define all options your action supports.
38
-
39
- # Below a few examples
40
41
  [
41
- FastlaneCore::ConfigItem.new(key: :version,
42
- env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_VERSION',
43
- description: 'The version of the hotfix',
44
- is_string: true),
45
- FastlaneCore::ConfigItem.new(key: :previous_version,
46
- env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
47
- description: 'The version to branch from',
48
- is_string: true), # the default value if the user didn't provide one
42
+ FastlaneCore::ConfigItem.new(
43
+ key: :version,
44
+ env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_VERSION',
45
+ description: 'The version of the hotfix',
46
+ is_string: true
47
+ ),
48
+ FastlaneCore::ConfigItem.new(
49
+ key: :previous_version,
50
+ env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
51
+ description: 'The version to branch from',
52
+ is_string: true
53
+ ),
54
+ FastlaneCore::ConfigItem.new(
55
+ key: :skip_deliver,
56
+ env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_SKIP_DELIVER',
57
+ description: 'Skips Deliverfile key update',
58
+ is_string: false, # Boolean parameter
59
+ optional: true,
60
+ # Don't skip the Deliverfile by default. At the time of writing, 2 out of 3 consumers
61
+ # still have a Deliverfile.
62
+ default_value: false
63
+ ),
49
64
  ]
50
65
  end
51
66
 
@@ -50,7 +50,7 @@ module Fastlane
50
50
 
51
51
  if line_count <= 1
52
52
  # Single line output
53
- fw.puts("msgid \"#{File.open(@content_file_path, 'r').read}\"")
53
+ fw.puts("msgid \"#{File.open(@content_file_path, 'r').read.rstrip}\"")
54
54
  else
55
55
  # Multiple line output
56
56
  fw.puts('msgid ""')
@@ -13,7 +13,7 @@ module Fastlane
13
13
  #
14
14
  def self.commit_version_bump
15
15
  require_relative './android_version_helper'
16
- if Fastlane::Helper::Android::VersionHelper.properties_file_exists
16
+ if File.exist?(Fastlane::Helper::Android::VersionHelper.version_properties_file)
17
17
  Fastlane::Helper::GitHelper.commit(
18
18
  message: 'Bump version number',
19
19
  files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties'),
@@ -26,14 +26,12 @@ module Fastlane
26
26
  # "1.2" # Assuming build.gradle contains versionName "1.2.0"
27
27
  # "1.2.3" # Assuming build.gradle contains versionName "1.2.3"
28
28
  #
29
- # @param [String] app The name of the app to be used for beta and alpha version update
30
- #
31
29
  # @return [String] The public-facing version number, extracted from the `versionName` of the `build.gradle` file.
32
30
  # - If this version is a hotfix (more than 2 parts and 3rd part is non-zero), returns the "X.Y.Z" formatted string
33
31
  # - Otherwise (not a hotfix / 3rd part of version is 0), returns "X.Y" formatted version number
34
32
  #
35
- def self.get_public_version(app)
36
- version = get_release_version(product_name: app)
33
+ def self.get_public_version
34
+ version = get_release_version
37
35
  vp = get_version_parts(version[VERSION_NAME])
38
36
  return "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" unless is_hotfix?(version)
39
37
 
@@ -42,12 +40,10 @@ module Fastlane
42
40
 
43
41
  # Extract the version name and code from the release version of the app from `version.properties file`
44
42
  #
45
- # @param [String] app The name of the app to be used for beta and alpha version update
46
- #
47
43
  # @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
48
44
  #
49
- def self.get_release_version(product_name:)
50
- return get_version_from_properties(product_name: product_name) if properties_file_exists
45
+ def self.get_release_version
46
+ return get_version_from_properties() if File.exist?(version_properties_file)
51
47
 
52
48
  section = ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {'
53
49
  gradle_path = self.gradle_path
@@ -56,49 +52,36 @@ module Fastlane
56
52
  return { VERSION_NAME => name, VERSION_CODE => code }
57
53
  end
58
54
 
59
- def self.properties_file_exists
60
- properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
61
-
62
- return File.exist?(properties_file_path)
55
+ def self.version_properties_file
56
+ File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
63
57
  end
64
58
 
65
59
  # Extract the version name and code from the `version.properties` file in the project root
66
60
  #
67
- # @param [String] product_name The name of the app to extract the version from e.g. wordpress, simplenote
68
61
  # @param [Boolean] is_alpha true if the alpha version should be returned, false otherwise
69
62
  #
70
63
  # @return [Hash] A hash with 2 keys "name" and "code" containing the extracted version name and code, respectively
71
64
  #
72
- def self.get_version_from_properties(product_name:, is_alpha: false)
73
- version_name_key = "#{product_name}.#{is_alpha ? 'alpha.' : ''}versionName"
74
- version_code_key = "#{product_name}.#{is_alpha ? 'alpha.' : ''}versionCode"
75
-
76
- properties_file_path = File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'version.properties')
77
-
78
- return nil unless File.exist?(properties_file_path)
79
-
80
- File.open(properties_file_path, 'r') do |f|
81
- text = f.read
82
- name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
83
- code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
65
+ def self.get_version_from_properties(is_alpha: false)
66
+ return nil unless File.exist?(version_properties_file)
84
67
 
85
- f.close
68
+ version_name_key = is_alpha ? 'alpha.versionName' : 'versionName'
69
+ version_code_key = is_alpha ? 'alpha.versionCode' : 'versionCode'
86
70
 
87
- return nil if name.nil? || code.nil?
71
+ text = File.read(version_properties_file)
72
+ name = text.match(/#{version_name_key}=(\S*)/m)&.captures&.first
73
+ code = text.match(/#{version_code_key}=(\S*)/m)&.captures&.first
88
74
 
89
- return { VERSION_NAME => name, VERSION_CODE => code.to_i }
90
- end
75
+ return name.nil? || code.nil? ? nil : { VERSION_NAME => name, VERSION_CODE => code.to_i }
91
76
  end
92
77
 
93
78
  # Extract the version name and code from the `version.properties` file in the project root
94
79
  #
95
- # @param [String] app The name of the app to be used for beta and alpha version update
96
- #
97
80
  # @return [Hash] A hash with 2 keys `"name"` and `"code"` containing the extracted version name and code, respectively,
98
81
  # or `nil` if `$HAS_ALPHA_VERSION` is not defined.
99
82
  #
100
- def self.get_alpha_version(app)
101
- return get_version_from_properties(product_name: app, is_alpha: true) if properties_file_exists
83
+ def self.get_alpha_version
84
+ return get_version_from_properties(is_alpha: true) if File.exist?(version_properties_file)
102
85
 
103
86
  return nil if ENV['HAS_ALPHA_VERSION'].nil?
104
87
 
@@ -295,12 +278,11 @@ module Fastlane
295
278
 
296
279
  # Prints the current and next release version names to stdout, then returns the next release version
297
280
  #
298
- # @param [String] app The name of the app to be used for beta and alpha version update
299
281
  # @return [String] The next release version name to use after bumping the currently used release version.
300
282
  #
301
- def self.bump_version_release(app)
283
+ def self.bump_version_release
302
284
  # Bump release
303
- current_version = get_release_version(product_name: app)
285
+ current_version = self.get_release_version
304
286
  UI.message("Current version: #{current_version[VERSION_NAME]}")
305
287
  new_version = calc_next_release_base_version(current_version)
306
288
  UI.message("New version: #{new_version[VERSION_NAME]}")
@@ -311,25 +293,28 @@ module Fastlane
311
293
 
312
294
  # Update the `version.properties` file with new `versionName` and `versionCode` values
313
295
  #
314
- # @param [String] app The name of the app to be used for beta and alpha version update
315
296
  # @param [Hash] new_version_beta The version hash for the beta, containing values for keys "name" and "code"
316
297
  # @param [Hash] new_version_alpha The version hash for the alpha , containing values for keys "name" and "code"
317
298
  #
318
- def self.update_versions(app, new_version_beta, new_version_alpha)
319
- if properties_file_exists
320
- new_version_name_beta_key = "#{app}.versionName"
321
- new_version_code_beta_key = "#{app}.versionCode"
322
- new_version_name_alpha_key = "#{app}.alpha.versionName"
323
- new_version_code_alpha_key = "#{app}.alpha.versionCode"
324
- Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_beta_key}", "-Pvalue=#{new_version_beta[VERSION_NAME]}")
325
- Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_beta_key}", "-Pvalue=#{new_version_beta[VERSION_CODE]}")
326
- Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_name_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_NAME]}") unless new_version_alpha.nil?
327
- Action.sh('./gradlew', 'updateVersionProperties', "-Pkey=#{new_version_code_alpha_key}", "-Pvalue=#{new_version_alpha[VERSION_CODE]}") unless new_version_alpha.nil?
328
- return
299
+ def self.update_versions(new_version_beta, new_version_alpha)
300
+ if File.exist?(version_properties_file)
301
+ replacements = {
302
+ versionName: (new_version_beta || {})[VERSION_NAME],
303
+ versionCode: (new_version_beta || {})[VERSION_CODE],
304
+ 'alpha.versionName': (new_version_alpha || {})[VERSION_NAME],
305
+ 'alpha.versionCode': (new_version_alpha || {})[VERSION_CODE]
306
+ }
307
+ content = File.read(version_properties_file)
308
+ content.gsub!(/^(.*) ?=.*$/) do |line|
309
+ key = Regexp.last_match(1).to_sym
310
+ value = replacements[key]
311
+ value.nil? ? line : "#{key}=#{value}"
312
+ end
313
+ File.write(version_properties_file, content)
314
+ else
315
+ self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
316
+ self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
329
317
  end
330
-
331
- self.update_version(new_version_beta, ENV['HAS_ALPHA_VERSION'].nil? ? 'defaultConfig' : 'vanilla {')
332
- self.update_version(new_version_alpha, 'defaultConfig') unless new_version_alpha.nil?
333
318
  end
334
319
 
335
320
  # Compute the name of the previous hotfix version.
@@ -414,7 +399,7 @@ module Fastlane
414
399
  #
415
400
  # @return [Bool] true if the string is representing an integer value, false if not
416
401
  #
417
- def self.is_int? string
402
+ def self.is_int?(string)
418
403
  true if Integer(string) rescue false
419
404
  end
420
405
 
@@ -36,7 +36,9 @@ module Fastlane
36
36
  while continue
37
37
  child_filenames = dir.children.map! { |x| File.basename(x) }
38
38
 
39
- if child_filenames.include? 'fastlane-plugin-wpmreleasetoolkit.gemspec'
39
+ # The first case is for development – where the `.gemspec` is present in the project root
40
+ # The second case is for production – where there's no `.gemspec`, but the root dir of the plugin is named `fastlane-plugin-wpmreleasetoolkit-{version}`.
41
+ if child_filenames.include?('fastlane-plugin-wpmreleasetoolkit.gemspec') || File.basename(dir).start_with?('fastlane-plugin-wpmreleasetoolkit-')
40
42
  continue = false
41
43
  else
42
44
  dir = dir.parent
@@ -26,12 +26,35 @@ module Fastlane
26
26
  # @return [Integer] The percentage of the translated strings.
27
27
  #
28
28
  def self.get_translation_status(data:, language_code:)
29
- current = extract_value_from_translation_info_data(data: data, language_code: language_code, status: 'current')
30
- fuzzy = extract_value_from_translation_info_data(data: data, language_code: language_code, status: 'fuzzy')
31
- untranslated = extract_value_from_translation_info_data(data: data, language_code: language_code, status: 'untranslated')
32
- waiting = extract_value_from_translation_info_data(data: data, language_code: language_code, status: 'waiting')
29
+ # The status is parsed from the GlotPress project page.
30
+ # The row can be identified by the language code and the progress is in the column identified by the class "stats percent".
31
+ # When the progress is above 90%, a special badge is added.
32
+ # Because of the way the HTML is organized, this regex matches content spawned on three or four lines
33
+ # Regex:
34
+ # ^ : start of a line
35
+ # \s* : any space
36
+ # <strong><a href=".*\/#{language_code}\/default\/"> : This link contains the language code of that line in the HTML table, so it's a reliable match
37
+ # .* : any character. The language name should be here, but it can be less reliable than the language code as a match
38
+ # <\/strong> : tag closure
39
+ # \n : new line
40
+ # (?: : match the following. This starts the "morethan90" special badge, which we expect to exist zero or one times (see the closure of this part of the regex).
41
+ # \s* : any space
42
+ # <span class="bubble morethan90"> : Start of the special badge
43
+ # \d\d\d?% : 2 or 3 digits and the percentage char
44
+ # <\/span>\n : Special badge closure and new line
45
+ # )? : end of the "morethan90" special badge section. Expect this zero or one times.
46
+ # \s*<\/td>\n : column closure tag. Any space before of it are ok. Expect new line after it.
47
+ # \s* : any space
48
+ # <td class="stats percent"> : This is the tag which can be used to extract the progress
49
+ # ([0-9]+) : progress is the first group
50
+ # %<\/td> : tag closure
51
+ regex = "^\\s*<strong><a href=\".*\\/#{language_code}\\/default\\/\">.*<\\/strong>\\n"
52
+ regex += '(?:\s*<span class="bubble morethan90">\d\d\d?%<\/span>\n)?\s*<\/td>\n\s*<td class="stats percent">([0-9]+)%<\/td>$'
33
53
 
34
- (current * 100 / (current + fuzzy + untranslated + waiting)).round
54
+ # 1. Merge the array into a single string.
55
+ # 2. Match the info and extract the value in group 1.
56
+ # 3. Convert to integer.
57
+ data.join("\n").match(/#{regex}/)[1].to_i
35
58
  end
36
59
 
37
60
  # Extract the number of strings which are in the given status.
@@ -0,0 +1,93 @@
1
+ require 'fastlane_core'
2
+
3
+ # The features in this file are controlled by the following ENV vars:
4
+ #
5
+ # @env `FASTLANE_PROMPT_REMINDER_DISABLE_AUTO_PATCH`
6
+ # If this variable is set, it will disable the auto-application of the monkey patch. In such case,
7
+ # `UI.input`, `UI.confirm`, `UI.select` and `UI.password` methods won't be automatically patched
8
+ # unless you explicitly call `monkey_patch_interactive_prompts_with_reminder` yourself.
9
+ #
10
+ # @env `FASTLANE_PROMPT_REMINDER_MESSAGE`
11
+ # - If not set, then while auto-patching the `UI.…` methods, it will NOT make the patched methods
12
+ # speak any vocal message – and instead will only emit a beep and make your Terminal icon jump in the Dock.
13
+ # - If set to `default`, `true`, `yes` or `1`, then while auto-patching the `UI.…` methods, it will
14
+ # make the patched methods announce the default message.
15
+ # - If set to any other string, it will make the patched methods use that string as the message to announce
16
+ # during the reminders
17
+ # - NOTE: This env var only has an effect if the other `FASTLANE_PROMPT_REMINDER_DISABLE_AUTO_PATCH` env var
18
+ # is _not_ set (and thus the `UI.…` methods _are_ auto-patched), because it only affects how auto-patching is done.
19
+ #
20
+ # @env `FASTLANE_PROMPT_REMINDER_DELAYS`
21
+ # The delays (in seconds) to use when monkey-patching the `UI.…` methods to wrap them around `with_reminder`,
22
+ # separated by a comma (e.g. `60,300,900`). If unset, will use the default delays of `30,180,600`.
23
+
24
+ module FastlaneCore
25
+ # NOTE: FastlaneCore::UI delegates to the FastlaneCore::Shell implementation when output is the terminal
26
+ class Shell
27
+ DEFAULT_PROMPT_REMINDER_MESSAGE = 'An interactive prompt is waiting for you in the Terminal!'.freeze
28
+ DEFAULT_PROMPT_REMINDER_DELAYS = [30, 180, 600].freeze
29
+
30
+ # Calls the block given and remind the user with a vocal message if the block does not return after specific delays.
31
+ #
32
+ # Especially useful when using a block which calls methods that are interactive, in order to remind the user
33
+ # to answer the interactive prompt if they forgot about it after some delays.
34
+ #
35
+ # Example usage:
36
+ #
37
+ # text = with_reminder do
38
+ # puts "Enter some text:"
39
+ # $stdout.getch
40
+ # end
41
+ #
42
+ # @param [Double,Array<Double>] after
43
+ # Delay or list of delays to wait for before pronouncing the reminder message.
44
+ # If an array of values is passed, the message will be pronounced multiple times, after having waited for the subsequent delays in turn.
45
+ # Defaults to reminding after 30s, then 3mn, then 10mn.
46
+ # @param [String] message
47
+ # The message to pronounce out loud after the delay has passed, if the block hasn't returned beforehand.
48
+ # @return The same value that the blocks might return
49
+ #
50
+ def self.with_reminder(after: DEFAULT_PROMPT_REMINDER_DELAYS, message: DEFAULT_PROMPT_REMINDER_MESSAGE)
51
+ delays_list = Array(after.dup)
52
+ thread = Thread.new do
53
+ until delays_list.empty?
54
+ sleep(delays_list.shift)
55
+ $stdout.beep
56
+ system('say', message) unless message.nil?
57
+ end
58
+ end
59
+ # execute the interactive code
60
+ res = yield
61
+ # if we replied before the timeout, kill the thread so message won't be triggered
62
+ thread.kill
63
+ # If the block given returned a value, pass it
64
+ return res
65
+ end
66
+
67
+ # Monkey-Patch fastlane's `UI.input`, `UI.confirm`, `UI.select` and `UI.password` interactive methods
68
+ # (which delegate to `FastlaneCore::Shell` when output is the terminal)
69
+ #
70
+ # Once you call this method, any invocation of `UI.input`, `UI.confirm`, `UI.select` or `UI.password`
71
+ # anywhere in Fastlane (by your Fastfile, an action, …) will be wrapped in a call to with_reminder automatically.
72
+ #
73
+ def self.monkey_patch_interactive_prompts_with_reminder(after: DEFAULT_PROMPT_REMINDER_DELAYS, message: DEFAULT_PROMPT_REMINDER_MESSAGE)
74
+ %i[input confirm select password].each do |method_name|
75
+ old_method = instance_method(method_name)
76
+
77
+ define_method(method_name) do |*args|
78
+ FastlaneCore::Shell.with_reminder(after: after, message: message) { old_method.bind(self).call(*args) }
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ # Apply Monkey patch
86
+ unless ENV['FASTLANE_PROMPT_REMINDER_DISABLE_AUTO_PATCH']
87
+ message = ENV['FASTLANE_PROMPT_REMINDER_MESSAGE']
88
+ message = FastlaneCore::Shell::DEFAULT_PROMPT_REMINDER_MESSAGE if %w[default true yes 1].include?(message&.downcase)
89
+ delays = ENV['FASTLANE_PROMPT_REMINDER_DELAYS']&.split(',')&.map(&:to_i) || FastlaneCore::Shell::DEFAULT_PROMPT_REMINDER_DELAYS
90
+
91
+ FastlaneCore::UI.verbose("Monkey-patching the UI interactive methods to add a reminder (#{delays.inspect}, #{message.inspect})")
92
+ FastlaneCore::Shell.monkey_patch_interactive_prompts_with_reminder(after: delays, message: message)
93
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Wpmreleasetoolkit
3
- VERSION = '1.3.0'
3
+ VERSION = '2.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.3.0
4
+ version: 2.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-06-23 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -84,16 +84,22 @@ dependencies:
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '12.3'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '14.0'
90
93
  type: :runtime
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - "~>"
97
+ - - ">="
95
98
  - !ruby/object:Gem::Version
96
99
  version: '12.3'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '14.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rake-compiler
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -318,6 +324,20 @@ dependencies:
318
324
  - - "~>"
319
325
  - !ruby/object:Gem::Version
320
326
  version: '4.1'
327
+ - !ruby/object:Gem::Dependency
328
+ name: cocoapods
329
+ requirement: !ruby/object:Gem::Requirement
330
+ requirements:
331
+ - - "~>"
332
+ - !ruby/object:Gem::Version
333
+ version: '1.10'
334
+ type: :development
335
+ prerelease: false
336
+ version_requirements: !ruby/object:Gem::Requirement
337
+ requirements:
338
+ - - "~>"
339
+ - !ruby/object:Gem::Version
340
+ version: '1.10'
321
341
  description:
322
342
  email: lore.mattei@gmail.com
323
343
  executables:
@@ -442,6 +462,7 @@ files:
442
462
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb
443
463
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb
444
464
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb
465
+ - lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb
445
466
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb
446
467
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb
447
468
  - lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb