Method: Pindo::Command::Lib::Update#run

Defined in:
lib/pindo/command/lib/update.rb

#runObject



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
74
75
76
77
78
# File 'lib/pindo/command/lib/update.rb', line 40

def run

    working_dir = @project_dir

    pod_array = pindo_single_config.pod_repo_dict
    pod_index_url = nil
    if !pod_array.nil?
        pod_index_url = pod_array['podindex']
    else
        raise Informative, '私有Pod索引地址未知!!'
    end
    sources = Pod::Config.instance.sources_manager.all
    repos_path = File.expand_path("~/.cocoapods/repos")

    private_source = sources.select { |s| s.git? && s.url.to_s.eql?(pod_index_url)}.first
    if !private_source.nil?

        puts "私有Pod地址:#{pod_index_url}"
        puts "私有Pod目录:~/.cocoapods"
        getcode_to_dir(reponame:File.basename(private_source.repo), remote_url: pod_index_url, path:repos_path)
    else
        puts "私有Pod地址:#{pod_index_url}"
        puts "私有Pod目录:~/.cocoapods"
        repository_name = pod_index_url.split("/").last.chomp(".git")
        getcode_to_dir(reponame:repository_name, remote_url: pod_index_url, path:repos_path)
    end


    if @args_install_flag
        begin
            if File.exist?("#{working_dir}/Podfile")
                Pod::Command::Install::run(['--clean-install'])
            end
        rescue => e
            puts e.message
        end
    end

end