fastlane 2.180.0 → 2.183.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +86 -86
  3. data/cert/lib/cert/commands_generator.rb +2 -1
  4. data/deliver/lib/assets/summary.html.erb +10 -10
  5. data/deliver/lib/deliver/commands_generator.rb +2 -1
  6. data/deliver/lib/deliver/languages.rb +1 -1
  7. data/deliver/lib/deliver/options.rb +2 -2
  8. data/deliver/lib/deliver/submit_for_review.rb +3 -3
  9. data/deliver/lib/deliver/upload_metadata.rb +1 -1
  10. data/fastlane/lib/fastlane/actions/actions_helper.rb +2 -2
  11. data/fastlane/lib/fastlane/actions/backup_xcarchive.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/clipboard.rb +3 -6
  13. data/fastlane/lib/fastlane/actions/danger.rb +7 -1
  14. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +18 -1
  16. data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +2 -6
  17. data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +3 -1
  18. data/fastlane/lib/fastlane/actions/git_branch.rb +1 -1
  19. data/fastlane/lib/fastlane/actions/git_commit.rb +3 -1
  20. data/fastlane/lib/fastlane/actions/git_pull.rb +4 -10
  21. data/fastlane/lib/fastlane/actions/git_submodule_update.rb +16 -8
  22. data/fastlane/lib/fastlane/actions/hipchat.rb +2 -1
  23. data/fastlane/lib/fastlane/actions/import_from_git.rb +5 -5
  24. data/fastlane/lib/fastlane/actions/notification.rb +1 -1
  25. data/fastlane/lib/fastlane/actions/slack.rb +155 -133
  26. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -2
  27. data/fastlane/lib/fastlane/actions/xcodebuild.rb +5 -5
  28. data/fastlane/lib/fastlane/cli_tools_distributor.rb +1 -1
  29. data/fastlane/lib/fastlane/commands_generator.rb +2 -1
  30. data/fastlane/lib/fastlane/fast_file.rb +10 -2
  31. data/fastlane/lib/fastlane/fastlane_require.rb +7 -1
  32. data/fastlane/lib/fastlane/helper/git_helper.rb +9 -1
  33. data/fastlane/lib/fastlane/lane_manager.rb +3 -2
  34. data/fastlane/lib/fastlane/notification/slack.rb +56 -0
  35. data/fastlane/lib/fastlane/plugins/plugin_info.rb +2 -2
  36. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +7 -6
  37. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +30 -35
  38. data/fastlane/lib/fastlane/plugins/template/spec/spec_helper.rb.erb +1 -1
  39. data/fastlane/lib/fastlane/swift_fastlane_function.rb +35 -14
  40. data/fastlane/lib/fastlane/version.rb +2 -2
  41. data/fastlane/swift/Deliverfile.swift +1 -1
  42. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  43. data/fastlane/swift/Fastlane.swift +6621 -3802
  44. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +4 -0
  45. data/fastlane/swift/Gymfile.swift +1 -1
  46. data/fastlane/swift/GymfileProtocol.swift +1 -1
  47. data/fastlane/swift/Matchfile.swift +1 -1
  48. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  49. data/fastlane/swift/OptionalConfigValue.swift +131 -0
  50. data/fastlane/swift/Precheckfile.swift +1 -1
  51. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  52. data/fastlane/swift/Scanfile.swift +1 -1
  53. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  54. data/fastlane/swift/Screengrabfile.swift +1 -1
  55. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  56. data/fastlane/swift/Snapshotfile.swift +1 -1
  57. data/fastlane/swift/SnapshotfileProtocol.swift +5 -1
  58. data/fastlane/swift/formatting/Brewfile.lock.json +17 -15
  59. data/fastlane/swift/upgrade_manifest.json +1 -1
  60. data/fastlane_core/lib/fastlane_core.rb +22 -21
  61. data/fastlane_core/lib/fastlane_core/build_watcher.rb +65 -11
  62. data/fastlane_core/lib/fastlane_core/clipboard.rb +20 -0
  63. data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
  64. data/fastlane_core/lib/fastlane_core/helper.rb +4 -4
  65. data/fastlane_core/lib/fastlane_core/languages.rb +2 -2
  66. data/fastlane_core/lib/fastlane_core/swag.rb +1 -1
  67. data/fastlane_core/lib/fastlane_core/ui/help.erb +35 -0
  68. data/fastlane_core/lib/fastlane_core/ui/help_formatter.rb +16 -0
  69. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +4 -1
  70. data/frameit/lib/frameit/commands_generator.rb +2 -1
  71. data/frameit/lib/frameit/config_parser.rb +2 -2
  72. data/frameit/lib/frameit/frame_downloader.rb +2 -1
  73. data/gym/lib/gym/code_signing_mapping.rb +2 -2
  74. data/gym/lib/gym/commands_generator.rb +2 -1
  75. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +6 -5
  76. data/gym/lib/gym/runner.rb +5 -1
  77. data/match/lib/match/commands_generator.rb +2 -1
  78. data/pem/lib/pem/commands_generator.rb +2 -1
  79. data/pilot/lib/pilot/build_manager.rb +3 -3
  80. data/pilot/lib/pilot/commands_generator.rb +2 -1
  81. data/pilot/lib/pilot/options.rb +2 -2
  82. data/pilot/lib/pilot/tester_exporter.rb +0 -1
  83. data/pilot/lib/pilot/tester_manager.rb +0 -1
  84. data/precheck/lib/precheck/commands_generator.rb +2 -1
  85. data/produce/lib/produce/commands_generator.rb +2 -1
  86. data/scan/lib/scan/commands_generator.rb +2 -1
  87. data/scan/lib/scan/runner.rb +3 -1
  88. data/scan/lib/scan/test_command_generator.rb +3 -1
  89. data/screengrab/lib/screengrab/commands_generator.rb +2 -1
  90. data/sigh/lib/sigh/commands_generator.rb +2 -1
  91. data/snapshot/lib/assets/SnapfileTemplate +1 -1
  92. data/snapshot/lib/snapshot/commands_generator.rb +3 -1
  93. data/snapshot/lib/snapshot/options.rb +5 -0
  94. data/snapshot/lib/snapshot/reports_generator.rb +4 -0
  95. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  96. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +1 -1
  97. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +8 -4
  98. data/spaceship/README.md +2 -12
  99. data/spaceship/lib/spaceship/base.rb +2 -2
  100. data/spaceship/lib/spaceship/commands_generator.rb +4 -2
  101. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  102. data/spaceship/lib/spaceship/connect_api/models/profile.rb +6 -0
  103. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +6 -2
  104. data/spaceship/lib/spaceship/spaceauth_runner.rb +19 -9
  105. data/spaceship/lib/spaceship/tunes/members.rb +1 -1
  106. data/spaceship/lib/spaceship/ui.rb +2 -2
  107. data/supply/lib/supply/.client.rb.swp +0 -0
  108. data/supply/lib/supply/.listing.rb.swp +0 -0
  109. data/supply/lib/supply/.uploader.rb.swp +0 -0
  110. data/supply/lib/supply/client.rb +4 -2
  111. data/supply/lib/supply/commands_generator.rb +2 -1
  112. data/supply/lib/supply/options.rb +2 -2
  113. data/supply/lib/supply/uploader.rb +1 -0
  114. metadata +75 -84
  115. data/pilot/lib/pilot/tester_util.rb +0 -0
@@ -5,8 +5,10 @@ module Fastlane
5
5
  require 'tmpdir'
6
6
 
7
7
  find_binary_path(params)
8
- find_gsp_path(params)
9
- find_api_token(params)
8
+ unless params[:app_id]
9
+ find_gsp_path(params)
10
+ find_api_token(params)
11
+ end
10
12
 
11
13
  if !params[:app_id] && !params[:gsp_path] && !params[:api_token]
12
14
  UI.user_error!('Either Firebase Crashlytics App ID, path to GoogleService-Info.plist or legacy Fabric API key must be given.')
@@ -305,12 +305,12 @@ module Fastlane
305
305
 
306
306
  # Normalize some values
307
307
  export_options[:teamID] = CredentialsManager::AppfileConfig.try_fetch_value(:team_id) if !export_options[:teamID] && CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
308
- export_options[:onDemandResourcesAssetPacksBaseURL] = URI.escape(export_options[:onDemandResourcesAssetPacksBaseURL]) if export_options[:onDemandResourcesAssetPacksBaseURL]
308
+ export_options[:onDemandResourcesAssetPacksBaseURL] = Addressable::URI.encode(export_options[:onDemandResourcesAssetPacksBaseURL]) if export_options[:onDemandResourcesAssetPacksBaseURL]
309
309
  if export_options[:manifest]
310
- export_options[:manifest][:appURL] = URI.encode_www_form_component(export_options[:manifest][:appURL]) if export_options[:manifest][:appURL]
311
- export_options[:manifest][:displayImageURL] = URI.encode_www_form_component(export_options[:manifest][:displayImageURL]) if export_options[:manifest][:displayImageURL]
312
- export_options[:manifest][:fullSizeImageURL] = URI.encode_www_form_component(export_options[:manifest][:fullSizeImageURL]) if export_options[:manifest][:fullSizeImageURL]
313
- export_options[:manifest][:assetPackManifestURL] = URI.encode_www_form_component(export_options[:manifest][:assetPackManifestURL]) if export_options[:manifest][:assetPackManifestURL]
310
+ export_options[:manifest][:appURL] = Addressable::URI.encode(export_options[:manifest][:appURL]) if export_options[:manifest][:appURL]
311
+ export_options[:manifest][:displayImageURL] = Addressable::URI.encode(export_options[:manifest][:displayImageURL]) if export_options[:manifest][:displayImageURL]
312
+ export_options[:manifest][:fullSizeImageURL] = Addressable::URI.encode(export_options[:manifest][:fullSizeImageURL]) if export_options[:manifest][:fullSizeImageURL]
313
+ export_options[:manifest][:assetPackManifestURL] = Addressable::URI.encode(export_options[:manifest][:assetPackManifestURL]) if export_options[:manifest][:assetPackManifestURL]
314
314
  end
315
315
 
316
316
  # Saves options to plist
@@ -23,7 +23,7 @@ module Fastlane
23
23
  def take_off
24
24
  before_import_time = Time.now
25
25
 
26
- if !ENV["FASTLANE_DISABLE_ANIMATION"]
26
+ if ENV["FASTLANE_DISABLE_ANIMATION"].nil?
27
27
  # Usually in the fastlane code base we use
28
28
  #
29
29
  # Helper.show_loading_indicator
@@ -1,5 +1,6 @@
1
1
  require 'commander'
2
2
  require 'fastlane/new_action'
3
+ require 'fastlane_core/ui/help_formatter'
3
4
 
4
5
  HighLine.track_eof = false
5
6
 
@@ -85,7 +86,7 @@ module Fastlane
85
86
  program :help, 'Author', 'Felix Krause <fastlane@krausefx.com>'
86
87
  program :help, 'Website', 'https://fastlane.tools'
87
88
  program :help, 'GitHub', 'https://github.com/fastlane/fastlane'
88
- program :help_formatter, :compact
89
+ program :help_formatter, FastlaneCore::HelpFormatter
89
90
 
90
91
  global_option('--verbose') { FastlaneCore::Globals.verbose = true }
91
92
  global_option('--capture_output', 'Captures the output of the current run, and generates a markdown issue template') do
@@ -284,7 +284,7 @@ module Fastlane
284
284
 
285
285
  action_launched('import_from_git')
286
286
 
287
- is_eligible_for_caching = !version.nil? && !cache_path.nil?
287
+ is_eligible_for_caching = !cache_path.nil?
288
288
 
289
289
  UI.message("Eligible for caching") if is_eligible_for_caching
290
290
 
@@ -338,7 +338,15 @@ module Fastlane
338
338
  UI.user_error!("No tag found matching #{version.inspect}") if checkout_param.nil?
339
339
  end
340
340
 
341
- Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{checkout_path}")
341
+ if is_eligible_for_caching && version.nil?
342
+ # Update the repo if it's eligible for caching but the version isn't specified
343
+ UI.message("Fetching remote git branches and updating git repo...")
344
+ Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
345
+ Actions.sh("cd #{clone_folder.shellescape} && git fetch --all --quiet && git checkout #{checkout_param.shellescape} #{checkout_path} && git reset --hard && git rebase")
346
+ end
347
+ else
348
+ Actions.sh("cd #{clone_folder.shellescape} && git checkout #{checkout_param.shellescape} #{checkout_path}")
349
+ end
342
350
 
343
351
  # Knowing that we check out all the files and directories when the
344
352
  # current call is eligible for caching, we don't need to also
@@ -59,8 +59,14 @@ module Fastlane
59
59
 
60
60
  def find_gem_name(user_supplied_name)
61
61
  fetcher = Gem::SpecFetcher.fetcher
62
- gems = fetcher.suggest_gems_from_name(user_supplied_name)
63
62
 
63
+ # RubyGems 3.2.0 changed behavior of suggest_gems_from_name to no longer return user supplied name (only similar suggestions)
64
+ # First search for exact gem with detect then use suggest_gems_from_name
65
+ if (detected_gem = fetcher.detect(:latest) { |nt| nt.name == user_supplied_name }.first)
66
+ return detected_gem[0].name
67
+ end
68
+
69
+ gems = fetcher.suggest_gems_from_name(user_supplied_name)
64
70
  return gems.first
65
71
  end
66
72
 
@@ -123,7 +123,15 @@ module Fastlane
123
123
  # Can be replaced using the environment variable `GIT_BRANCH`
124
124
  def self.git_branch
125
125
  env_name = SharedValues::GIT_BRANCH_ENV_VARS.find { |env_var| FastlaneCore::Env.truthy?(env_var) }
126
- ENV.fetch(env_name.to_s) { Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp }
126
+ ENV.fetch(env_name.to_s) do
127
+ # Rescues if not a git repo or no commits in a git repo
128
+ begin
129
+ Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp
130
+ rescue => err
131
+ UI.verbose("Error getting git branch: #{err.message}")
132
+ nil
133
+ end
134
+ end
127
135
  end
128
136
 
129
137
  private_class_method
@@ -107,12 +107,13 @@ module Fastlane
107
107
 
108
108
  puts(table)
109
109
 
110
+ fastlane_command = Helper.bundler? ? "bundle exec fastlane" : "fastlane"
110
111
  i = UI.input("Which number would you like run?")
111
112
 
112
113
  i = i.to_i - 1
113
114
  if i >= 0 && available[i]
114
115
  selection = available[i].last.pretty_name
115
- UI.important("Running lane `#{selection}`. Next time you can do this by directly typing `fastlane #{selection}` 🚀.")
116
+ UI.important("Running lane `#{selection}`. Next time you can do this by directly typing `#{fastlane_command} #{selection}` 🚀.")
116
117
  platform = selection.split(' ')[0]
117
118
  lane_name = selection.split(' ')[1]
118
119
 
@@ -123,7 +124,7 @@ module Fastlane
123
124
 
124
125
  return platform, lane_name # yeah
125
126
  else
126
- UI.user_error!("Run `fastlane` the next time you need to build, test or release your app 🚀")
127
+ UI.user_error!("Run `#{fastlane_command}` the next time you need to build, test or release your app 🚀")
127
128
  end
128
129
  end
129
130
  end
@@ -0,0 +1,56 @@
1
+ module Fastlane
2
+ module Notification
3
+ class Slack
4
+ def initialize(webhook_url)
5
+ @webhook_url = webhook_url
6
+ @client = Faraday.new do |conn|
7
+ conn.use(Faraday::Response::RaiseError)
8
+ end
9
+ end
10
+
11
+ # Overriding channel, icon_url and username is only supported in legacy incoming webhook.
12
+ # Also note that the use of attachments has been discouraged by Slack, in favor of Block Kit.
13
+ # https://api.slack.com/legacy/custom-integrations/messaging/webhooks
14
+ def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:)
15
+ @client.post(@webhook_url) do |request|
16
+ request.headers['Content-Type'] = 'application/json'
17
+ request.body = {
18
+ channel: channel,
19
+ username: username,
20
+ icon_url: icon_url,
21
+ attachments: attachments,
22
+ link_names: link_names
23
+ }.to_json
24
+ end
25
+ end
26
+
27
+ # This class was inspired by `LinkFormatter` in `slack-notifier` gem
28
+ # https://github.com/stevenosloan/slack-notifier/blob/4bf6582663dc9e5070afe3fdc42d67c14a513354/lib/slack-notifier/util/link_formatter.rb
29
+ class LinkConverter
30
+ HTML_PATTERN = %r{<a.*?href=['"](?<link>#{URI.regexp})['"].*?>(?<label>.+?)<\/a>}
31
+ MARKDOWN_PATTERN = /\[(?<label>[^\[\]]*?)\]\((?<link>#{URI.regexp}|mailto:#{URI::MailTo::EMAIL_REGEXP})\)/
32
+
33
+ def self.convert(string)
34
+ convert_markdown_to_slack_link(convert_html_to_slack_link(string.scrub))
35
+ end
36
+
37
+ def self.convert_html_to_slack_link(string)
38
+ string.gsub(HTML_PATTERN) do |match|
39
+ slack_link(Regexp.last_match[:link], Regexp.last_match[:label])
40
+ end
41
+ end
42
+
43
+ def self.convert_markdown_to_slack_link(string)
44
+ string.gsub(MARKDOWN_PATTERN) do |match|
45
+ slack_link(Regexp.last_match[:link], Regexp.last_match[:label])
46
+ end
47
+ end
48
+
49
+ def self.slack_link(href, text)
50
+ return "<#{href}>" if text.nil? || text.empty?
51
+ "<#{href}|#{text}>"
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -33,11 +33,11 @@ module Fastlane
33
33
 
34
34
  # Used to expose a local binding for use in ERB templating
35
35
  #
36
- # rubocop:disable Style/AccessorMethodName
36
+ # rubocop:disable Naming/AccessorMethodName
37
37
  def get_binding
38
38
  binding
39
39
  end
40
- # rubocop:enable Style/AccessorMethodName
40
+ # rubocop:enable Naming/AccessorMethodName
41
41
 
42
42
  def ==(other)
43
43
  @plugin_name == other.plugin_name &&
@@ -1,6 +1,4 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require '<%= require_path %>/version'
6
4
 
@@ -18,18 +16,21 @@ Gem::Specification.new do |spec|
18
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
17
  spec.require_paths = ['lib']
20
18
 
19
+ spec.required_ruby_version = '>= 2.5'
20
+
21
21
  # Don't add a dependency to fastlane or fastlane_re
22
22
  # since this would cause a circular dependency
23
23
 
24
24
  # spec.add_dependency 'your-dependency', '~> 1.0.0'
25
25
 
26
- spec.add_development_dependency('pry')
27
26
  spec.add_development_dependency('bundler')
27
+ spec.add_development_dependency('fastlane', '>= <%= Fastlane::VERSION %>')
28
+ spec.add_development_dependency('pry')
29
+ spec.add_development_dependency('rake')
28
30
  spec.add_development_dependency('rspec')
29
31
  spec.add_development_dependency('rspec_junit_formatter')
30
- spec.add_development_dependency('rake')
31
32
  spec.add_development_dependency('rubocop', '<%= Fastlane::RUBOCOP_REQUIREMENT %>')
33
+ spec.add_development_dependency('rubocop-performance')
32
34
  spec.add_development_dependency('rubocop-require_tools')
33
35
  spec.add_development_dependency('simplecov')
34
- spec.add_development_dependency('fastlane', '>= <%= Fastlane::VERSION %>')
35
36
  end
@@ -1,4 +1,23 @@
1
1
  ---
2
+ require:
3
+ - rubocop/require_tools
4
+ - rubocop-performance
5
+ AllCops:
6
+ TargetRubyVersion: 2.5
7
+ NewCops: enable
8
+ Include:
9
+ - "**/*.rb"
10
+ - "**/*file"
11
+ - "**/*.gemspec"
12
+ - "*/lib/assets/*Template"
13
+ - "*/lib/assets/*TemplateAndroid"
14
+ Exclude:
15
+ - "**/lib/assets/custom_action_template.rb"
16
+ - "./vendor/**/*"
17
+ - "**/lib/assets/DefaultFastfileTemplate"
18
+ - "**/lib/assets/MatchfileTemplate"
19
+ - "**/spec/fixtures/broken_files/broken_file.rb"
20
+ - "**/*.provisionprofile"
2
21
  Style/MultipleComparison:
3
22
  Enabled: false
4
23
  Style/PercentLiteralDelimiters:
@@ -19,11 +38,11 @@ Metrics/BlockLength:
19
38
  Enabled: false
20
39
  Metrics/ModuleLength:
21
40
  Enabled: false
22
- Style/VariableNumber:
41
+ Naming/VariableNumber:
23
42
  Enabled: false
24
- Style/MethodMissing:
43
+ Style/MissingRespondToMissing:
25
44
  Enabled: false
26
- MultilineBlockChain:
45
+ Style/MultilineBlockChain:
27
46
  Enabled: false
28
47
  Style/NumericLiteralPrefix:
29
48
  Enabled: false
@@ -31,8 +50,6 @@ Style/TernaryParentheses:
31
50
  Enabled: false
32
51
  Style/EmptyMethod:
33
52
  Enabled: false
34
- Style/BracesAroundHashParameters:
35
- Enabled: false
36
53
  Lint/UselessAssignment:
37
54
  Exclude:
38
55
  - "**/spec/**/*"
@@ -49,9 +66,9 @@ Require/MissingRequireStatement:
49
66
  - "**/Rakefile"
50
67
  - fastlane/**/*
51
68
  - supply/**/*
52
- Layout/IndentHash:
69
+ Layout/FirstHashElementIndentation:
53
70
  Enabled: false
54
- Layout/AlignHash:
71
+ Layout/HashAlignment:
55
72
  Enabled: false
56
73
  Layout/DotPosition:
57
74
  Enabled: false
@@ -59,12 +76,12 @@ Style/DoubleNegation:
59
76
  Enabled: false
60
77
  Style/SymbolArray:
61
78
  Enabled: false
62
- Layout/IndentHeredoc:
79
+ Layout/HeredocIndentation:
63
80
  Enabled: false
64
81
  Style/MixinGrouping:
65
82
  Exclude:
66
83
  - "**/spec/**/*"
67
- Lint/HandleExceptions:
84
+ Lint/SuppressedException:
68
85
  Enabled: false
69
86
  Lint/UnusedBlockArgument:
70
87
  Enabled: false
@@ -95,12 +112,10 @@ Style/AndOr:
95
112
  EnforcedStyle: conditionals
96
113
  Metrics/ClassLength:
97
114
  Max: 320
98
- Metrics/LineLength:
115
+ Layout/LineLength:
99
116
  Max: 370
100
117
  Metrics/ParameterLists:
101
118
  Max: 17
102
- Metrics/PerceivedComplexity:
103
- Max: 18
104
119
  Style/GuardClause:
105
120
  Enabled: false
106
121
  Style/StringLiterals:
@@ -114,25 +129,14 @@ Lint/UnusedMethodArgument:
114
129
  Lint/ParenthesesAsGroupedExpression:
115
130
  Exclude:
116
131
  - "**/spec/**/*"
117
- Style/PredicateName:
132
+ Naming/PredicateName:
118
133
  Enabled: false
119
134
  Style/PerlBackrefs:
120
135
  Enabled: false
121
136
  Layout/SpaceAroundOperators:
122
137
  Exclude:
123
138
  - "**/spec/actions_specs/xcodebuild_spec.rb"
124
- AllCops:
125
- TargetRubyVersion: 2.4
126
- Include:
127
- - "*/lib/assets/*Template"
128
- - "*/lib/assets/*TemplateAndroid"
129
- Exclude:
130
- - "**/lib/assets/custom_action_template.rb"
131
- - "./vendor/**/*"
132
- - "**/lib/assets/DefaultFastfileTemplate"
133
- - "**/lib/assets/MatchfileTemplate"
134
- - "**/spec/fixtures/broken_files/broken_file.rb"
135
- Style/FileName:
139
+ Naming/FileName:
136
140
  Exclude:
137
141
  - "**/Dangerfile"
138
142
  - "**/Brewfile"
@@ -142,6 +146,7 @@ Style/FileName:
142
146
  - "**/Fastfile"
143
147
  - "**/Deliverfile"
144
148
  - "**/Snapfile"
149
+ - "**/Pluginfile"
145
150
  - "**/*.gemspec"
146
151
  Style/Documentation:
147
152
  Enabled: false
@@ -153,16 +158,6 @@ Style/IfInsideElse:
153
158
  Enabled: false
154
159
  Style/CollectionMethods:
155
160
  Enabled: false
156
- CrossPlatform/ForkUsage:
157
- Exclude:
158
- - "**/plugins/template/**/*"
159
- Lint/IsStringUsage:
160
- Include:
161
- - cert/**/*
162
- - gym/**/*
163
- - match/**/*
164
- - screengrab/**/*
165
- - supply/**/*
166
161
  Style/MethodCallWithArgsParentheses:
167
162
  Enabled: true
168
163
  IgnoredMethods:
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
1
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
2
2
 
3
3
  require 'simplecov'
4
4
 
@@ -29,10 +29,10 @@ module Fastlane
29
29
  @sample_return_value = non_empty(string: sample_return_value)
30
30
  @param_type_overrides = key_type_overrides
31
31
 
32
- # rubocop:disable LineLength
32
+ # rubocop:disable Layout/LineLength
33
33
  # class instance?
34
34
  @reserved_words = %w[associativity break case catch class continue convenience default deinit didSet do else enum extension fallthrough false final for func guard if in infix init inout internal lazy let mutating nil operator override precedence private public repeat required return self static struct subscript super switch throws true try var weak where while willSet].to_set
35
- # rubocop:enable LineLength
35
+ # rubocop:enable Layout/LineLength
36
36
  end
37
37
 
38
38
  def sanitize_reserved_word(word: nil)
@@ -97,6 +97,8 @@ module Fastlane
97
97
  return "Bool"
98
98
  elsif type_override == Float
99
99
  return "Float"
100
+ elsif type_override == String
101
+ return "String"
100
102
  elsif type_override == :string_callback
101
103
  # David Hart:
102
104
  # It doesn't make sense to add escaping annotations to optional closures because they aren't function types:
@@ -154,6 +156,7 @@ module Fastlane
154
156
  return "#{type}#{optional_specifier}"
155
157
  end
156
158
 
159
+ # rubocop:disable Metrics/PerceivedComplexity
157
160
  def parameters
158
161
  unless @param_names
159
162
  return ""
@@ -190,7 +193,13 @@ module Fastlane
190
193
  if default_value.nil?
191
194
  "#{param}: #{type}"
192
195
  else
193
- "#{param}: #{type} = #{default_value}"
196
+ if type == "((String) -> Void)?"
197
+ "#{param}: #{type} = nil"
198
+ elsif optional && type.end_with?('?')
199
+ "#{param}: OptionalConfigValue<#{type}> = .fastlaneDefault(#{default_value})"
200
+ else
201
+ "#{param}: #{type} = #{default_value}"
202
+ end
194
203
  end
195
204
  end
196
205
 
@@ -232,7 +241,7 @@ module Fastlane
232
241
  # Adds newlines between each documentation element.
233
242
  documentation = documentation_elements.flat_map { |element| [element, separator] }.tap(&:pop).join("\n")
234
243
 
235
- return "/**\n#{documentation}\n*/\n"
244
+ return "/**\n#{documentation.gsub('/*', '/\\*')}\n*/\n"
236
245
  end
237
246
 
238
247
  def swift_parameter_documentation
@@ -271,12 +280,16 @@ module Fastlane
271
280
  return "[]" # return empty list for argument
272
281
  end
273
282
 
274
- argument_object_strings = @param_names.zip(param_type_overrides).map do |name, type_override|
283
+ argument_object_strings = @param_names.zip(param_type_overrides, param_default_values, param_optionality_values).map do |name, type_override, default_value, is_optional|
275
284
  sanitized_name = camel_case_lower(string: name)
276
285
  sanitized_name = sanitize_reserved_word(word: sanitized_name)
277
- type_string = type_override == :string_callback ? ", type: .stringClosure" : nil
286
+ type_string = type_override == :string_callback ? ".stringClosure" : "nil"
278
287
 
279
- "RubyCommand.Argument(name: \"#{name}\", value: #{sanitized_name}#{type_string})"
288
+ if !(type_override == :string_callback || !(is_optional && default_value.nil?))
289
+ { name: "#{sanitized_name.gsub('`', '')}Arg", arg: "let #{sanitized_name.gsub('`', '')}Arg = #{sanitized_name}.asRubyArgument(name: \"#{name}\", type: #{type_string})" }
290
+ else
291
+ { name: "#{sanitized_name.gsub('`', '')}Arg", arg: "let #{sanitized_name.gsub('`', '')}Arg = RubyCommand.Argument(name: \"#{name}\", value: #{sanitized_name}, type: #{type_string})" }
292
+ end
280
293
  end
281
294
  return argument_object_strings
282
295
  end
@@ -307,13 +320,15 @@ module Fastlane
307
320
 
308
321
  def implementation
309
322
  args = build_argument_list
323
+ implm = "#{args.group_by { |h| h[:arg] }.keys.join("\n")}\n"
324
+ if args.empty?
325
+ implm += "let args: [RubyCommand.Argument] = []\n"
326
+ else
327
+ implm += "let args = [#{args.group_by { |h| h[:name] }.keys.join(",\n")}]\n"
328
+ implm += ".compactMap { $0 }\n"
329
+ end
330
+ implm += "let command = RubyCommand(commandID: \"\", methodName: \"#{@function_name}\", className: nil, args: args)\n"
310
331
 
311
- implm = " let command = RubyCommand(commandID: \"\", methodName: \"#{@function_name}\", className: nil, args: ["
312
- # Get the indent of the first argument in the list to give each
313
- # subsequent argument it's own line with proper indenting
314
- indent = ' ' * implm.length
315
- implm += args.join(",\n#{indent}")
316
- implm += "])\n"
317
332
  return implm + " #{return_statement}"
318
333
  end
319
334
  end
@@ -414,7 +429,13 @@ module Fastlane
414
429
  param = sanitize_reserved_word(word: param)
415
430
  static_var_for_parameter_name = param
416
431
 
417
- "#{param}: #{type} = #{self.class_name.downcase}.#{static_var_for_parameter_name}"
432
+ if type == "((String) -> Void)?"
433
+ "#{param}: #{type} = nil"
434
+ elsif optional && type.end_with?('?')
435
+ "#{param}: OptionalConfigValue<#{type}> = .fastlaneDefault(#{self.class_name.downcase}.#{static_var_for_parameter_name})"
436
+ else
437
+ "#{param}: #{type} = #{self.class_name.downcase}.#{static_var_for_parameter_name}"
438
+ end
418
439
  end
419
440
 
420
441
  return param_names_and_types