class Pod::Installer

Public Instance Methods

flock(file, mode) { |file| ... } click to toggle source

@param [File] file

should be locked file.

@param [mode] mode

the file lock mode.

@return [Boolean] The result of lock specific file and mode.

# File lib/bd_pod_cache_lock.rb, line 70
def flock(file, mode)
  success = file.flock(mode)
  if success
    begin
      yield file
    ensure
      file.flock(File::LOCK_UN)
    end
  end
  success
end
install!() click to toggle source

Installs the Pods.

The installation process is mostly linear with a few minor complications to keep in mind:

  • The stored podspecs need to be cleaned before the resolution step otherwise the sandbox might return an old podspec and not download the new one from an external source.

  • The resolver might trigger the download of Pods from external sources necessary to retrieve their podspec (unless it is instructed not to do it).

@return [void]

# File lib/bd_pod_cache_lock.rb, line 36
def install!
  Dir.mkdir($pod_cache_dir) unless Dir.exist?($pod_cache_dir)

  lock_file_path = $pod_install_lock_file

  File.new(lock_file_path, File::CREAT) unless File.exist? lock_file_path
  File.open(lock_file_path) do |file|
    flock(file, File::LOCK_EX) { 
      puts "Lock Pod install"
      $locked = true
      prepare
      resolve_dependencies
      download_dependencies
    }
  end
  
  validate_targets
  generate_pods_project
  if installation_options.integrate_targets?
    integrate_user_project
  else
    UI.section 'Skipping User Project Integration'
  end
  perform_post_install_actions
end