Sha256: 346bf82ab2e4eaa639be07f5705f18ed7b5663f0a83c519660ce69b2532fe6c5

Contents?: true

Size: 1.53 KB

Versions: 275

Compression:

Stored size: 1.53 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
      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

275 entries across 275 versions & 2 rubygems

Version Path
fastlane-2.130.0.beta.20190825200030 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190824200021 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190823200017 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190822200101 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190821200034 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190820200024 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190819200109 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190818200034 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190817200018 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190816200015 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190815200057 sigh/lib/sigh/download_all.rb
fastlane-2.130.0.beta.20190814200010 sigh/lib/sigh/download_all.rb
fastlane-2.129.0 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190813200016 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190811200106 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190810200059 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190809200051 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190808200013 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190807200122 sigh/lib/sigh/download_all.rb
fastlane-2.129.0.beta.20190806200055 sigh/lib/sigh/download_all.rb