Sha256: 61ca95435e6355415c5b00b94e2531083cdadb93452ac7fa107f259c9676e9ef

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

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

      Spaceship.provisioning_profile.all.each do |profile|
        if profile.valid?
          Helper.log.info "Downloading profile '#{profile.name}'...".green
          download_profile(profile)
        else
          Helper.log.info "Skipping invalid/expired profile '#{profile.name}'".yellow
        end
      end
    end

    def download_profile(profile)
      output = Sigh.config[:output_path] || "/tmp"

      profile_name = "#{profile.class.pretty_type}_#{profile.app.bundle_id}.mobileprovision" # default name

      output_path = File.join(output, 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

5 entries across 5 versions & 1 rubygems

Version Path
sigh-1.1.1 lib/sigh/download_all.rb
sigh-1.1.0 lib/sigh/download_all.rb
sigh-1.0.0 lib/sigh/download_all.rb
sigh-0.10.9 lib/sigh/download_all.rb
sigh-0.10.8 lib/sigh/download_all.rb