lib/sigh/runner.rb in sigh-0.10.7 vs lib/sigh/runner.rb in sigh-0.10.8
- old
+ new
@@ -34,10 +34,16 @@
profile = create_profile!
end
raise "Something went wrong fetching the latest profile".red unless profile
+ if profile_type == Spaceship.provisioning_profile.in_house
+ ENV["SIGH_PROFILE_ENTERPRISE"] = "1"
+ else
+ ENV.delete("SIGH_PROFILE_ENTERPRISE")
+ end
+
return download_profile(profile)
end
# The kind of provisioning profile we're interested in
def profile_type
@@ -52,21 +58,20 @@
end
# Fetches a profile matching the user's search requirements
def fetch_profiles
Helper.log.info "Fetching profiles..."
- results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier]).find_all { |a| a.valid? }
+ 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 }
results = filtered if (filtered || []).count > 0
end
return results if Sigh.config[:skip_certificate_verification]
-
return results.find_all do |a|
# Also make sure we have the certificate installed on the local machine
installed = false
a.certificates.each do |cert|
file = Tempfile.new('cert')
@@ -96,12 +101,12 @@
bundle_id: bundle_id,
certificate: cert)
profile
end
-
# Certificate to use based on the current distribution mode
+ # rubocop:disable Metrics/AbcSize
def certificate_to_use
if profile_type == Spaceship.provisioning_profile.Development
certificates = Spaceship.certificate.development.all
elsif profile_type == Spaceship.provisioning_profile.InHouse
certificates = Spaceship.certificate.in_house.all
@@ -120,15 +125,16 @@
end
true
end
- if certificates.count > 1 and not Sigh.config[:development]
+ 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
certificates.each do |c|
- Helper.log.info ("\t- Name: " + c.owner_name + " - ID: " + c.id + " - Expires: " + c.expires.strftime("%d/%m/%Y")).green
+ str = ["\t- Name:", c.owner_name, "- ID:", c.id + "- Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
+ Helper.log.info str.green
end
end
if certificates.count == 0
filters = ""
@@ -139,18 +145,19 @@
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
profile_name ||= "#{profile.class.pretty_type}_#{Sigh.config[:app_identifier]}.mobileprovision" # default name
- profile_name += '.mobileprovision' unless profile_name.include?'mobileprovision'
+ profile_name += '.mobileprovision' unless profile_name.include? 'mobileprovision'
output_path = File.join('/tmp', profile_name)
- dataWritten = File.open(output_path, "wb") do |f|
+ File.open(output_path, "wb") do |f|
f.write(profile.download)
end
Helper.log.info "Successfully downloaded provisioning profile...".green
return output_path