Class: Mysigner::Build::Configurator
- Inherits:
-
Object
- Object
- Mysigner::Build::Configurator
- Defined in:
- lib/mysigner/build/configurator.rb
Defined Under Namespace
Classes: ProfileNotFoundError
Instance Method Summary collapse
-
#check_profile_available(target_name = nil, configuration = 'Release', build_type: :appstore) ⇒ Object
Check if profile is available without configuring.
-
#configure!(target_name = nil, configuration = 'Release', build_type: :appstore) ⇒ Object
Configure signing for a specific build type build_type: :development, :adhoc, :appstore, :enterprise.
-
#initialize(parser, client, organization_id) ⇒ Configurator
constructor
A new instance of Configurator.
Constructor Details
#initialize(parser, client, organization_id) ⇒ Configurator
Returns a new instance of Configurator.
8 9 10 11 12 |
# File 'lib/mysigner/build/configurator.rb', line 8 def initialize(parser, client, organization_id) @parser = parser @client = client @organization_id = organization_id end |
Instance Method Details
#check_profile_available(target_name = nil, configuration = 'Release', build_type: :appstore) ⇒ Object
Check if profile is available without configuring
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mysigner/build/configurator.rb', line 59 def check_profile_available(target_name = nil, configuration = 'Release', build_type: :appstore) bundle_id = @parser.bundle_id(target_name, configuration) profile_type = map_build_type_to_profile_type(build_type) begin fetch_profile(bundle_id, profile_type) true rescue ProfileNotFoundError false end end |
#configure!(target_name = nil, configuration = 'Release', build_type: :appstore) ⇒ Object
Configure signing for a specific build type build_type: :development, :adhoc, :appstore, :enterprise
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 |
# File 'lib/mysigner/build/configurator.rb', line 16 def configure!(target_name = nil, configuration = 'Release', build_type: :appstore) target = @parser.find_target(target_name) bundle_id = @parser.bundle_id(target_name, configuration) raise 'Bundle ID not found in project' if bundle_id.to_s.empty? # Map build type to profile type profile_type = map_build_type_to_profile_type(build_type) # Fetch matching profile from API profile = fetch_profile(bundle_id, profile_type) # Configure the target's build settings config = target.build_configurations.find { |c| c.name == configuration } raise "Configuration '#{configuration}' not found" unless config # Set manual signing config.build_settings['CODE_SIGN_STYLE'] = 'Manual' config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = profile['name'] # Set code sign identity based on type code_sign_identity = case build_type when :development 'iPhone Developer' else 'iPhone Distribution' end config.build_settings['CODE_SIGN_IDENTITY'] = code_sign_identity # Ensure development team is set team_id = @parser.team_id(target_name, configuration) if team_id.to_s.empty? && profile['team_id'] # Try to get from profile or use organization default config.build_settings['DEVELOPMENT_TEAM'] = profile['team_id'] end # Save project @parser.project.save profile end |