Sha256: a94a4c8ee6caf5d44de257e73791f2bcf02bbf8d2e34a197255fc41ad6a00156

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 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)
      dataWritten = 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

1 entries across 1 versions & 1 rubygems

Version Path
sigh-0.10.7 lib/sigh/download_all.rb