Class: Pod::Installer::BaseInstallHooksContext

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/base_install_hooks_context.rb

Overview

Context object designed to be used with the HooksManager which describes the context of the installer.

Defined Under Namespace

Classes: UmbrellaTargetDescription

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandbox, sandbox_root, pods_project, pod_target_subprojects, umbrella_targets) ⇒ BaseInstallHooksContext

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    see #sandbox

  • sandbox_root (String)

    see #sandbox_root

  • pods_project (Xcodeproj::Project)

    see #pods_project

  • pod_target_subprojects (Array<Xcodeproj::Project>)

    see #pod_target_subprojects

  • umbrella_targets (Array<UmbrellaTargetDescription>)

    see #umbrella_targets


36
37
38
39
40
41
42
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 36

def initialize(sandbox, sandbox_root, pods_project, pod_target_subprojects, umbrella_targets)
  @sandbox = sandbox
  @sandbox_root = sandbox_root
  @pods_project = pods_project
  @pod_target_subprojects = pod_target_subprojects
  @umbrella_targets = umbrella_targets
end

Instance Attribute Details

#pod_target_subprojectsArray<Pod::Project> (readonly)

Returns the subprojects nested under pods_project.

Returns:

  • (Array<Pod::Project>)

    the subprojects nested under pods_project.


21
22
23
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 21

def pod_target_subprojects
  @pod_target_subprojects
end

#pods_projectXcodeproj::Project (readonly)

Returns The Pods Xcode project.

Returns:

  • (Xcodeproj::Project)

    The Pods Xcode project.


17
18
19
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 17

def pods_project
  @pods_project
end

#sandboxSandbox (readonly)

Returns The Sandbox for the project.

Returns:

  • (Sandbox)

    The Sandbox for the project.


9
10
11
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 9

def sandbox
  @sandbox
end

#sandbox_rootString (readonly)

Returns The path to the sandbox root (Pods directory).

Returns:

  • (String)

    The path to the sandbox root (Pods directory).


13
14
15
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 13

def sandbox_root
  @sandbox_root
end

#umbrella_targetsArray<UmbrellaTargetDescription> (readonly)

Returns The list of the CocoaPods umbrella targets generated by the installer.

Returns:


26
27
28
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 26

def umbrella_targets
  @umbrella_targets
end

Class Method Details

.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets) ⇒ PostInstallHooksContext, HooksContext

Parameters:

  • sandbox (Sandbox)

    The sandbox

  • pods_project (Project)

    The pods project.

  • pod_target_subprojects (Project)

    The subprojects nested under pods_project.

  • aggregate_targets (Array<AggregateTarget>)

    The aggregate targets, which will been presented by an adequate UmbrellaTargetDescription in the generated context.

Returns:

  • (PostInstallHooksContext)

    Convenience class generator method

  • (HooksContext)

    Convenience class method to generate the static context.


62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 62

def self.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)
  umbrella_targets_descriptions = aggregate_targets.map do |umbrella|
    user_project = umbrella.user_project
    user_targets = umbrella.user_targets
    specs = umbrella.specs
    platform_name = umbrella.platform.name
    platform_deployment_target = umbrella.platform.deployment_target.to_s
    cocoapods_target_label = umbrella.label
    UmbrellaTargetDescription.new(user_project, user_targets, specs, platform_name, platform_deployment_target, cocoapods_target_label)
  end

  new(sandbox, sandbox.root.to_s, pods_project, pod_target_subprojects, umbrella_targets_descriptions)
end

Instance Method Details

#generated_projectsArray<Pod::Project>

Returns all projects generated during installation.

Returns:

  • (Array<Pod::Project>)

    all projects generated during installation


78
79
80
# File 'lib/cocoapods/installer/base_install_hooks_context.rb', line 78

def generated_projects
  [pods_project] + pod_target_subprojects
end