class Pod::Installer

Public Instance Methods

install_pod_sources() click to toggle source
# File lib/cocoapods-multithread-installpod.rb, line 7
def install_pod_sources
  @installed_specs = []
  pods_to_install = sandbox_state.added | sandbox_state.changed
  title_options = { :verbose_prefix => '-> '.green }

  work_q = Queue.new
  root_specs.sort_by(&:name).each{|spec| work_q.push spec }
  workers = (0...20).map do
    Thread.new do
      begin
        while spec = work_q.pop(true)
          if pods_to_install.include?(spec.name)
            if sandbox_state.changed.include?(spec.name) && sandbox.manifest
              previous = sandbox.manifest.version(spec.name)
              title = "Installing #{spec.name} #{spec.version} (was #{previous})"
            else
              title = "Installing #{spec}"
            end
            UI.titled_section(title.green, title_options) do
              install_source_of_pod(spec.name)
              #UI.titled_section("Installed #{spec}", title_options)
            end
          else
            UI.titled_section("Using #{spec}", title_options) do
              create_pod_installer(spec.name)
              #UI.titled_section("Installed #{spec}", title_options)
            end
          end
        end
      rescue ThreadError
      end
    end
  end
  UI.titled_section("Installing... Please Wait...", title_options)
  workers.map(&:join)
end