fastlane 2.175.0 → 2.180.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +95 -82
  4. data/cert/lib/cert/options.rb +1 -0
  5. data/cert/lib/cert/runner.rb +5 -1
  6. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  7. data/deliver/lib/deliver/download_screenshots.rb +1 -2
  8. data/deliver/lib/deliver/options.rb +1 -0
  9. data/deliver/lib/deliver/runner.rb +12 -4
  10. data/deliver/lib/deliver/setup.rb +0 -1
  11. data/deliver/lib/deliver/upload_metadata.rb +5 -4
  12. data/deliver/lib/deliver/upload_screenshots.rb +10 -10
  13. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +6 -1
  14. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +8 -5
  15. data/fastlane/lib/fastlane/actions/appaloosa.rb +7 -2
  16. data/fastlane/lib/fastlane/actions/backup_file.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/build_app.rb +4 -0
  18. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +4 -0
  19. data/fastlane/lib/fastlane/actions/commit_github_file.rb +11 -1
  20. data/fastlane/lib/fastlane/actions/create_xcframework.rb +5 -0
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -1
  22. data/fastlane/lib/fastlane/actions/get_github_release.rb +11 -1
  23. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +4 -0
  24. data/fastlane/lib/fastlane/actions/get_version_number.rb +17 -10
  25. data/fastlane/lib/fastlane/actions/git_branch.rb +4 -10
  26. data/fastlane/lib/fastlane/actions/git_tag_exists.rb +4 -0
  27. data/fastlane/lib/fastlane/actions/github_api.rb +2 -1
  28. data/fastlane/lib/fastlane/actions/increment_build_number.rb +8 -1
  29. data/fastlane/lib/fastlane/actions/install_provisioning_profile.rb +4 -0
  30. data/fastlane/lib/fastlane/actions/jazzy.rb +10 -1
  31. data/fastlane/lib/fastlane/actions/jira.rb +61 -14
  32. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +1 -0
  33. data/fastlane/lib/fastlane/actions/match_nuke.rb +59 -0
  34. data/fastlane/lib/fastlane/actions/notarize.rb +98 -51
  35. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +0 -1
  36. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  37. data/fastlane/lib/fastlane/actions/register_devices.rb +1 -1
  38. data/fastlane/lib/fastlane/actions/restore_file.rb +1 -1
  39. data/fastlane/lib/fastlane/actions/set_changelog.rb +1 -1
  40. data/fastlane/lib/fastlane/actions/sourcedocs.rb +164 -0
  41. data/fastlane/lib/fastlane/actions/spaceship_logs.rb +1 -1
  42. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +1 -2
  43. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -5
  44. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +5 -1
  45. data/fastlane/lib/fastlane/erb_template_helper.rb +7 -1
  46. data/fastlane/lib/fastlane/fast_file.rb +9 -5
  47. data/fastlane/lib/fastlane/helper/git_helper.rb +11 -7
  48. data/fastlane/lib/fastlane/plugins/plugin_fetcher.rb +1 -2
  49. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +1 -2
  50. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -2
  51. data/fastlane/lib/fastlane/setup/setup.rb +23 -10
  52. data/fastlane/lib/fastlane/swift_fastlane_function.rb +4 -0
  53. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +2 -0
  54. data/fastlane/lib/fastlane/version.rb +1 -1
  55. data/fastlane/swift/Deliverfile.swift +1 -1
  56. data/fastlane/swift/DeliverfileProtocol.swift +3 -3
  57. data/fastlane/swift/Fastlane.swift +574 -332
  58. data/fastlane/swift/Gymfile.swift +1 -1
  59. data/fastlane/swift/GymfileProtocol.swift +1 -1
  60. data/fastlane/swift/LaneFileProtocol.swift +9 -3
  61. data/fastlane/swift/Matchfile.swift +1 -1
  62. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  63. data/fastlane/swift/Precheckfile.swift +1 -1
  64. data/fastlane/swift/PrecheckfileProtocol.swift +3 -3
  65. data/fastlane/swift/RubyCommand.swift +1 -1
  66. data/fastlane/swift/Scanfile.swift +1 -1
  67. data/fastlane/swift/ScanfileProtocol.swift +13 -1
  68. data/fastlane/swift/Screengrabfile.swift +1 -1
  69. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  70. data/fastlane/swift/Snapshotfile.swift +1 -1
  71. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  72. data/fastlane/swift/SocketClient.swift +2 -1
  73. data/fastlane/swift/SocketResponse.swift +4 -2
  74. data/fastlane/swift/formatting/Brewfile.lock.json +12 -12
  75. data/fastlane_core/lib/fastlane_core.rb +1 -0
  76. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +5 -3
  77. data/fastlane_core/lib/fastlane_core/helper.rb +24 -1
  78. data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +3 -2
  79. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +14 -8
  80. data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +3 -2
  81. data/fastlane_core/lib/fastlane_core/project.rb +3 -14
  82. data/{deliver/lib/deliver → fastlane_core/lib/fastlane_core}/queue_worker.rb +4 -4
  83. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +12 -1
  84. data/fastlane_core/lib/fastlane_core/ui/interface.rb +1 -1
  85. data/gym/lib/gym/generators/.package_command_generator_xcode7.rb.swp +0 -0
  86. data/gym/lib/gym/generators/package_command_generator.rb +4 -0
  87. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +13 -8
  88. data/gym/lib/gym/runner.rb +11 -4
  89. data/match/lib/match/change_password.rb +3 -3
  90. data/match/lib/match/encryption/interface.rb +1 -1
  91. data/match/lib/match/encryption/openssl.rb +2 -2
  92. data/match/lib/match/importer.rb +1 -1
  93. data/match/lib/match/migrate.rb +1 -1
  94. data/match/lib/match/module.rb +1 -0
  95. data/match/lib/match/nuke.rb +1 -1
  96. data/match/lib/match/runner.rb +1 -1
  97. data/match/lib/match/storage/google_cloud_storage.rb +1 -1
  98. data/match/lib/match/storage/s3_storage.rb +1 -1
  99. data/pilot/lib/pilot/build_manager.rb +25 -8
  100. data/pilot/lib/pilot/manager.rb +5 -1
  101. data/pilot/lib/pilot/options.rb +4 -3
  102. data/precheck/lib/precheck/options.rb +1 -0
  103. data/precheck/lib/precheck/runner.rb +6 -2
  104. data/scan/lib/scan/detect_values.rb +4 -1
  105. data/scan/lib/scan/options.rb +20 -5
  106. data/scan/lib/scan/runner.rb +79 -1
  107. data/scan/lib/scan/test_command_generator.rb +8 -8
  108. data/screengrab/lib/screengrab/android_environment.rb +6 -4
  109. data/screengrab/lib/screengrab/runner.rb +2 -3
  110. data/sigh/lib/sigh/download_all.rb +1 -1
  111. data/sigh/lib/sigh/options.rb +1 -0
  112. data/sigh/lib/sigh/runner.rb +5 -1
  113. data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
  114. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  115. data/spaceship/lib/spaceship/client.rb +18 -17
  116. data/spaceship/lib/spaceship/connect_api/api_client.rb +24 -6
  117. data/spaceship/lib/spaceship/connect_api/models/app.rb +1 -1
  118. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +5 -0
  119. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +1 -1
  120. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +5 -0
  121. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +6 -0
  122. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +5 -0
  123. data/spaceship/lib/spaceship/connect_api/models/build.rb +5 -0
  124. data/spaceship/lib/spaceship/connect_api/models/build_beta_detail.rb +4 -0
  125. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +13 -0
  126. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  127. data/spaceship/lib/spaceship/connect_api/token.rb +8 -2
  128. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +15 -0
  129. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +41 -28
  130. metadata +26 -21
@@ -70,6 +70,7 @@ module Fastlane
70
70
  short_option: "-u",
71
71
  env_name: "ITUNESCONNECT_USER",
72
72
  description: "Your Apple ID Username",
73
+ optional: true,
73
74
  default_value: user,
74
75
  default_value_dynamic: true),
75
76
  FastlaneCore::ConfigItem.new(key: :version,
@@ -0,0 +1,59 @@
1
+ module Fastlane
2
+ module Actions
3
+ class MatchNukeAction < Action
4
+ def self.run(params)
5
+ require 'match'
6
+
7
+ params.load_configuration_file("Matchfile")
8
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
9
+
10
+ cert_type = Match.cert_type_sym(params[:type])
11
+ UI.important("Going to revoke your '#{cert_type}' certificate type and provisioning profiles")
12
+
13
+ Match::Nuke.new.run(params, type: cert_type)
14
+ end
15
+
16
+ #####################################################
17
+ # @!group Documentation
18
+ #####################################################
19
+
20
+ def self.description
21
+ "Easily nuke your certificate and provisioning profiles (via _match_)"
22
+ end
23
+
24
+ def self.details
25
+ [
26
+ "Use the match_nuke action to revoke your certificates and provisioning profiles.",
27
+ "Don't worry, apps that are already available in the App Store / TestFlight will still work.",
28
+ "Builds distributed via Ad Hoc or Enterprise will be disabled after nuking your account, so you'll have to re-upload a new build.",
29
+ "After clearing your account you'll start from a clean state, and you can run match to generate your certificates and profiles again.",
30
+ "More information: https://docs.fastlane.tools/actions/match/"
31
+ ].join("\n")
32
+ end
33
+
34
+ def self.available_options
35
+ require 'match'
36
+ Match::Options.available_options
37
+ end
38
+
39
+ def self.is_supported?(platform)
40
+ [:ios, :mac].include?(platform)
41
+ end
42
+
43
+ def self.example_code
44
+ [
45
+ 'match_nuke(type: "development")', # See all other options https://github.com/fastlane/fastlane/blob/master/match/lib/match/module.rb#L23
46
+ 'match_nuke(type: "development", api_key: app_store_connect_api_key)'
47
+ ]
48
+ end
49
+
50
+ def self.authors
51
+ ["crazymanish"]
52
+ end
53
+
54
+ def self.category
55
+ :code_signing
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,12 +1,14 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class NotarizeAction < Action
4
+ # rubocop:disable Metrics/PerceivedComplexity
4
5
  def self.run(params)
5
6
  package_path = params[:package]
6
7
  bundle_id = params[:bundle_id]
7
8
  try_early_stapling = params[:try_early_stapling]
8
9
  print_log = params[:print_log]
9
10
  verbose = params[:verbose]
11
+ api_key_path = params[:api_key_path]
10
12
 
11
13
  # Compress and read bundle identifier only for .app bundle.
12
14
  compressed_package_path = nil
@@ -28,68 +30,73 @@ module Fastlane
28
30
 
29
31
  UI.user_error!('Could not read bundle identifier, provide as a parameter') unless bundle_id
30
32
 
31
- apple_id_account = CredentialsManager::AccountManager.new(user: params[:username])
32
-
33
- # Add password as a temporary environment variable for altool.
34
- # Use app specific password if specified.
35
- ENV['FL_NOTARIZE_PASSWORD'] = ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD'] || apple_id_account.password
36
-
37
33
  UI.message('Uploading package to notarization service, might take a while')
38
34
 
39
- notarization_upload_command = "xcrun altool --notarize-app -t osx -f \"#{compressed_package_path || package_path}\" --primary-bundle-id #{bundle_id} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD --output-format xml"
40
- notarization_upload_command << " --asc-provider \"#{params[:asc_provider]}\"" if params[:asc_provider]
35
+ notarization_upload_command = "xcrun altool --notarize-app -t osx -f \"#{compressed_package_path || package_path}\" --primary-bundle-id #{bundle_id} --output-format xml"
41
36
 
42
- notarization_upload_response = Actions.sh(
43
- notarization_upload_command,
44
- log: verbose
45
- )
37
+ notarization_info = {}
38
+ with_notarize_authenticator(params, api_key_path) do |notarize_authenticator|
39
+ notarization_upload_command << " --asc-provider \"#{params[:asc_provider]}\"" if params[:asc_provider] && api_key_path.nil?
46
40
 
47
- FileUtils.rm_rf(compressed_package_path) if compressed_package_path
41
+ notarization_upload_response = Actions.sh(
42
+ notarize_authenticator.call(notarization_upload_command),
43
+ log: verbose
44
+ )
48
45
 
49
- notarization_upload_plist = Plist.parse_xml(notarization_upload_response)
50
- notarization_request_id = notarization_upload_plist['notarization-upload']['RequestUUID']
46
+ FileUtils.rm_rf(compressed_package_path) if compressed_package_path
51
47
 
52
- UI.success("Successfully uploaded package to notarization service with request identifier #{notarization_request_id}")
48
+ notarization_upload_plist = Plist.parse_xml(notarization_upload_response)
53
49
 
54
- notarization_info = {}
55
- while notarization_info.empty? || (notarization_info['Status'] == 'in progress')
56
- if notarization_info.empty?
57
- UI.message('Waiting to query request status')
58
- elsif try_early_stapling
59
- UI.message('Request in progress, trying early staple')
60
-
61
- begin
62
- self.staple(package_path, verbose)
63
- UI.message('Successfully notarized and early stapled package.')
64
-
65
- return
66
- rescue
67
- UI.message('Early staple failed, waiting to query again')
68
- end
50
+ if notarization_upload_plist.key?('product-errors') && notarization_upload_plist['product-errors'].any?
51
+ UI.important("🚫 Could not upload package to notarization service! Here are the reasons:")
52
+ notarization_upload_plist['product-errors'].each { |product_error| UI.error("#{product_error['message']} (#{product_error['code']})") }
53
+ UI.user_error!("Package upload to notarization service cancelled. Please check the error messages above.")
69
54
  end
70
55
 
71
- sleep(30)
72
-
73
- UI.message('Querying request status')
74
-
75
- # As of July 2020, the request UUID might not be available for polling yet which returns an error code
76
- # This is now handled with the error_callback (which prevents an error from being raised)
77
- # Catching this error allows for polling to continue until the notarization is complete
78
- error = false
79
- notarization_info_response = Actions.sh(
80
- "xcrun altool --notarization-info #{notarization_request_id} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD --output-format xml",
81
- log: verbose,
82
- error_callback: lambda { |msg|
83
- error = true
84
- UI.error("Error polling for notarization info: #{msg}")
85
- }
86
- )
56
+ notarization_request_id = notarization_upload_plist['notarization-upload']['RequestUUID']
57
+
58
+ UI.success("Successfully uploaded package to notarization service with request identifier #{notarization_request_id}")
59
+
60
+ while notarization_info.empty? || (notarization_info['Status'] == 'in progress')
61
+ if notarization_info.empty?
62
+ UI.message('Waiting to query request status')
63
+ elsif try_early_stapling
64
+ UI.message('Request in progress, trying early staple')
65
+
66
+ begin
67
+ self.staple(package_path, verbose)
68
+ UI.message('Successfully notarized and early stapled package.')
69
+
70
+ return
71
+ rescue
72
+ UI.message('Early staple failed, waiting to query again')
73
+ end
74
+ end
87
75
 
88
- unless error
89
- notarization_info_plist = Plist.parse_xml(notarization_info_response)
90
- notarization_info = notarization_info_plist['notarization-info']
76
+ sleep(30)
77
+
78
+ UI.message('Querying request status')
79
+
80
+ # As of July 2020, the request UUID might not be available for polling yet which returns an error code
81
+ # This is now handled with the error_callback (which prevents an error from being raised)
82
+ # Catching this error allows for polling to continue until the notarization is complete
83
+ error = false
84
+ notarization_info_response = Actions.sh(
85
+ notarize_authenticator.call("xcrun altool --notarization-info #{notarization_request_id} --output-format xml"),
86
+ log: verbose,
87
+ error_callback: lambda { |msg|
88
+ error = true
89
+ UI.error("Error polling for notarization info: #{msg}")
90
+ }
91
+ )
92
+
93
+ unless error
94
+ notarization_info_plist = Plist.parse_xml(notarization_info_response)
95
+ notarization_info = notarization_info_plist['notarization-info']
96
+ end
91
97
  end
92
98
  end
99
+ # rubocop:enable Metrics/PerceivedComplexity
93
100
 
94
101
  log_url = notarization_info['LogFileURL']
95
102
  ENV['FL_NOTARIZE_LOG_FILE_URL'] = log_url
@@ -123,6 +130,35 @@ module Fastlane
123
130
  )
124
131
  end
125
132
 
133
+ def self.with_notarize_authenticator(params, api_key_path)
134
+ if api_key_path
135
+ # From xcrun altool for --apiKey:
136
+ # This option will search the following directories in sequence for a private key file with the name of 'AuthKey_<api_key>.p8': './private_keys', '~/private_keys', '~/.private_keys', and '~/.appstoreconnect/private_keys'.
137
+ api_key = Spaceship::ConnectAPI::Token.from_json_file(api_key_path)
138
+ api_key_folder_path = File.expand_path('~/.appstoreconnect/private_keys')
139
+ api_key_file_path = File.join(api_key_folder_path, "AuthKey_#{api_key.key_id}.p8")
140
+ directory_exists = File.directory?(api_key_folder_path)
141
+ file_exists = File.exist?(api_key_file_path)
142
+ begin
143
+ FileUtils.mkdir_p(api_key_folder_path) unless directory_exists
144
+ api_key.write_key_to_file(api_key_file_path) unless file_exists
145
+
146
+ yield(proc { |command| "#{command} --apiKey #{api_key.key_id} --apiIssuer #{api_key.issuer_id}" })
147
+ ensure
148
+ FileUtils.rm(api_key_file_path) unless file_exists
149
+ FileUtils.rm_r(api_key_folder_path) unless directory_exists
150
+ end
151
+ else
152
+ apple_id_account = CredentialsManager::AccountManager.new(user: params[:username])
153
+
154
+ # Add password as a temporary environment variable for altool.
155
+ # Use app specific password if specified.
156
+ ENV['FL_NOTARIZE_PASSWORD'] = ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD'] || apple_id_account.password
157
+
158
+ yield(proc { |command| "#{command} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD" })
159
+ end
160
+ end
161
+
126
162
  def self.description
127
163
  'Notarizes a macOS app'
128
164
  end
@@ -160,6 +196,8 @@ module Fastlane
160
196
  env_name: 'FL_NOTARIZE_USERNAME',
161
197
  description: 'Apple ID username',
162
198
  default_value: username,
199
+ optional: true,
200
+ conflicting_options: [:api_key_path],
163
201
  default_value_dynamic: true),
164
202
  FastlaneCore::ConfigItem.new(key: :asc_provider,
165
203
  env_name: 'FL_NOTARIZE_ASC_PROVIDER',
@@ -177,7 +215,16 @@ module Fastlane
177
215
  description: 'Whether to log requests',
178
216
  optional: true,
179
217
  default_value: false,
180
- type: Boolean)
218
+ type: Boolean),
219
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
220
+ env_name: 'FL_NOTARIZE_API_KEY_PATH',
221
+ description: 'Path to AppStore Connect API key',
222
+ optional: true,
223
+ conflicting_options: [:username],
224
+ is_string: true,
225
+ verify_block: proc do |value|
226
+ UI.user_error!("API Key not found at '#{value}'") unless File.exist?(value)
227
+ end)
181
228
  ]
182
229
  end
183
230
 
@@ -36,7 +36,6 @@ module Fastlane
36
36
  params[:push_options].each { |push_option| command << "--push-option=#{push_option}" } if params[:push_options]
37
37
 
38
38
  # execute our command
39
- Actions.sh('pwd')
40
39
  return command.join(' ') if Helper.test?
41
40
 
42
41
  Actions.sh(command.join(' '))
@@ -39,7 +39,7 @@ module Fastlane
39
39
 
40
40
  def self.api_token(params)
41
41
  params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
42
- api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
42
+ api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
43
43
  api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
44
44
  return api_token
45
45
  end
@@ -85,7 +85,7 @@ module Fastlane
85
85
 
86
86
  def self.api_token(params)
87
87
  params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
88
- api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
88
+ api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
89
89
  api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
90
90
  return api_token
91
91
  end
@@ -5,7 +5,7 @@ module Fastlane
5
5
  path = params[:path]
6
6
  backup_path = "#{path}.back"
7
7
  UI.user_error!("Could not find file '#{backup_path}'") unless File.exist?(backup_path)
8
- FileUtils.cp(backup_path, path, { preserve: true })
8
+ FileUtils.cp(backup_path, path, preserve: true)
9
9
  FileUtils.rm(backup_path)
10
10
  UI.message("Successfully restored backup 📤")
11
11
  end
@@ -80,7 +80,7 @@ module Fastlane
80
80
 
81
81
  def self.api_token(params)
82
82
  params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
83
- api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
83
+ api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
84
84
  api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
85
85
  return api_token
86
86
  end
@@ -0,0 +1,164 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SourcedocsAction < Action
4
+ def self.run(params)
5
+ UI.user_error!("You have to install sourcedocs using `brew install sourcedocs`") if `which sourcedocs`.to_s.length == 0 && !Helper.test?
6
+
7
+ command = "sourcedocs generate"
8
+ command << " --all-modules" if params[:all_modules]
9
+ command << " --spm-module #{params[:spm_module]}" unless params[:spm_module].nil?
10
+ command << " --module-name #{params[:module_name]}" unless params[:module_name].nil?
11
+ command << " --link-beginning #{params[:link_beginning]}" unless params[:link_beginning].nil?
12
+ command << " --link-ending #{params[:link_ending]}" unless params[:link_ending].nil?
13
+ command << " --output-folder #{params[:output_folder]}" unless params[:output_folder].nil?
14
+ command << " --min-acl #{params[:min_acl]}" unless params[:min_acl].nil?
15
+ command << " --module-name-path" if params[:module_name_path]
16
+ command << " --clean" if params[:clean]
17
+ command << " --collapsible" if params[:collapsible]
18
+ command << " --table-of-contents" if params[:table_of_contents]
19
+ command << " --reproducible-docs" if params[:reproducible]
20
+ unless params[:scheme].nil?
21
+ command << " -- -scheme #{params[:scheme]}"
22
+ command << " -sdk #{params[:sdk_platform]}" unless params[:sdk_platform].nil?
23
+ end
24
+ Actions.sh(command)
25
+ end
26
+
27
+ #####################################################
28
+ # @!group Documentation
29
+ #####################################################
30
+
31
+ def self.description
32
+ "Generate docs using SourceDocs"
33
+ end
34
+
35
+ def self.available_options
36
+ [
37
+ FastlaneCore::ConfigItem.new(
38
+ key: :all_modules,
39
+ env_name: 'FL_SOURCEDOCS_OUTPUT_ALL_MODULES',
40
+ description: 'Generate documentation for all modules in a Swift package',
41
+ type: Boolean,
42
+ optional: true
43
+ ),
44
+ FastlaneCore::ConfigItem.new(
45
+ key: :spm_module,
46
+ env_name: 'FL_SOURCEDOCS_SPM_MODULE',
47
+ description: 'Generate documentation for Swift Package Manager module',
48
+ type: String,
49
+ optional: true
50
+ ),
51
+ FastlaneCore::ConfigItem.new(
52
+ key: :module_name,
53
+ env_name: 'FL_SOURCEDOCS_MODULE_NAME',
54
+ description: 'Generate documentation for a Swift module',
55
+ type: String,
56
+ optional: true
57
+ ),
58
+ FastlaneCore::ConfigItem.new(
59
+ key: :link_beginning,
60
+ env_name: 'FL_SOURCEDOCS_LINK_BEGINNING',
61
+ description: 'The text to begin links with',
62
+ type: String,
63
+ optional: true
64
+ ),
65
+ FastlaneCore::ConfigItem.new(
66
+ key: :link_ending,
67
+ env_name: 'FL_SOURCEDOCS_LINK_ENDING',
68
+ description: 'The text to end links with (default: .md)',
69
+ type: String,
70
+ optional: true
71
+ ),
72
+ FastlaneCore::ConfigItem.new(
73
+ key: :output_folder,
74
+ env_name: 'FL_SOURCEDOCS_OUTPUT_FOLDER',
75
+ description: 'Output directory to clean (default: Documentation/Reference)',
76
+ type: String,
77
+ optional: false
78
+ ),
79
+ FastlaneCore::ConfigItem.new(
80
+ key: :min_acl,
81
+ env_name: 'FL_SOURCEDOCS_MIN_ACL',
82
+ description: 'Access level to include in documentation [private, fileprivate, internal, public, open] (default: public)',
83
+ type: String,
84
+ optional: true
85
+ ),
86
+ FastlaneCore::ConfigItem.new(
87
+ key: :module_name_path,
88
+ env_name: 'FL_SOURCEDOCS_MODULE_NAME_PATH',
89
+ description: 'Include the module name as part of the output folder path',
90
+ type: Boolean,
91
+ optional: true
92
+ ),
93
+ FastlaneCore::ConfigItem.new(
94
+ key: :clean,
95
+ env_name: 'FL_SOURCEDOCS_CLEAN',
96
+ description: 'Delete output folder before generating documentation',
97
+ type: Boolean,
98
+ optional: true
99
+ ),
100
+ FastlaneCore::ConfigItem.new(
101
+ key: :collapsible,
102
+ env_name: 'FL_SOURCEDOCS_COLLAPSIBLE',
103
+ description: 'Put methods, properties and enum cases inside collapsible blocks',
104
+ type: Boolean,
105
+ optional: true
106
+ ),
107
+ FastlaneCore::ConfigItem.new(
108
+ key: :table_of_contents,
109
+ env_name: 'FL_SOURCEDOCS_TABLE_OF_CONTENT',
110
+ description: 'Generate a table of contents with properties and methods for each type',
111
+ type: Boolean,
112
+ optional: true
113
+ ),
114
+ FastlaneCore::ConfigItem.new(
115
+ key: :reproducible,
116
+ env_name: 'FL_SOURCEDOCS_REPRODUCIBLE',
117
+ description: 'Generate documentation that is reproducible: only depends on the sources',
118
+ type: Boolean,
119
+ optional: true
120
+ ),
121
+ FastlaneCore::ConfigItem.new(
122
+ key: :scheme,
123
+ env_name: 'FL_SOURCEDOCS_SCHEME',
124
+ description: 'Create documentation for specific scheme',
125
+ type: String,
126
+ optional: true
127
+ ),
128
+ FastlaneCore::ConfigItem.new(
129
+ key: :sdk_platform,
130
+ env_name: 'FL_SOURCEDOCS_SDK_PlATFORM',
131
+ description: 'Create documentation for specific sdk platform',
132
+ type: String,
133
+ optional: true
134
+ )
135
+ ]
136
+ end
137
+
138
+ def self.output
139
+ end
140
+
141
+ def self.return_value
142
+ end
143
+
144
+ def self.authors
145
+ ["Kukurijek"]
146
+ end
147
+
148
+ def self.is_supported?(platform)
149
+ [:ios, :mac].include?(platform)
150
+ end
151
+
152
+ def self.example_code
153
+ [
154
+ "sourcedocs(output_folder: 'docs')",
155
+ "sourcedocs(output_folder: 'docs', clean: true, reproducible: true, scheme: 'MyApp')"
156
+ ]
157
+ end
158
+
159
+ def self.category
160
+ :documentation
161
+ end
162
+ end
163
+ end
164
+ end