Class: Pod::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-pod-sign/pod_installer.rb

Instance Method Summary collapse

Instance Method Details

#origin_run_podfile_post_install_hookObject



7
# File 'lib/cocoapods-pod-sign/pod_installer.rb', line 7

alias_method :origin_run_podfile_post_install_hook, :run_podfile_post_install_hook

#run_podfile_post_install_hookObject



8
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
# File 'lib/cocoapods-pod-sign/pod_installer.rb', line 8

def run_podfile_post_install_hook

  storage = PodSignStorage.instance

  pod_sign_extract_team_id_from_user_project if storage.configurations.empty? && !storage.skip_sign

  targets = if installation_options.generate_multiple_pod_projects
              pod_target_subprojects.flat_map { |p| p.targets }
            else
              pods_project.targets
            end
  targets.each do |target|
    next unless target.respond_to?('product_type') && target.product_type == 'com.apple.product-type.bundle'

    target.build_configurations.each do |config|
      if storage.skip_sign
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        next
      end
      sign_config = storage.configurations[config.name]
      next unless sign_config.instance_of?(Hash)

      config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = sign_config[:bundle_id] unless sign_config[:bundle_id].nil?
      config.build_settings['DEVELOPMENT_TEAM'] = sign_config[:team_id]
      config.build_settings['CODE_SIGN_STYLE'] = if sign_config[:sign_style]
                                                   sign_config[:sign_style]
                                                 else
                                                   config.type == :debug ? 'Automatic' : 'Manual'
                                                 end
      config.build_settings['CODE_SIGN_IDENTITY'] = if sign_config[:sign_identity]
                                                      sign_config[:sign_identity]
                                                    else
                                                      config.type == :debug ? 'Apple Development' : 'Apple Distribution'
                                                    end
    end
  end

  origin_run_podfile_post_install_hook
  true
end