Class: Xcake::Configuration

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

Overview

This class represents a Build Configuration in a xcode project.

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

Defined Under Namespace

Classes: PreprocessorDefinitionsSettingProxy

Constant Summary collapse

SUPPORTED_DEVICES =

Returns the constants for the supported_devices setting.

Returns:

  • (Hash<Symbol, String>)

    the constants for the supported_devices setting

{
  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

Parameters:

  • name (String)

    the name of the configuration. This is used for the build configuration name.

  • block (Proc)

    an optional block that configures the configuration through the DSL.

Yields:

  • (_self)

Yield Parameters:



48
49
50
51
52
53
# File 'lib/xcake/dsl/configuration.rb', line 48

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

  yield(self) if block_given?
end

Instance Attribute Details

#configuration_fileString

Returns the path of the xcconfig file to use for the build configuration.

This is resolved to a PBXFileReference.

Returns:

  • (String)

    the path of the xcconfig file to use for the build configuration.

    This is resolved to a PBXFileReference.



32
33
34
# File 'lib/xcake/dsl/configuration.rb', line 32

def configuration_file
  @configuration_file
end

#nameString

Returns the name of the configuration.

Returns:

  • (String)

    the name of the configuration



13
14
15
# File 'lib/xcake/dsl/configuration.rb', line 13

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.

Returns:

  • (Hash<String, String>)

    the settings for the configuration



25
26
27
# File 'lib/xcake/dsl/configuration.rb', line 25

def settings
  @settings
end

#typeSymbol

Returns the type of the configuration, either :debug or :release.

Returns:

  • (Symbol)

    the type of the configuration, either :debug or :release



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

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/dsl/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/dsl/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(project) do |t|
   t.all_configurations.each do |c|
      c.supported_devices = :ipad_only
   end
end


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

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