MeetYouDevs / cocoapods-imy-bin

1.06k stars 245 forks source link

pod bin code [xxxxxx] not work #213

Open future-jpg opened 2 years ago

future-jpg commented 2 years ago

下载源码到本地

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
chengzongxin commented 1 year ago

楼主解决了吗

lirs72379 commented 1 year ago

请见谅,这是我的自动回复邮件,您的邮件已收到,谢谢!

jsxyjGithub commented 1 year ago

看着不太对啊。二进制引入的时候,他应该是不会存在podfile.lock中的source里的啊。我像你这样拿,拿到的仍然是空的。

lirs72379 commented 1 year ago

请见谅,这是我的自动回复邮件,您的邮件已收到,谢谢!

erduoniba commented 3 months ago

https://github.com/MeetYouDevs/cocoapods-imy-bin/pull/220 这个是已经支持了Cocoapods新版本适配,并解决 pod bin code 的问题