class Pod::Installer::Xcode::PodsProjectGenerator::AppHostInstaller

Installs an app host target to a given project.

Attributes

platform[R]

@return [Platform] the platform to use for this app host.

project[R]

@return [Pod::Project]

The `Pods/Pods.xcodeproj` to install the app host into.
sandbox[R]

@return [Sandbox] sandbox

The sandbox used for this installation.
test_type[R]

@return [Symbol] the test type this app host is going to be used for.

Public Class Methods

new(sandbox, project, platform, test_type) click to toggle source

Initialize a new instance

@param [Sandbox] sandbox @see sandbox @param [Pod::Project] project @see project @param [Platform] platform @see platform @param [Symbol] test_type @see test_type

# 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

Public Instance Methods

install!() click to toggle source

@return [PBXNativeTarget] the app host native target that was installed.

# 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

Private Instance Methods

app_host_info_plist_path() click to toggle source

@return [Pathname] The absolute path of the Info.plist to use for an app host.

# File lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb, line 65
def app_host_info_plist_path
  project.path.dirname.+("#{app_host_label}/#{app_host_label}-Info.plist")
end
app_host_label() click to toggle source

@return [String] The label of the app host label to use given the platform and test type.

# File lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb, line 71
def app_host_label
  "AppHost-#{Platform.string_name(platform.symbolic_name)}-#{test_type.capitalize}-Tests"
end
deployment_target() click to toggle source

@return [String] The deployment target.

# File lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb, line 77
def deployment_target
  platform.deployment_target.to_s
end