fastlane/lib/fastlane/actions/update_fastlane.rb in fastlane_hotfix-2.165.1 vs fastlane/lib/fastlane/actions/update_fastlane.rb in fastlane_hotfix-2.187.0
- old
+ new
@@ -43,36 +43,57 @@
UI.success("Nothing to update ✅")
return
end
# suppress updater output - very noisy
- Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new unless FastlaneCore::Globals.verbose?
update_needed.each do |tool_info|
- tool = tool_info[0]
+ tool = self.get_gem_name(tool_info)
local_version = Gem::Version.new(highest_versions[tool].version)
latest_official_version = FastlaneCore::UpdateChecker.fetch_latest(tool)
UI.message("Updating #{tool} from #{local_version.to_s.yellow} to #{latest_official_version.to_s.yellow}... 🚀")
- # Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
- requirement_version = local_version.approximate_recommendation
- updater.update_gem(tool, Gem::Requirement.new(requirement_version))
+ if Helper.homebrew?
+ Helper.backticks('brew upgrade fastlane')
+ else
+ # Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
+ requirement_version = local_version.approximate_recommendation
+ updater.update_gem(tool, Gem::Requirement.new(requirement_version))
+ end
UI.success("Finished updating #{tool}")
end
- UI.message("Cleaning up old versions...")
- cleaner.options[:args] = tools_to_update
- cleaner.execute
+ unless Helper.homebrew?
+ UI.message("Cleaning up old versions...")
+ cleaner.options[:args] = tools_to_update
+ cleaner.execute
+ end
+ if FastlaneCore::FastlaneFolder.swift?
+ upgrader = SwiftRunnerUpgrader.new
+ upgrader.upgrade_if_needed!
+ end
+
UI.message("fastlane.tools successfully updated! I will now restart myself... 😴")
# Set no_update to true so we don't try to update again
exec("FL_NO_UPDATE=true #{$PROGRAM_NAME} #{ARGV.join(' ')}")
end
+ def self.get_gem_name(tool_info)
+ if tool_info.kind_of?(Array)
+ return tool_info[0]
+ elsif tool_info.respond_to?(:name) # Gem::NameTuple in RubyGems >= 3.1.0
+ return tool_info.name
+ else
+ UI.crash!("Unknown gem update information returned from RubyGems. Please file a new issue for this... 🤷")
+ end
+ end
+
def self.description
"Makes sure fastlane-tools are up-to-date when running fastlane"
end
def self.details
@@ -99,15 +120,15 @@
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :no_update,
env_name: "FL_NO_UPDATE",
description: "Don't update during this run. This is used internally",
- is_string: false,
+ type: Boolean,
default_value: false),
FastlaneCore::ConfigItem.new(key: :nightly,
env_name: "FL_UPDATE_FASTLANE_NIGHTLY",
description: "Opt-in to install and use nightly fastlane builds",
- is_string: false,
+ type: Boolean,
default_value: false,
deprecated: "Nightly builds are no longer being made available")
]
end