Sha256: 99703bbb1a41b3bde90d4bed50efcd85d307ab42312a0926fe5d1642bb0697a1

Contents?: true

Size: 1.05 KB

Versions: 7

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)
      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

7 entries across 7 versions & 1 rubygems

Version Path
sigh-1.3.0 lib/sigh/download_all.rb
sigh-1.2.2 lib/sigh/download_all.rb
sigh-1.2.1 lib/sigh/download_all.rb
sigh-1.2.0 lib/sigh/download_all.rb
sigh-1.1.4 lib/sigh/download_all.rb
sigh-1.1.3 lib/sigh/download_all.rb
sigh-1.1.2 lib/sigh/download_all.rb