Module: Xcode::ConfigurationList

Defined in:
lib/xcode/configuration_list.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configuration_listObject

Examples:

configuration list


7165D47D146B4EA100DE2F0E /* Build configuration list for PBXNativeTarget "TestProject" */ = {
  isa = XCConfigurationList;
  buildConfigurations = (
    7165D47E146B4EA100DE2F0E /* Debug */,
    7165D47F146B4EA100DE2F0E /* Release */,
  );
  defaultConfigurationIsVisible = 0;
  defaultConfigurationName = Release;
};


16
17
18
19
20
21
# File 'lib/xcode/configuration_list.rb', line 16

def self.configuration_list
  { 'isa' => 'XCConfigurationList',
    'buildConfigurations' => [],
    'defaultConfigurationIsVisible' => '0',
    'defaultConfigurationName' => '' }
end

.symbol_config_name_to_config_nameHash

Returns a hash of symbol names to configuration names.

Returns:

  • (Hash)

    a hash of symbol names to configuration names.



26
27
28
# File 'lib/xcode/configuration_list.rb', line 26

def self.symbol_config_name_to_config_name
  { :debug => 'Debug', :release => 'Release' }
end

Instance Method Details

#create_config(name) {|new_config| ... } ⇒ Object

Note:

unique names are currently not enforced but likely necessary for the the target to be build successfully.

Create a configuration for this ConfigurationList. This configuration needs to have a name.

Parameters:

  • name (Types)

    Description

Yields:

  • (new_config)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/xcode/configuration_list.rb', line 39

def create_config(name)

  name = ConfigurationList.symbol_config_name_to_config_name[name] if ConfigurationList.symbol_config_name_to_config_name[name]

  # @todo a configuration has additional fields that are ususally set with
  #   some target information for the title.

  new_config = @registry.add_object(Configuration.default_properties(name))
  @properties['buildConfigurations'] << new_config.identifier

  yield new_config if block_given?

  new_config.save!
end

#default_configBuildConfiguration

Returns the build configuration that is set to default; nil if no configuration has been set as default.

Returns:

  • (BuildConfiguration)

    the build configuration that is set to default; nil if no configuration has been set as default.



58
59
60
# File 'lib/xcode/configuration_list.rb', line 58

def default_config
  build_configurations.find {|config| config.name == default_configuration_name }
end

#default_config_nameString

Returns the name of the default build configuration; nil if no configuration has been set as default.

Returns:

  • (String)

    the name of the default build configuration; nil if no configuration has been set as default.



66
67
68
# File 'lib/xcode/configuration_list.rb', line 66

def default_config_name
  default_configuration_name
end

#set_default_config(name) ⇒ Object

TODO:

allow the ability for a configuration to set itself as default and/or let a configuration be specified as a parameter here. Though we need to check to see that the configuration is part of the this configuration list.

Parameters:

  • name (String)

    of the build configuration to set as the default configuration; specify nil if you want to remove any default configuration.



79
80
81
82
# File 'lib/xcode/configuration_list.rb', line 79

def set_default_config(name)
  # @todo ensure that the name specified is one of the available configurations
  @properties['defaultConfigurationName'] = name
end