class Fastlane::Helper::TransporterHelper
Public Class Methods
command_exist?(cmd)
click to toggle source
Check if shell command exists.
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 16 def self.command_exist?(cmd) `which #{cmd} 2>/dev/null`.chomp != "" end
extract_tarball(tarball, destination)
click to toggle source
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 59 def self.extract_tarball(tarball, destination) warning_args = "--warning=no-unknown-keyword" unless FastlaneCore::Helper.is_mac? system("tar #{warning_args} -xzf #{tarball} -C #{destination} --strip-components=1") end
fetch_file(path)
click to toggle source
Fetch file from URI or return path if it's local.
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 31 def self.fetch_file(path) return path if path.nil? || !uri?(path) UI.message("Downloading #{path}...") target_path = Tempfile.new(File.basename(path)).path cmd = "curl --progress-bar -L #{path.shellescape} -o #{target_path.shellescape}" result = system(cmd) # Won't get progress showing if using Action.sh here. UI.user_error!("Failed to fetch file: #{path}") unless result File.expand_path(target_path) end
find_root_ca(name)
click to toggle source
Find Root CA certificate with given name or path.
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 44 def self.find_root_ca(name) expanded_name = File.expand_path(name) return expanded_name if File.exist?(expanded_name) root_ca_file = Tempfile.new("root_ca.pem").path if FastlaneCore::Helper.is_mac? result = system("security find-certificate -c #{name.shellescape} -p >#{root_ca_file}") UI.user_error!("Could not find certificate: #{name}") unless result else UI.user_error!("Certificate lookup is not supported on OS other than Mac yet") end root_ca_file end
show_message()
click to toggle source
class methods that you define here become available in your action as `Helper::TransporterHelper.your_method`
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 11 def self.show_message UI.message("Hello from the transporter plugin helper!") end
uri?(string)
click to toggle source
Check if string is a correct URI.
# File lib/fastlane/plugin/transporter/helper/transporter_helper.rb, line 21 def self.uri?(string) uri = URI.parse(string) %w[http https file].include?(uri.scheme) rescue URI::BadURIError false rescue URI::InvalidURIError false end