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.



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

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.



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

def build_settings
  @build_settings
end

#nameObject (readonly)

Returns the value of attribute name.



28
29
30
# File 'lib/xcodeproject/xc_build_configuration.rb', line 28

def name
  @name
end

Instance Method Details

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



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

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

#increment_version(type = :major) ⇒ Object



58
59
60
61
62
63
# File 'lib/xcodeproject/xc_build_configuration.rb', line 58

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

	change_version(nv, type)
end

#version(type = :major) ⇒ Object



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

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

	case type
		when :major ; major
		when :minor ; minor
		when :both  ; major + '.' + minor
		else raise ArgumentError.new('Wrong argument type, expected :major, :minor or :both.')
	end
end