Skip to content

pod bin code [xxxxxx] not work #213

@future-jpg

Description

@future-jpg

#下载源码到本地

def download_source(name)
        target_path =  File.join(source_root, name)
        UI.puts target_path
        FileUtils.rm_rf(target_path)
        
        spec = fetch_external_source(find_dependency, @config.podfile,@config.lockfile, @config.sandbox,true )

        download_request = Pod::Downloader::Request.new(:name => name, :spec => specification)
        Downloader.download(download_request, Pathname.new(target_path), :can_cache => true)

        target_path
end
def self.from_dependency(dependency, podfile_path, can_cache)
      from_params(dependency.external_source, dependency, podfile_path, can_cache)
    end

    def self.from_params(params, dependency, podfile_path, can_cache)
      name = dependency.root_name
      if klass = concrete_class_from_params(params)
        klass.new(name, params, podfile_path, can_cache)
      else
        msg = "Unknown external source parameters for `#{name}`: `#{params}`"
        raise Informative, msg
      end
    end

    # Get the class to represent the defined source type of a dependency
    #
    # @param  [Array<Symbol>] params
    #         the source params of the dependency
    #
    # @return [Class]
    #
    def self.concrete_class_from_params(params)
      if params.key?(:podspec)
        PodspecSource
      elsif params.key?(:path)
        PathSource
      elsif Downloader.strategy_from_options(params)
        DownloaderSource
      end
    end

这段代码位于code.rb中,但是fetch_external_source是不是用错了,pod bin code [podname]这个里面的podname应该是在二进制源内的吧,那他的find_dependency.external_source就会是nil,然后在cocoapods代码里面会报nil没有key?这个方法。
感觉改成下面这样会不会好点,求大佬解答一下,我这跑半天都是报错的

def download_source(name)
         target_path =  File.join(source_root, name)
         UI.puts target_path
         FileUtils.rm_rf(target_path)

         source = sources_manager.code_source
         spec = source.specification(name, @config.lockfile.version(name))

         download_request = Pod::Downloader::Request.new(:name => name, :spec => specification)
         Downloader.download(download_request, Pathname.new(target_path), :can_cache => true)
         target_path
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions