Class: Pod::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-binary/feature_switches.rb,
lib/cocoapods-binary/Prebuild.rb,
lib/cocoapods-binary/Integration.rb,
lib/cocoapods-binary/Integration.rb,
lib/cocoapods-binary/podfile_options.rb,
lib/cocoapods-binary/feature_switches.rb

Overview

a option to disable install complete message

Defined Under Namespace

Classes: PodSourceInstaller

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.disable_install_complete_message(value) ⇒ Object



54
55
56
# File 'lib/cocoapods-binary/feature_switches.rb', line 54

def self.disable_install_complete_message(value)
    @@disable_install_complete_message = value
end

.force_disable_integration(value) ⇒ Object



39
40
41
# File 'lib/cocoapods-binary/feature_switches.rb', line 39

def self.force_disable_integration(value)
    @@force_disable_integration = value
end

Instance Method Details

#prebuild_frameworksObject



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
69
70
71
72
73
# File 'lib/cocoapods-binary/Prebuild.rb', line 16

def prebuild_frameworks 

    local_manifest = Pod.old_manifest_lock_file
    sandbox_path = sandbox.root
    existed_framework_folder = sandbox.generate_framework_path

    if local_manifest != nil

        changes = local_manifest.detect_changes_with_podfile(podfile)
        Pod::Prebuild.framework_changes = changes # save the chagnes info for later stage
        added = changes[:added] || []
        changed = changes[:changed] || []
        unchanged = changes[:unchanged] || []
        deleted = changes[:removed] || []
    
        existed_framework_folder.mkdir unless existed_framework_folder.exist?
        exsited_framework_names = sandbox.exsited_framework_names
        
        # deletions
        # remove all frameworks except ones to remain
        unchange_framework_names = added + unchanged
        to_delete = exsited_framework_names.select do |framework_name|
            not unchange_framework_names.include?(framework_name)
        end
        to_delete.each do |framework_name|
            path = existed_framework_folder + (framework_name + ".framework")
            path.rmtree if path.exist?
        end
    
        # additions
        missing = unchanged.select do |pod_name|
            not exsited_framework_names.include?(pod_name)
        end

        targets = (added + changed + missing).map do |pod_name|
            self.pod_targets.find do |pod_target|
                pod_target.root_spec.name == pod_name
            end
        end
        Pod::Prebuild.build(sandbox_path, existed_framework_folder, targets)
        
    else
        Pod::Prebuild.framework_changes = nil
        Pod::Prebuild.build(sandbox_path, existed_framework_folder, self.pod_targets)
    end

    # Remove useless files
    # only keep manifest.lock and framework folder
    to_remain_files = ["Manifest.lock", File.basename(existed_framework_folder)]
    to_delete_files = sandbox_path.children.select do |file|
        filename = File.basename(file)
        not to_remain_files.include?(filename)
    end
    to_delete_files.each do |path|
        path.rmtree if path.exist?
    end

end

#prebuild_pod_namesObject



50
51
52
# File 'lib/cocoapods-binary/podfile_options.rb', line 50

def prebuild_pod_names 
    @prebuild_pod_names ||= self.podfile.target_definition_list.map(&:prebuild_framework_names).flatten.uniq
end

#remove_target_files_if_neededObject

Remove the old target files if prebuild frameworks changed



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cocoapods-binary/Integration.rb', line 41

def remove_target_files_if_needed

    changes = Pod::Prebuild.framework_changes
    return if changes == nil
    added = changes[:added] || []
    changed = changes[:changed] || []
    deleted = changes[:removed] || []

    (added + changed + deleted).each do |name|
        root_name = Specification.root_name(name)
        next if self.sandbox.local?(root_name)

        # delete the cached files
        target_path = self.sandbox.pod_dir(root_name)
        target_path.rmtree if target_path.exist?
    end

end