Subito-it/PodBuilder

[Solved] error when running pod_builder install_sources

hardeverick opened this issue · 1 comments

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

Fixed in #54, closing