Class: Pod::Podfile::UserProject

Inherits:
Object
  • Object
show all
Includes:
Config::Mixin
Defined in:
lib/cocoapods/podfile.rb

Constant Summary

DEFAULT_BUILD_CONFIGURATIONS =
{ 'Debug' => :debug, 'Release' => :release }.freeze

Instance Method Summary (collapse)

Methods included from Config::Mixin

#config

Constructor Details

- (UserProject) initialize(path = nil, build_configurations = {})

A new instance of UserProject



8
9
10
11
# File 'lib/cocoapods/podfile.rb', line 8

def initialize(path = nil, build_configurations = {})
  self.path = path if path
  @build_configurations = build_configurations.merge(DEFAULT_BUILD_CONFIGURATIONS)
end

Instance Method Details

- (Object) build_configurations



35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods/podfile.rb', line 35

def build_configurations
  if project
    project.build_configurations.map(&:name).inject({}) do |hash, name|
      hash[name] = :release; hash
    end.merge(@build_configurations)
  else
    @build_configurations
  end
end

- (Object) path



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

def path
  if @path
    @path
  else
    xcodeprojs = config.project_root.glob('*.xcodeproj')
    if xcodeprojs.size == 1
      @path = xcodeprojs.first
    end
  end
end

- (Object) path=(path)



13
14
15
16
17
18
# File 'lib/cocoapods/podfile.rb', line 13

def path=(path)
  path  = path.to_s
  @path = Pathname.new(File.extname(path) == '.xcodeproj' ? path : "#{path}.xcodeproj")
  @path = config.project_root + @path unless @path.absolute?
  @path
end

- (Object) project



31
32
33
# File 'lib/cocoapods/podfile.rb', line 31

def project
  Xcodeproj::Project.new(path) if path && path.exist?
end