Subito-it / PodBuilder

A tool to precompile CocoaPods pods
Other
284 stars 28 forks source link

[Solved] error when running pod_builder install_sources #53

Closed hardeverick closed 2 years ago

hardeverick commented 2 years ago

I was getting this error when running pod_build install_sources

undefined local variable or method `repo_dir' for PodBuilder::Command::InstallSources:Class
/Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/lib/pod_builder/command/install_sources.rb:55:in `update_repo'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/lib/pod_builder/command/install_sources.rb:26:in `block in call'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/lib/pod_builder/command/install_sources.rb:22:in `each'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/lib/pod_builder/command/install_sources.rb:22:in `call'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/exe/pod_builder:368:in `block in parse_commandline'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/exe/pod_builder:367:in `each'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/exe/pod_builder:367:in `parse_commandline'
    /Library/Ruby/Gems/2.6.0/gems/pod-builder-4.2.0/exe/pod_builder:383:in `<top (required)>'
    /usr/local/bin/pod_builder:23:in `load'
    /usr/local/bin/pod_builder:23:in `<main>'

Command failed!

From the description I was able to fix the issue by editing the install_sources.rb file.

I changed this:

        Dir.chdir(dest_path) do
          repo_dir = File.join(dest_path, spec.podspec_name)
          if !File.directory?(repo_dir)
            raise "\n\nFailed cloning #{spec.name}".red if !system("git clone #{spec.repo} #{spec.podspec_name}")
          end
        end

to this:

        repo_dir = File.join(dest_path, spec.podspec_name)
        Dir.chdir(dest_path) do
          if !File.directory?(repo_dir)
            raise "\n\nFailed cloning #{spec.name}".red if !system("git clone #{spec.repo} #{spec.podspec_name}")
          end
        end
tcamin commented 2 years ago

Fixed in #54, closing