Class: XcodeProject::XCBuildConfiguration

Inherits:
Node
  • Object
show all
Defined in:
lib/xcodeproject/xc_build_configuration.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#isa, #uuid

Instance Method Summary collapse

Constructor Details

#initialize(root, uuid, data) ⇒ XCBuildConfiguration

Returns a new instance of XCBuildConfiguration.



33
34
35
36
37
38
# File 'lib/xcodeproject/xc_build_configuration.rb', line 33

def initialize(root, uuid, data)
  super(root, uuid, data)

  @name = data['name']
  @build_settings = data['buildSettings']
end

Instance Attribute Details

#build_settingsObject

Returns the value of attribute build_settings.



31
32
33
# File 'lib/xcodeproject/xc_build_configuration.rb', line 31

def build_settings
  @build_settings
end

#nameObject (readonly)

Returns the value of attribute name.



30
31
32
# File 'lib/xcodeproject/xc_build_configuration.rb', line 30

def name
  @name
end

Instance Method Details

#change_version(value, type = :major) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/xcodeproject/xc_build_configuration.rb', line 52

def change_version(value, type = :major)
  case type
  when :major then write_property('CFBundleShortVersionString', value)
  when :minor then write_property('CFBundleVersion', value)
  else raise ArgumentError, 'Wrong argument type, expected :major or :minor.'
  end
end

#increment_version(type = :major) ⇒ Object



60
61
62
63
64
65
# File 'lib/xcodeproject/xc_build_configuration.rb', line 60

def increment_version(type = :major)
  cv = version(type)
  nv = cv.nil? ? '0' : cv.next

  change_version(nv, type)
end

#version(type = :major) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/xcodeproject/xc_build_configuration.rb', line 40

def version(type = :major)
  major = read_property('CFBundleShortVersionString')
  minor = read_property('CFBundleVersion')

  case type
  when :major then major
  when :minor then minor
  when :both then major + '.' + minor
  else raise ArgumentError, 'Wrong argument type, expected :major, :minor or :both.'
  end
end