Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pod bin code [xxxxxx] not work #213

Open
arceushs opened this issue Aug 24, 2022 · 4 comments
Open

pod bin code [xxxxxx] not work #213

arceushs opened this issue Aug 24, 2022 · 4 comments

Comments

@arceushs
Copy link

arceushs commented Aug 24, 2022

#下载源码到本地

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
Copy link

楼主解决了吗

@lirs72379
Copy link

lirs72379 commented May 11, 2023 via email

@jsxyjGithub
Copy link

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

@lirs72379
Copy link

lirs72379 commented Oct 20, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants