Sha256: 0587cfcc0b465e824d0e3cd2c572a7b77e02a1f599e3f7144772d2037f3c1523

Contents?: true

Size: 1.58 KB

Versions: 194

Compression:

Stored size: 1.58 KB

Contents

require 'spaceship'

require_relative 'manager'
require_relative 'module'

module Sigh
  class DownloadAll
    # Download all valid provisioning profiles
    def download_all(download_xcode_profiles: false)
      UI.message("Starting login with user '#{Sigh.config[:username]}'")
      Spaceship.login(Sigh.config[:username], nil)
      Spaceship.select_team
      UI.message("Successfully logged in")

      Spaceship.provisioning_profile.all(xcode: download_xcode_profiles).each do |profile|
        if profile.valid?
          UI.message("Downloading profile '#{profile.name}'...")
          download_profile(profile)
        else
          UI.important("Skipping invalid/expired profile '#{profile.name}'")
        end
      end

      if download_xcode_profiles
        UI.message("This run also included all Xcode managed provisioning profiles, as you used the `--download_xcode_profiles` flag")
      else
        UI.message("All Xcode managed provisioning profiles were ignored on this, to include them use the `--download_xcode_profiles` flag")
      end
    end

    def download_profile(profile)
      FileUtils.mkdir_p(Sigh.config[:output_path])

      type_name = profile.class.pretty_type
      type_name = "AdHoc" if profile.is_adhoc?

      profile_name = "#{type_name}_#{profile.uuid}_#{profile.app.bundle_id}.mobileprovision" # default name

      output_path = File.join(Sigh.config[:output_path], profile_name)
      File.open(output_path, "wb") do |f|
        f.write(profile.download)
      end

      Manager.install_profile(output_path) unless Sigh.config[:skip_install]
    end
  end
end

Version data entries

194 entries across 194 versions & 1 rubygems

Version Path
fastlane-2.112.0.beta.20181218200038 sigh/lib/sigh/download_all.rb
fastlane-2.112.0.beta.20181217200025 sigh/lib/sigh/download_all.rb
fastlane-2.112.0.beta.20181216200018 sigh/lib/sigh/download_all.rb
fastlane-2.112.0.beta.20181215200110 sigh/lib/sigh/download_all.rb
fastlane-2.112.0.beta.20181214200045 sigh/lib/sigh/download_all.rb
fastlane-2.111.0 sigh/lib/sigh/download_all.rb
fastlane-2.111.0.beta.20181213200033 sigh/lib/sigh/download_all.rb
fastlane-2.111.0.beta.20181213171204 sigh/lib/sigh/download_all.rb
fastlane-2.111.0.beta.20181211193527 sigh/lib/sigh/download_all.rb
fastlane-2.111.0.beta.20181211193027 sigh/lib/sigh/download_all.rb
fastlane-2.110.0 sigh/lib/sigh/download_all.rb
fastlane-2.109.1 sigh/lib/sigh/download_all.rb
fastlane-2.109.0 sigh/lib/sigh/download_all.rb
fastlane-2.108.0 sigh/lib/sigh/download_all.rb
fastlane-2.107.0 sigh/lib/sigh/download_all.rb
fastlane-2.106.2 sigh/lib/sigh/download_all.rb
fastlane-2.106.1 sigh/lib/sigh/download_all.rb
fastlane-2.106.0 sigh/lib/sigh/download_all.rb
fastlane-2.105.2 sigh/lib/sigh/download_all.rb
fastlane-2.105.1 sigh/lib/sigh/download_all.rb