lib/sigh/runner.rb in sigh-1.3.0 vs lib/sigh/runner.rb in sigh-1.3.1
- old
+ new
@@ -9,39 +9,39 @@
def run
FastlaneCore::PrintTable.print_values(config: Sigh.config,
hide_keys: [:output_path],
title: "Summary for sigh #{Sigh::VERSION}")
- Helper.log.info "Starting login with user '#{Sigh.config[:username]}'"
+ UI.message "Starting login with user '#{Sigh.config[:username]}'"
Spaceship.login(Sigh.config[:username], nil)
Spaceship.select_team
- Helper.log.info "Successfully logged in"
+ UI.message "Successfully logged in"
profiles = [] if Sigh.config[:skip_fetch_profiles]
profiles ||= fetch_profiles # download the profile if it's there
if profiles.count > 0
- Helper.log.info "Found #{profiles.count} matching profile(s)".yellow
+ UI.success "Found #{profiles.count} matching profile(s)"
profile = profiles.first
if Sigh.config[:force]
if profile_type == Spaceship.provisioning_profile::AppStore or profile_type == Spaceship.provisioning_profile::InHouse
- Helper.log.info "Updating the provisioning profile".yellow
+ UI.important "Updating the provisioning profile"
else
- Helper.log.info "Updating the profile to include all devices".yellow
+ UI.important "Updating the profile to include all devices"
profile.devices = Spaceship.device.all_for_profile_type(profile.type)
end
profile = profile.update! # assign it, as it's a new profile
end
else
- Helper.log.info "No existing profiles found, that match the certificates you have installed, creating a new one for you".yellow
+ UI.important "No existing profiles found, that match the certificates you have installed, creating a new one for you"
ensure_app_exists!
profile = create_profile!
end
- raise "Something went wrong fetching the latest profile".red unless profile
+ UI.user_error!("Something went wrong fetching the latest profile") unless profile
if profile_type == Spaceship.provisioning_profile.in_house
ENV["SIGH_PROFILE_ENTERPRISE"] = "1"
else
ENV.delete("SIGH_PROFILE_ENTERPRISE")
@@ -62,11 +62,11 @@
@profile_type
end
# Fetches a profile matching the user's search requirements
def fetch_profiles
- Helper.log.info "Fetching profiles..."
+ UI.message "Fetching profiles..."
results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier]).find_all(&:valid?)
# Take the provisioning profile name into account
if Sigh.config[:provisioning_name].to_s.length > 0
filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }
@@ -98,16 +98,16 @@
bundle_id = Sigh.config[:app_identifier]
name = Sigh.config[:provisioning_name] || [bundle_id, profile_type.pretty_type].join(' ')
unless Sigh.config[:skip_fetch_profiles]
if Spaceship.provisioning_profile.all.find { |p| p.name == name }
- Helper.log.error "The name '#{name}' is already taken, using another one."
+ UI.error "The name '#{name}' is already taken, using another one."
name += " #{Time.now.to_i}"
end
end
- Helper.log.info "Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'".yellow
+ UI.important "Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'"
profile = profile_type.create!(name: name,
bundle_id: bundle_id,
certificate: cert)
profile
end
@@ -135,64 +135,64 @@
true
end
if certificates.count > 1 and !Sigh.config[:development]
- Helper.log.info "Found more than one code signing identity. Choosing the first one. Check out `sigh --help` to see all available options.".yellow
- Helper.log.info "Available Code Signing Identities for current filters:".green
+ UI.important "Found more than one code signing identity. Choosing the first one. Check out `sigh --help` to see all available options."
+ UI.important "Available Code Signing Identities for current filters:"
certificates.each do |c|
str = ["\t- Name:", c.owner_name, "- ID:", c.id + "- Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
- Helper.log.info str.green
+ UI.message str.green
end
end
if certificates.count == 0
filters = ""
filters << "Owner Name: '#{Sigh.config[:cert_owner_name]}' " if Sigh.config[:cert_owner_name]
filters << "Certificate ID: '#{Sigh.config[:cert_id]}' " if Sigh.config[:cert_id]
- Helper.log.info "No certificates for filter: #{filters}".yellow if filters.length > 0
- raise "Could not find a matching code signing identity for #{profile_type}. You can use cert to generate one (https://github.com/fastlane/cert)".red
+ UI.important "No certificates for filter: #{filters}" if filters.length > 0
+ UI.user_error!("Could not find a matching code signing identity for #{profile_type}. You can use cert to generate one (https://github.com/fastlane/cert)")
end
return certificates if Sigh.config[:development] # development profiles support multiple certificates
return certificates.first
end
# rubocop:enable Metrics/AbcSize
# Downloads and stores the provisioning profile
def download_profile(profile)
- Helper.log.info "Downloading provisioning profile...".yellow
+ UI.important "Downloading provisioning profile..."
profile_name ||= "#{profile.class.pretty_type}_#{Sigh.config[:app_identifier]}.mobileprovision" # default name
profile_name += '.mobileprovision' unless profile_name.include? 'mobileprovision'
tmp_path = Dir.mktmpdir("profile_download")
output_path = File.join(tmp_path, profile_name)
File.open(output_path, "wb") do |f|
f.write(profile.download)
end
- Helper.log.info "Successfully downloaded provisioning profile...".green
+ UI.success "Successfully downloaded provisioning profile..."
return output_path
end
# Makes sure the current App ID exists. If not, it will show an appropriate error message
def ensure_app_exists!
return if Spaceship::App.find(Sigh.config[:app_identifier])
print_produce_command(Sigh.config)
- raise "Could not find App with App Identifier '#{Sigh.config[:app_identifier]}'"
+ UI.user_error!("Could not find App with App Identifier '#{Sigh.config[:app_identifier]}'")
end
def print_produce_command(config)
- Helper.log.info ""
- Helper.log.info "==========================================".yellow
- Helper.log.info "Could not find App ID with bundle identifier '#{config[:app_identifier]}'"
- Helper.log.info "You can easily generate a new App ID on the Developer Portal using 'produce':"
- Helper.log.info ""
- Helper.log.info "produce -u #{config[:username]} -a #{config[:app_identifier]} --skip_itc".yellow
- Helper.log.info ""
- Helper.log.info "You will be asked for any missing information, like the full name of your app"
- Helper.log.info "If the app should also be created on iTunes Connect, remove the " + "--skip_itc".yellow + " from the command above"
- Helper.log.info "==========================================".yellow
- Helper.log.info ""
+ UI.message ""
+ UI.message "==========================================".yellow
+ UI.message "Could not find App ID with bundle identifier '#{config[:app_identifier]}'"
+ UI.message "You can easily generate a new App ID on the Developer Portal using 'produce':"
+ UI.message ""
+ UI.message "produce -u #{config[:username]} -a #{config[:app_identifier]} --skip_itc".yellow
+ UI.message ""
+ UI.message "You will be asked for any missing information, like the full name of your app"
+ UI.message "If the app should also be created on iTunes Connect, remove the " + "--skip_itc".yellow + " from the command above"
+ UI.message "==========================================".yellow
+ UI.message ""
end
end
end