Sha256: 66063c3504cf34ecb25261bfbf169dbd3041c86b51c10b5ee9931f20b4a6014b

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

module Sigh
  class DownloadAll
    # Download all valid provisioning profiles
    def download_all
      Helper.log.info "Starting login"
      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

9 entries across 9 versions & 1 rubygems

Version Path
sigh-0.10.6 lib/sigh/download_all.rb
sigh-0.10.5 lib/sigh/download_all.rb
sigh-0.10.4 lib/sigh/download_all.rb
sigh-0.10.3 lib/sigh/download_all.rb
sigh-0.10.2 lib/sigh/download_all.rb
sigh-0.10.1 lib/sigh/download_all.rb
sigh-0.10.0 lib/sigh/download_all.rb
sigh-0.9.0 lib/sigh/download_all.rb
sigh-0.8.0 lib/sigh/download_all.rb