Sha256: 4de85a17b8df26a239844d668bce332cb37ef8cdb75f38571936d76e477107b1

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

module Sigh
  class DownloadAll
    # Download all valid provisioning profiles
    def download_all
      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.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
    end

    def download_profile(profile)
      FileUtils.mkdir_p(Sigh.config[:output_path])
      profile_name = "#{profile.class.pretty_type}_#{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

15 entries across 15 versions & 1 rubygems

Version Path
sigh-1.11.0 lib/sigh/download_all.rb
sigh-1.10.4 lib/sigh/download_all.rb
sigh-1.10.3 lib/sigh/download_all.rb
sigh-1.10.2 lib/sigh/download_all.rb
sigh-1.10.1 lib/sigh/download_all.rb
sigh-1.10.0 lib/sigh/download_all.rb
sigh-1.9.0 lib/sigh/download_all.rb
sigh-1.8.0 lib/sigh/download_all.rb
sigh-1.7.0 lib/sigh/download_all.rb
sigh-1.6.1 lib/sigh/download_all.rb
sigh-1.6.0 lib/sigh/download_all.rb
sigh-1.5.0 lib/sigh/download_all.rb
sigh-1.4.1 lib/sigh/download_all.rb
sigh-1.4.0 lib/sigh/download_all.rb
sigh-1.3.1 lib/sigh/download_all.rb