module Pod # The sandbox provides support for the directory that CocoaPods uses for an # installation. In this directory the Pods projects, the support files and # the sources of the Pods are stored. # # CocoaPods assumes to have control of the sandbox. # # Once completed the sandbox will have the following file structure: # # Pods # | # +-- Headers # | +-- Private # | | +-- [Pod Name] # | +-- Public # | +-- [Pod Name] # | # +-- Local Podspecs # | +-- External Sources # | +-- Normal Sources # | # +-- Target Support Files # | +-- [Target Name] # | +-- Pods-acknowledgements.markdown # | +-- Pods-acknowledgements.plist # | +-- Pods-dummy.m # | +-- Pods-prefix.pch # | +-- Pods.xcconfig # | # +-- [Pod Name] # | # +-- Manifest.lock # | # +-- Pods.xcodeproj # (if installation option 'generate_multiple_pod_projects' is enabled) # | # +-- PodTarget1.xcodeproj # | # ... # | # +-- PodTargetN.xcodeproj # # class PrebuildSandbox < Sandbox # [String] standard_sandbox_path def self.from_standard_sandbox_path(path) prebuild_sandbox_path = Pathname.new(path).realpath new(prebuild_sandbox_path) end def self.from_standard_sandbox(sandbox) from_standard_sandbox_path(sandbox.root) end def make_source_link(source, target) source = Pathname.new(source) target = Pathname.new(target) target.parent.mkpath unless target.parent.exist? target.rmtree if target.exist? relative_source = source.relative_path_from(target.parent) FileUtils.ln_sf(relative_source, target) end def source_path '../Pods-Source' end def headers_root root + source_path + 'Headers' end def project_path root + source_path + 'Pods-Source.xcodeproj' end def specifications_root # root + source_path + 'Local Podspecs' super end def target_support_files_root root + source_path + 'Target Support Files' end def link_source_project! root.children.each do |child| next if ['Headers', 'Local Podspecs', 'Target Support Files'].include? child.basename.to_s next if ['.lock', '.xcodeproj'].include? child.extname.to_s make_source_link(child, root + source_path + child.basename) end end def clean_source_project! return if Jxedt.config.keep_source_project? source_project_path = root + source_path source_project_path.rmtree if source_project_path.exist? end end end module Pod class Installer # The {UserProjectIntegrator} integrates the libraries generated by # TargetDefinitions of the {Podfile} with their correspondent user # projects. # class UserProjectIntegrator alias_method :old_create_workspace, :create_workspace def create_workspace old_create_workspace unless sandbox.is_a?(Pod::PrebuildSandbox) end end end end module Pod class Installer # Cleans up the sandbox directory by removing stale target support files and headers. # class SandboxDirCleaner alias_method :old_clean!, :clean! def clean! old_clean! unless @sandbox.is_a?(Pod::PrebuildSandbox) end end end end