Class: Pod::Installer
- Inherits:
-
Object
- Object
- Pod::Installer
- Defined in:
- lib/bd_pod_cache_lock.rb
Instance Method Summary collapse
-
#flock(file, mode) ⇒ Boolean
The result of lock specific file and mode.
-
#install! ⇒ void
Installs the Pods.
Instance Method Details
#flock(file, mode) ⇒ Boolean
Returns The result of lock specific file and mode.
70 71 72 73 74 75 76 77 78 79 80 |
# 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! ⇒ void
This method returns an undefined value.
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).
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 .integrate_targets? integrate_user_project else UI.section 'Skipping User Project Integration' end perform_post_install_actions end |