class Pod::InstallFramework

Public Instance Methods

install() click to toggle source
# File lib/cocoapods-gd/install_frameworks.rb, line 6
def install()
    podfile = Pod::Config.instance.podfile
    sandbox_path = "#{Dir.pwd}/Pods"
    FileUtils.mkdir_p(sandbox_path) unless File.exists?(sandbox_path)
    standard_sandbox = Pod::Sandbox.new(sandbox_path)

    if !podfile.get_use_binaries
        Pod::UI::puts("installing source code")
        podfile_hash = podfile.to_hash
        prebuild_podfile = Pod::Podfile.from_hash(podfile_hash)
        binary_installer = Pod::Installer.new(standard_sandbox, prebuild_podfile)
        binary_installer.install!
        return
    end

    Pod::UI::puts("replaceing Frameworks")
    if podfile.get_use_source_code_selector.nil?
        nameList = []
    else
        nameList = podfile.get_use_source_code_selector.call() 
    end
    if nameList.nil?
        nameList = []
    end

    dependencies = []
    podfile.to_hash["target_definitions"].first["children"].first["dependencies"].each do |library|
        newLibrary = Hash.new
        if library.is_a?(Hash)
            for name in nameList
                if library.keys.first == name
                    if library.values.first.first.is_a?(String)
                        newLibrary = Hash[name => [{:source=>sources(name) }]]
                    elsif library.values.first.first.is_a?(Hash)
                        if library.values.first.first[:git].nil?
                            newLibrary = library
                            newLibrary.values.first.first[:source] = sources(name) 
                        end
                    end
                    break 
                end
            end         
        end
        if library.is_a?(String)
            for name in nameList
                if library == name
                    newLibrary = Hash[library => [{:source=> sources(library)}]]
                    break
                end
            end
        end

        if newLibrary.empty?
            dependencies.push(library)
        else
           dependencies.push(newLibrary)            
        end  
    end
    podfile_hash = podfile.to_hash
    podfile_hash["target_definitions"].first["children"].first["dependencies"] = dependencies
    podfile_hash["sources"] = ["https://gitlab.gaodun.com/iOSLibs/FrameworkSpecs.git", "https://gitlab.gaodun.com/iOSLibs/Specs.git", "https://gitlab.gaodun.com/iOSLibs/CocoaPods.git", "https://github.com/CocoaPods/Specs.git"]
    prebuild_podfile = Pod::Podfile.from_hash(podfile_hash)
    binary_installer = Pod::Installer.new(standard_sandbox, prebuild_podfile)
    binary_installer.install!
end
sources(name) click to toggle source
# File lib/cocoapods-gd/install_frameworks.rb, line 72
def sources(name)
    source_path = "https://gitlab.gaodun.com/iOSLibs/CocoaPods.git"
    privateLibrary = ["AliPlayerSDK", "AliYunCeng", "AliyunLOGiOS", "TXIMSDK_TUIKit_iOS", "WCDBSwift", "WeexSDK"]
    if name.start_with? "GD" || privateLibrary.include?(name)
        source_path = "http://gitlab.gaodun.com/iOSLibs/Specs.git"
    end
    source_path
end