Class: Pod::Project

Inherits:
Xcodeproj::Project
  • Object
show all
Defined in:
lib/cocoapods/project.rb

Instance Method Summary (collapse)

Constructor Details

- (Project) initialize

A new instance of Project



15
16
17
18
19
# File 'lib/cocoapods/project.rb', line 15

def initialize(*)
  super
  main_group << groups.new('name' => 'Pods')
  @user_build_configurations = []
end

Instance Method Details

- (Object) add_pod_group(name)

Adds a group as child to the `Pods' group.



38
39
40
# File 'lib/cocoapods/project.rb', line 38

def add_pod_group(name)
  pods.groups.new('name' => name)
end

- (Object) add_pod_target(name, platform)



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/cocoapods/project.rb', line 42

def add_pod_target(name, platform)
  target = targets.new_static_library(platform.name, name)

  settings = {}
  if platform.requires_legacy_ios_archs?
    settings['ARCHS'] = "armv6 armv7"
  end
  if platform == :ios && platform.deployment_target
    settings['IPHONEOS_DEPLOYMENT_TARGET'] = platform.deployment_target.to_s
  end

  target.build_settings('Debug').merge!(settings)
  target.build_settings('Release').merge!(settings)

  @user_build_configurations.each do |name, type|
    unless target.build_configurations.map(&:name).include?(name)
      config = target.build_configurations.new('name' => name)
      # Copy the settings from either the Debug or the Release configuration.
      config.build_settings = target.build_settings(type.to_s.capitalize).merge(settings)
    end
  end

  target
end

- (Object) pods

Shortcut access to the `Pods' PBXGroup.



33
34
35
# File 'lib/cocoapods/project.rb', line 33

def pods
  groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' })
end

- (Object) user_build_configurations=(user_build_configurations)



21
22
23
24
25
26
27
28
29
30
# File 'lib/cocoapods/project.rb', line 21

def user_build_configurations=(user_build_configurations)
  @user_build_configurations = user_build_configurations
  # The configurations at the top level only need to exist, they don't hold
  # any build settings themselves, that's left to `add_pod_target`.
  user_build_configurations.each do |name, _|
    unless build_configurations.map(&:name).include?(name)
      build_configurations.new('name' => name)
    end
  end
end