class Pod::Sandbox


See #833
+– Pods.xcodeproj
|
+– Manifest.lock
|
| +– Pods.xcconfig
| +– Pods-prefix.pch
| +– Pods-dummy.m
| +– Pods-acknowledgements.plist
| +– Pods-acknowledgements.markdown
| +– [Target Name]
+– Target Support Files
|
| +– Normal Sources
| +– External Sources
+– Specs
|
| +– [Pod Name]
+– Sources
|
| +– [Pod Name]
| +– Public
| | +– [Pod Name]
| +– Private
+– Headers
+– Generated
|
| +– Scripts
| +– Specs
| +– [Target Name]-configuration.h
+– User
|
Pods
Once completed the sandbox will have the following file structure:
CocoaPods assumes to have control of the sandbox.
the sources of the Pods are stored.
installation. In this directory the Pods projects, the support files and
The sandbox provides support for the directory that CocoaPods uses for an

def clean_pod(name)

Returns:
  • (void) -
def clean_pod(name)
  root_name = Specification.root_name(name)
  unless local?(root_name)
    path = pod_dir(name)
    path.rmtree if path.exist?
  end
  podspe_path = specification_path(name)
  podspe_path.rmtree if podspe_path
end

def documentation_dir

Returns:
  • (Pathname) - the directory where to store the documentation.
def documentation_dir
  root + 'Documentation'
end

def head_pod?(name)

Returns:
  • (Bool) - Whether the Pod has been marked as head.

Parameters:
  • name (String) --
def head_pod?(name)
  root_name = Specification.root_name(name)
  head_pods.include?(root_name)
end

def implode

Returns:
  • (void) -
def implode
  root.rmtree
end

def initialize(root)

Parameters:
  • root (String, Pathname) -- @see root
def initialize(root)
  @root = Pathname.new(root)
  @public_headers = HeadersStore.new(self, "Headers")
  @predownloaded_pods = []
  @head_pods = []
  @checkout_sources = {}
  @development_pods = {}
  FileUtils.mkdir_p(@root)
end

def inspect

Returns:
  • (String) - a string representation suitable for debugging.
def inspect
  "#<#{self.class}> with root #{root}"
end

def library_support_files_dir(name)

Returns:
  • (Pathname) - the path of the support files.

Parameters:
  • name (String) --
def library_support_files_dir(name)
  # root + "Target Support Files/#{name}"
  root
end

def local?(name)

Returns:
  • (Bool) - Whether the Pod is locally sourced.

Parameters:
  • name (String) --
def local?(name)
  root_name = Specification.root_name(name)
  !development_pods[root_name].nil?
end

def manifest

Returns:
  • (Lockfile) - the manifest which contains the information about the
def manifest
  Lockfile.from_file(manifest_path) if manifest_path.exist?
end

def manifest_path

Returns:
  • (Pathname) - the path of the manifest.
def manifest_path
  root + "Manifest.lock"
end

def pod_dir(name)

Returns:
  • (Pathname) - the path of the Pod.

Parameters:
  • name (String) --
def pod_dir(name)
  root_name = Specification.root_name(name)
  if local?(root_name)
    Pathname.new(development_pods[root_name])
  else
    # root + "Sources/#{name}"
    root + root_name
  end
end

def predownloaded?(name)

Returns:
  • (Bool) - Whether the Pod has been pre-downloaded.

Parameters:
  • name (String) --
def predownloaded?(name)
  root_name = Specification.root_name(name)
  predownloaded_pods.include?(root_name)
end

def project_path

Returns:
  • (Pathname) - the path of the Pods project.
def project_path
  root + "Pods.xcodeproj"
end

def specification(name)

Returns:
  • (Specification) - the specification if the file is found.

Parameters:
  • name (String) --
def specification(name)
  if file = specification_path(name)
    Specification.from_file(file)
  end
end

def specification_path(name)

Returns:
  • (Nil) - if the podspec is not stored.
  • (Pathname) - the path or nil.

Parameters:
  • name (String) --
def specification_path(name)
  path = specifications_dir + "#{name}.podspec"
  path.exist? ? path : nil
end

def specifications_dir(external_source = false)

Other tags:
    Todo: - Migrate old installations and store the for all the pods.

Returns:
  • (Pathname) - the path for the directory where to store the
def specifications_dir(external_source = false)
  # root + "Specifications"
  root + "Local Podspecs"
end

def store_checkout_source(name, source)

Returns:
  • (void) -

Parameters:
  • source (Hash) --
  • name (String) --
def store_checkout_source(name, source)
  root_name = Specification.root_name(name)
  checkout_sources[root_name] = source
end

def store_head_pod(name)

Returns:
  • (void) -

Parameters:
  • name (String) --
def store_head_pod(name)
  root_name = Specification.root_name(name)
  head_pods << root_name
end

def store_local_path(name, path)

Returns:
  • (void) -

Parameters:
  • path (#to_s) --
  • name (String) --
def store_local_path(name, path)
  root_name = Specification.root_name(name)
  development_pods[root_name] = path.to_s
end

def store_podspec(name, podspec, external_source = false)

Other tags:
    Todo: - Store all the specifications (including those not originating

Parameters:
  • podspec (String, Pathname) --
  • sandbox (Sandbox) --
def store_podspec(name, podspec, external_source = false)
  output_path = specifications_dir(external_source) + "#{name}.podspec"
  output_path.dirname.mkpath
  if podspec.is_a?(String)
    output_path.open('w') { |f| f.puts(podspec) }
  else
    unless podspec.exist?
      raise Informative, "No podspec found for `#{name}` in #{podspec}"
    end
    FileUtils.copy(podspec, output_path)
  end
  spec = Specification.from_file(output_path)
  unless spec.name == name
    raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
  end
end

def store_pre_downloaded_pod(name)

Returns:
  • (void) -

Parameters:
  • name (String) --
def store_pre_downloaded_pod(name)
  root_name = Specification.root_name(name)
  predownloaded_pods << root_name
end