Class: Sigh::DownloadAll
- Inherits:
-
Object
- Object
- Sigh::DownloadAll
- Defined in:
- sigh/lib/sigh/download_all.rb
Instance Method Summary collapse
-
#download_all(download_xcode_profiles: false) ⇒ Object
Download all valid provisioning profiles.
- #download_profile(profile) ⇒ Object
- #download_profiles(profiles) ⇒ Object
- #xcode_profiles_downloaded?(xcode: false, supported: false) ⇒ Boolean
Instance Method Details
#download_all(download_xcode_profiles: false) ⇒ Object
Download all valid provisioning profiles
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'sigh/lib/sigh/download_all.rb', line 9 def download_all(download_xcode_profiles: false) UI.("Starting login with user '#{Sigh.config[:username]}'") Spaceship.login(Sigh.config[:username], nil) Spaceship.select_team UI.("Successfully logged in") case Sigh.config[:platform].to_s when 'ios' download_profiles(Spaceship.provisioning_profile.all(xcode: download_xcode_profiles)) xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: true) when 'macos' download_profiles(Spaceship.provisioning_profile.all(mac: true, xcode: download_xcode_profiles)) xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: true) when 'tvos' download_profiles(Spaceship.provisioning_profile.all_tvos) xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: false) end end |
#download_profile(profile) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'sigh/lib/sigh/download_all.rb', line 61 def download_profile(profile) FileUtils.mkdir_p(Sigh.config[:output_path]) type_name = profile.class.pretty_type profile_name = "#{type_name}_#{profile.uuid}_#{profile.app.bundle_id}" if Sigh.config[:platform].to_s == 'tvos' profile_name += "_tvos" end if Sigh.config[:platform].to_s == 'macos' profile_name += '.provisionprofile' else profile_name += '.mobileprovision' end 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 |
#download_profiles(profiles) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'sigh/lib/sigh/download_all.rb', line 47 def download_profiles(profiles) UI.important("No profiles available for download") if profiles.empty? profiles.each do |profile| if profile.valid? UI.("Downloading profile '#{profile.name}'...") download_profile(profile) else UI.important("Skipping invalid/expired profile '#{profile.name}'") end end end |
#xcode_profiles_downloaded?(xcode: false, supported: false) ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'sigh/lib/sigh/download_all.rb', line 30 def xcode_profiles_downloaded?(xcode: false, supported: false) if supported if xcode UI.("This run also included all Xcode managed provisioning profiles, as you used the `--download_xcode_profiles` flag") elsif !xcode UI.("All Xcode managed provisioning profiles were ignored on this, to include them use the `--download_xcode_profiles` flag") end elsif !supported if xcode UI.important("Downloading Xcode managed profiles is not supported for platform #{Sigh.config[:platform]}") return end end end |