fastlane 2.179.0 → 2.183.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -82
  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/app_store_connect_api_key.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/backup_xcarchive.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/clipboard.rb +3 -6
  14. data/fastlane/lib/fastlane/actions/danger.rb +7 -1
  15. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  16. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +18 -1
  17. data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +2 -6
  18. data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +3 -1
  19. data/fastlane/lib/fastlane/actions/git_branch.rb +1 -1
  20. data/fastlane/lib/fastlane/actions/git_commit.rb +3 -1
  21. data/fastlane/lib/fastlane/actions/git_pull.rb +4 -10
  22. data/fastlane/lib/fastlane/actions/git_submodule_update.rb +16 -8
  23. data/fastlane/lib/fastlane/actions/hipchat.rb +2 -1
  24. data/fastlane/lib/fastlane/actions/import_from_git.rb +5 -5
  25. data/fastlane/lib/fastlane/actions/jira.rb +61 -14
  26. data/fastlane/lib/fastlane/actions/notarize.rb +98 -51
  27. data/fastlane/lib/fastlane/actions/notification.rb +1 -1
  28. data/fastlane/lib/fastlane/actions/slack.rb +155 -133
  29. data/fastlane/lib/fastlane/actions/sourcedocs.rb +164 -0
  30. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -2
  31. data/fastlane/lib/fastlane/actions/xcodebuild.rb +5 -5
  32. data/fastlane/lib/fastlane/cli_tools_distributor.rb +1 -1
  33. data/fastlane/lib/fastlane/commands_generator.rb +2 -1
  34. data/fastlane/lib/fastlane/fast_file.rb +10 -2
  35. data/fastlane/lib/fastlane/fastlane_require.rb +7 -1
  36. data/fastlane/lib/fastlane/helper/git_helper.rb +9 -1
  37. data/fastlane/lib/fastlane/lane_manager.rb +3 -2
  38. data/fastlane/lib/fastlane/notification/slack.rb +56 -0
  39. data/fastlane/lib/fastlane/plugins/plugin_info.rb +2 -2
  40. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +7 -6
  41. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +30 -35
  42. data/fastlane/lib/fastlane/plugins/template/spec/spec_helper.rb.erb +1 -1
  43. data/fastlane/lib/fastlane/setup/setup.rb +23 -10
  44. data/fastlane/lib/fastlane/swift_fastlane_function.rb +35 -14
  45. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +2 -0
  46. data/fastlane/lib/fastlane/version.rb +2 -2
  47. data/fastlane/swift/Deliverfile.swift +1 -1
  48. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  49. data/fastlane/swift/Fastlane.swift +6672 -3787
  50. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +4 -0
  51. data/fastlane/swift/Gymfile.swift +1 -1
  52. data/fastlane/swift/GymfileProtocol.swift +1 -1
  53. data/fastlane/swift/LaneFileProtocol.swift +9 -3
  54. data/fastlane/swift/Matchfile.swift +1 -1
  55. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  56. data/fastlane/swift/OptionalConfigValue.swift +131 -0
  57. data/fastlane/swift/Precheckfile.swift +1 -1
  58. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  59. data/fastlane/swift/RubyCommand.swift +1 -1
  60. data/fastlane/swift/Scanfile.swift +1 -1
  61. data/fastlane/swift/ScanfileProtocol.swift +5 -1
  62. data/fastlane/swift/Screengrabfile.swift +1 -1
  63. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  64. data/fastlane/swift/Snapshotfile.swift +1 -1
  65. data/fastlane/swift/SnapshotfileProtocol.swift +5 -1
  66. data/fastlane/swift/SocketClient.swift +2 -1
  67. data/fastlane/swift/SocketResponse.swift +4 -2
  68. data/fastlane/swift/formatting/Brewfile.lock.json +18 -16
  69. data/fastlane/swift/upgrade_manifest.json +1 -1
  70. data/fastlane_core/lib/fastlane_core.rb +22 -21
  71. data/fastlane_core/lib/fastlane_core/build_watcher.rb +65 -11
  72. data/fastlane_core/lib/fastlane_core/clipboard.rb +20 -0
  73. data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
  74. data/fastlane_core/lib/fastlane_core/helper.rb +4 -4
  75. data/fastlane_core/lib/fastlane_core/languages.rb +2 -2
  76. data/fastlane_core/lib/fastlane_core/queue_worker.rb +2 -2
  77. data/fastlane_core/lib/fastlane_core/swag.rb +1 -1
  78. data/fastlane_core/lib/fastlane_core/ui/help.erb +35 -0
  79. data/fastlane_core/lib/fastlane_core/ui/help_formatter.rb +16 -0
  80. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +16 -2
  81. data/frameit/lib/frameit/commands_generator.rb +2 -1
  82. data/frameit/lib/frameit/config_parser.rb +2 -2
  83. data/frameit/lib/frameit/frame_downloader.rb +2 -1
  84. data/gym/lib/gym/code_signing_mapping.rb +2 -2
  85. data/gym/lib/gym/commands_generator.rb +2 -1
  86. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +6 -5
  87. data/gym/lib/gym/runner.rb +5 -1
  88. data/match/lib/match/change_password.rb +1 -1
  89. data/match/lib/match/commands_generator.rb +2 -1
  90. data/pem/lib/pem/commands_generator.rb +2 -1
  91. data/pilot/lib/pilot/build_manager.rb +3 -3
  92. data/pilot/lib/pilot/commands_generator.rb +2 -1
  93. data/pilot/lib/pilot/options.rb +2 -2
  94. data/pilot/lib/pilot/tester_exporter.rb +0 -1
  95. data/pilot/lib/pilot/tester_manager.rb +0 -1
  96. data/precheck/lib/precheck/commands_generator.rb +2 -1
  97. data/produce/lib/produce/commands_generator.rb +2 -1
  98. data/scan/lib/scan/commands_generator.rb +2 -1
  99. data/scan/lib/scan/options.rb +10 -5
  100. data/scan/lib/scan/runner.rb +54 -1
  101. data/scan/lib/scan/test_command_generator.rb +10 -8
  102. data/screengrab/lib/screengrab/commands_generator.rb +2 -1
  103. data/sigh/lib/sigh/commands_generator.rb +2 -1
  104. data/snapshot/lib/assets/SnapfileTemplate +1 -1
  105. data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
  106. data/snapshot/lib/snapshot/commands_generator.rb +3 -1
  107. data/snapshot/lib/snapshot/options.rb +5 -0
  108. data/snapshot/lib/snapshot/reports_generator.rb +4 -0
  109. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  110. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +1 -1
  111. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +8 -4
  112. data/spaceship/README.md +2 -12
  113. data/spaceship/lib/spaceship/base.rb +2 -2
  114. data/spaceship/lib/spaceship/commands_generator.rb +4 -2
  115. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  116. data/{gym/lib/gym/.runner.rb.swp → spaceship/lib/spaceship/connect_api/models/.app.rb.swp} +0 -0
  117. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +1 -1
  118. data/spaceship/lib/spaceship/connect_api/models/profile.rb +6 -0
  119. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +6 -2
  120. data/spaceship/lib/spaceship/connect_api/token.rb +7 -1
  121. data/spaceship/lib/spaceship/spaceauth_runner.rb +19 -9
  122. data/spaceship/lib/spaceship/tunes/members.rb +1 -1
  123. data/spaceship/lib/spaceship/ui.rb +2 -2
  124. data/supply/lib/supply/client.rb +3 -1
  125. data/supply/lib/supply/commands_generator.rb +2 -1
  126. data/supply/lib/supply/options.rb +2 -2
  127. data/supply/lib/supply/uploader.rb +1 -0
  128. metadata +75 -86
  129. 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
 
@@ -35,6 +35,10 @@ module Fastlane
35
35
  # rubocop:disable Metrics/BlockNesting
36
36
  def self.start(user: nil, is_swift_fastfile: false)
37
37
  if FastlaneCore::FastlaneFolder.setup? && !Helper.test?
38
+
39
+ # If Fastfile.swift exists, but the swift sources folder does not, rebuild it
40
+ setup_swift_support if is_swift_fastfile
41
+
38
42
  require 'fastlane/lane_list'
39
43
  Fastlane::LaneList.output(FastlaneCore::FastlaneFolder.fastfile_path)
40
44
  UI.important("------------------")
@@ -127,6 +131,24 @@ module Fastlane
127
131
  end
128
132
  # rubocop:enable Metrics/BlockNesting
129
133
 
134
+ def self.setup_swift_support
135
+ runner_source_resources = "#{Fastlane::ROOT}/swift/."
136
+ destination_path = File.expand_path('swift', FastlaneCore::FastlaneFolder.path)
137
+
138
+ # Return eearly if already setup
139
+ return if File.exist?(destination_path)
140
+
141
+ # Show message if Fastfile.swift exists but missing Swift classes and Xcode project
142
+ if FastlaneCore::FastlaneFolder.swift?
143
+ UI.important("Restoring Swift classes and FastlaneSwiftRunner.xcodeproj...")
144
+ end
145
+
146
+ FileUtils.cp_r(runner_source_resources, destination_path)
147
+ UI.success("Copied Swift fastlane runner project to '#{destination_path}'.")
148
+
149
+ Fastlane::SwiftLaneManager.first_time_setup
150
+ end
151
+
130
152
  def initialize(is_swift_fastfile: nil, user: nil, project_path: nil, had_multiple_projects_to_choose_from: nil, preferred_setup_method: nil)
131
153
  self.is_swift_fastfile = is_swift_fastfile
132
154
  self.user = user
@@ -260,21 +282,12 @@ module Fastlane
260
282
 
261
283
  def finish_up
262
284
  write_fastfile!
263
- setup_swift_support if is_swift_fastfile
285
+ self.class.setup_swift_support if is_swift_fastfile
264
286
  show_analytics_note
265
287
  explain_concepts
266
288
  suggest_next_steps
267
289
  end
268
290
 
269
- def setup_swift_support
270
- runner_source_resources = "#{Fastlane::ROOT}/swift/."
271
- destination_path = File.expand_path('swift', FastlaneCore::FastlaneFolder.path)
272
- FileUtils.cp_r(runner_source_resources, destination_path)
273
- UI.success("Copied Swift fastlane runner project to '#{destination_path}'.")
274
-
275
- Fastlane::SwiftLaneManager.first_time_setup
276
- end
277
-
278
291
  def fastfile_template_content
279
292
  if self.is_swift_fastfile
280
293
  path = "#{Fastlane::ROOT}/lib/assets/DefaultFastfileTemplate.swift"