Class: Pod::Downloader::Cache
- Inherits:
-
Object
- Object
- Pod::Downloader::Cache
- Defined in:
- lib/cocoapods-meitu-bin/native/installer.rb
Constant Summary collapse
- @@lock =
多线程锁
Mutex.new
Instance Method Summary collapse
- #ensure_matching_version ⇒ Object
-
#old_ensure_matching_version ⇒ Object
rmtree 在多进程情况下可能 Directory not empty @ dir_s_rmdir 错误 old_ensure_matching_version 会移除不是同一个 CocoaPods 版本的组件缓存.
- #uncached_pod(request) ⇒ Object
Instance Method Details
#ensure_matching_version ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/cocoapods-meitu-bin/native/installer.rb', line 364 def ensure_matching_version @@lock.synchronize do version_file = root + 'VERSION' # version = version_file.read.strip if version_file.file? # root.rmtree if version != Pod::VERSION && root.exist? root.mkpath version_file.open('w') { |f| f << Pod::VERSION } end end |
#old_ensure_matching_version ⇒ Object
rmtree 在多进程情况下可能 Directory not empty @ dir_s_rmdir 错误old_ensure_matching_version 会移除不是同一个 CocoaPods 版本的组件缓存
363 |
# File 'lib/cocoapods-meitu-bin/native/installer.rb', line 363 alias old_ensure_matching_version ensure_matching_version |
#uncached_pod(request) ⇒ Object
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/cocoapods-meitu-bin/native/installer.rb', line 376 def uncached_pod(request) in_tmpdir do |target| result, podspecs = download(request, target) result.location = nil # 记录下载大小大于阈值的库及大小 if File.exist?(target.to_s) archive_size = CBin::PodSize.get_archive_size(target) dir_size = archive_size ? archive_size : `du -sk #{target.to_s}`.strip().split(' ')[0] CBin::PodSize.add_pod({:name => request.name, :size => dir_size}) end podspecs.each do |name, spec| destination = path_for_pod(request, :name => name, :params => result.) copy_and_clean(target, destination, spec) write_spec(spec, path_for_spec(request, :name => name, :params => result.)) if request.name == name result.location = destination end end result end end |