Class: Canalizador::IosUtils
- Inherits:
-
Object
- Object
- Canalizador::IosUtils
- Defined in:
- lib/canalizador/ios_utils.rb
Class Method Summary collapse
- .fetch_certificates_and_profiles(app_bundle_ids) ⇒ Object
- .upload_certificates_and_profiles(type) ⇒ Object
Class Method Details
.fetch_certificates_and_profiles(app_bundle_ids) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/canalizador/ios_utils.rb', line 70 def self.fetch_certificates_and_profiles(app_bundle_ids) Canalizador::Utils.validate_environment_variables( 'IOS_PROFILES_AND_CERTIFICATES_REPO_URL', 'MATCH_PASSWORD' ) git_url = ENV['IOS_PROFILES_AND_CERTIFICATES_REPO_URL'] Match::Runner.new.run( storage_mode: 'git', git_url: git_url, git_branch: 'master', app_identifier: app_bundle_ids, type: 'development', readonly: true, keychain_name: 'login.keychain' ) Match::Runner.new.run( storage_mode: 'git', git_url: git_url, git_branch: 'master', app_identifier: app_bundle_ids, type: 'adhoc', readonly: true, keychain_name: 'login.keychain' ) Match::Runner.new.run( storage_mode: 'git', git_url: git_url, git_branch: 'master', app_identifier: app_bundle_ids, type: 'appstore', readonly: true, keychain_name: 'login.keychain' ) end |
.upload_certificates_and_profiles(type) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/canalizador/ios_utils.rb', line 9 def self.upload_certificates_and_profiles(type) Canalizador::Utils.validate_environment_variables( 'IOS_PROFILES_AND_CERTIFICATES_TO_UPLOAD_PATH', 'IOS_PROFILES_AND_CERTIFICATES_REPO_URL', 'MATCH_PASSWORD' ) files_to_upload_path = ENV['IOS_PROFILES_AND_CERTIFICATES_TO_UPLOAD_PATH'] git_url = ENV['IOS_PROFILES_AND_CERTIFICATES_REPO_URL'] # STORAGE storage = Match::Storage.for_mode( 'git', { git_url: git_url, shallow_clone: false, git_branch: 'master', clone_branch_directly: false } ) storage.download # ENCRYPTION encryption = Match::Encryption.for_storage_mode( 'git', { git_url: git_url, working_directory: storage.working_directory } ) encryption.decrypt_files certifcates_folder = nil case type when 'development' certifcates_folder = 'development' when 'adhoc' certifcates_folder = 'distribution' when 'appstore' certifcates_folder = 'distribution' end # CERTIFICATES files_to_upload_dir = Dir["#{files_to_upload_path}/*.{cer,p12}"] files_to_upload_dir.each do |filename| name = File.basename(filename) dest_file = "#{storage.working_directory}/certs/#{certifcates_folder}/#{name}" FileUtils.cp(filename, dest_file) end # PROFILES files_to_upload_dir = Dir["#{files_to_upload_path}/*.{mobileprovision,provisionprofile}"] files_to_upload_dir.each do |filename| name = File.basename(filename) dest_file = "#{storage.working_directory}/profiles/#{type}/#{name}" FileUtils.cp(filename, dest_file) end # COMMITING encryption.encrypt_files files_to_commit = Dir[File.join(storage.working_directory, '**', '*.{cer,p12,mobileprovision,provisionprofile}')] storage.save_changes!(files_to_commit: files_to_commit) end |