Class: Pod::Installer::Xcode::PodsProjectGenerator::AppHostInstaller

Inherits:
Object
  • Object
show all
Includes:
TargetInstallerHelper
Defined in:
lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb

Overview

Installs an app host target to a given project.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TargetInstallerHelper

create_info_plist_file_with_sandbox, update_changed_file

Constructor Details

#initialize(sandbox, project, platform, test_type) ⇒ AppHostInstaller

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    @see #sandbox

  • project (Pod::Project)

    @see #project

  • platform (Platform)

    @see #platform

  • test_type (Symbol)

    @see #test_type



35
36
37
38
39
40
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 35

def initialize(sandbox, project, platform, test_type)
  @sandbox = sandbox
  @project = project
  @platform = platform
  @test_type = test_type
end

Instance Attribute Details

#platformPlatform (readonly)

Returns the platform to use for this app host.

Returns:

  • (Platform)

    the platform to use for this app host.



22
23
24
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 22

def platform
  @platform
end

#projectPod::Project (readonly)

Returns The ‘Pods/Pods.xcodeproj` to install the app host into.

Returns:

  • (Pod::Project)

    The ‘Pods/Pods.xcodeproj` to install the app host into.



18
19
20
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 18

def project
  @project
end

#sandboxSandbox (readonly)

Returns sandbox The sandbox used for this installation.

Returns:

  • (Sandbox)

    sandbox The sandbox used for this installation.



13
14
15
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 13

def sandbox
  @sandbox
end

#test_typeSymbol (readonly)

Returns the test type this app host is going to be used for.

Returns:

  • (Symbol)

    the test type this app host is going to be used for.



26
27
28
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 26

def test_type
  @test_type
end

Instance Method Details

#install!PBXNativeTarget

Returns the app host native target that was installed.

Returns:

  • (PBXNativeTarget)

    the app host native target that was installed.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb', line 44

def install!
  name = app_host_label
  platform_name = platform.name
  app_host_target = Pod::Generator::AppTargetHelper.add_app_target(project, platform_name, deployment_target,
                                                                   name)
  app_host_target.build_configurations.each do |configuration|
    configuration.build_settings['PRODUCT_NAME'] = name
    configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}'
    configuration.build_settings['CODE_SIGN_IDENTITY'] = '' if platform == :osx
    configuration.build_settings['CURRENT_PROJECT_VERSION'] = '1'
  end
  Pod::Generator::AppTargetHelper.add_app_host_main_file(project, app_host_target, platform_name, name)
  create_info_plist_file_with_sandbox(sandbox, app_host_info_plist_path, app_host_target, '1.0.0', platform, :appl)
  project[name].new_file(app_host_info_plist_path)
  app_host_target
end