Class: Xcake::Configuration

Inherits:
Object show all
Includes:
Visitable
Defined in:
lib/xcake/configuration.rb,
lib/xcake/configuration/sugar.rb,
lib/xcake/configuration/proxies/preproccessor_definitions_setting_proxy.rb

Overview

This class repesents configurations in a xcode project. This is an abstraction of Schemes and Build Configurations.

This forms part of the DSL and is usally stored in files named Cakefile.

It holds the build settings and defines how many schemes are created for each target.

Defined Under Namespace

Classes: PreprocessorDefinitionsSettingProxy

Constant Summary collapse

SUPPORTED_DEVICES =
{
  iphone_only: '1',
  ipad_only: '2',
  universal: '1,2'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Visitable

#accept

Constructor Details

#initialize(name) {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Examples:

Creating a Configuration.


Configuration.new :debug do |c|
  c.settings["INFO_PLIST"] = "./myapp/info.plist"
end

Yields:

  • (_self)

Yield Parameters:



53
54
55
56
57
58
# File 'lib/xcake/configuration.rb', line 53

def initialize(name)
  self.name = name.to_s
  self.settings = {}

  yield(self) if block_given?
end

Instance Attribute Details

#configuration_fileString



37
38
39
# File 'lib/xcake/configuration.rb', line 37

def configuration_file
  @configuration_file
end

#nameString



18
19
20
# File 'lib/xcake/configuration.rb', line 18

def name
  @name
end

#settingsHash<String, String>

the settings for the configuration this is what is used for the build settings for the build configuration.



30
31
32
# File 'lib/xcake/configuration.rb', line 30

def settings
  @settings
end

#typeSymbol



22
23
24
# File 'lib/xcake/configuration.rb', line 22

def type
  @type
end

Instance Method Details

#preprocessor_definitionsObject

Convienence method to easily set preprocessor directives



40
41
42
43
44
45
# File 'lib/xcake/configuration/sugar.rb', line 40

def preprocessor_definitions
  PreprocessorDefinitionsSettingProxy.new(
    settings,
    'GCC_PREPROCESSOR_DEFINITIONS'
  )
end

#product_bundle_identifier=(identifier) ⇒ Object

Convienience method to easily set the product's bundle identifier



34
35
36
# File 'lib/xcake/configuration/sugar.rb', line 34

def product_bundle_identifier=(identifier)
  settings['PRODUCT_BUNDLE_IDENTIFIER'] = identifier
end

#supported_devices=(devices) ⇒ Object

Convienence method to easily set the supported devices for a application.

Use this when you want to make a Non-Univeral iOS application.

Examples:

Using Supported Devices


Target.new do |t|
   t.all_configurations.each do |c|
      c.supported_devices = :ipad_only
   end
end


26
27
28
29
# File 'lib/xcake/configuration/sugar.rb', line 26

def supported_devices=(devices)
  supported_devices = SUPPORTED_DEVICES[devices]
  settings['TARGETED_DEVICE_FAMILY'] = supported_devices
end