Class: Pod::Installer::PostInstallHooksContext

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/post_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, umbrella_targets) ⇒ PostInstallHooksContext

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    see #sandbox

  • sandbox_root (String)

    see #sandbox_root

  • pods_project (Xcodeproj::Project)

    see #pods_project

  • umbrella_targets (Array<UmbrellaTargetDescription>)

    see #umbrella_targets



31
32
33
34
35
36
# File 'lib/cocoapods/installer/post_install_hooks_context.rb', line 31

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

Instance Attribute Details

#pods_projectXcodeproj::Project (readonly)

Returns The Pods Xcode project.

Returns:

  • (Xcodeproj::Project)

    The Pods Xcode project.



17
18
19
# File 'lib/cocoapods/installer/post_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/post_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/post_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:



22
23
24
# File 'lib/cocoapods/installer/post_install_hooks_context.rb', line 22

def umbrella_targets
  @umbrella_targets
end

Class Method Details

.generate(sandbox, aggregate_targets) ⇒ PostInstallHooksContext, HooksContext

Parameters:

Returns:

  • (PostInstallHooksContext)

    Convenience class generator method

  • (HooksContext)

    Convenience class method to generate the static context.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cocoapods/installer/post_install_hooks_context.rb', line 50

def self.generate(sandbox, 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, sandbox.project, umbrella_targets_descriptions)
end