Module: Xcake::Configurable
Overview
This namespace provides all of methods for the DSL where configurations are specified.
Classes for the DSL which want to either specifiy build settings or scheme launch arguments (i.e The Project or Targets) include this namespace.
Instance Attribute Summary collapse
-
#configurations ⇒ Object
private
Returns the value of attribute configurations.
Instance Method Summary collapse
-
#all_configurations ⇒ Array<Configuration>
List of all configurations.
- #all_configurations=(configurations) ⇒ Object
-
#configuration(name, type) ⇒ Configuration
This either finds a configuration with the same name and type or creates one.
-
#configurations_of_type(type) ⇒ Array<Configuration>
List of configurations of a type.
- #copy_parent_configurations ⇒ Object private
-
#debug_configuration(name = nil, &block) ⇒ Configuration
deprecated
Deprecated.
Please use
configuration <name>, :debug
- #default_settings_for_type(type) ⇒ Object private
- #parent_configurable ⇒ Object private
-
#release_configuration(name = nil, &block) ⇒ Configuration
deprecated
Deprecated.
Please use
configuration <name>, :release
Instance Attribute Details
#configurations ⇒ Object (private)
Returns the value of attribute configurations.
17 18 19 |
# File 'lib/xcake/dsl/configurable.rb', line 17 def configurations @configurations end |
Instance Method Details
#all_configurations ⇒ Array<Configuration>
Returns list of all configurations.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/xcake/dsl/configurable.rb', line 23 def all_configurations if @configurations.nil? @configurations = [] if parent_configurable && parent_configurable.all_configurations copy_parent_configurations else debug_configuration :Debug release_configuration :Release end end @configurations end |
#all_configurations=(configurations) ⇒ Object
53 54 55 |
# File 'lib/xcake/dsl/configurable.rb', line 53 def all_configurations=(configurations) @configurations = configurations end |
#configuration(name, type) ⇒ Configuration
This either finds a configuration with the same name and type or creates one.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/xcake/dsl/configurable.rb', line 94 def configuration(name, type) default_settings = default_settings_for_type(type) configurations = configurations_of_type(type) build_configuration = if name.nil? configurations.first else configurations.detect do |c| c.name == name.to_s end end if build_configuration.nil? name = type.to_s.capitalize if name.nil? build_configuration = Configuration.new(name) do |b| b.type = type b.settings.merge!(default_settings) yield(b) if block_given? end @configurations ||= [] @configurations << build_configuration end build_configuration end |
#configurations_of_type(type) ⇒ Array<Configuration>
Returns list of configurations of a type.
59 60 61 62 63 64 65 |
# File 'lib/xcake/dsl/configurable.rb', line 59 def configurations_of_type(type) return [] if @configurations.nil? @configurations.select do |c| c.type == type end end |
#copy_parent_configurations ⇒ Object (private)
41 42 43 44 45 46 47 |
# File 'lib/xcake/dsl/configurable.rb', line 41 def copy_parent_configurations return unless parent_configurable parent_configurable.all_configurations.each do |c| configuration(c.name, c.type) end end |
#debug_configuration(name = nil, &block) ⇒ Configuration
Please use configuration <name>, :debug
This either finds a release configuration with the same name or creates one.
74 75 76 |
# File 'lib/xcake/dsl/configurable.rb', line 74 def debug_configuration(name = nil, &block) configuration(name, :debug, &block) end |
#default_settings_for_type(type) ⇒ Object (private)
130 131 132 133 134 135 136 137 |
# File 'lib/xcake/dsl/configurable.rb', line 130 def default_settings_for_type(type) case type when :debug default_debug_settings when :release default_release_settings end end |
#parent_configurable ⇒ Object (private)
126 127 128 |
# File 'lib/xcake/dsl/configurable.rb', line 126 def parent_configurable nil end |
#release_configuration(name = nil, &block) ⇒ Configuration
Please use configuration <name>, :release
This either finds a release configuration with the same name or creates one.
85 86 87 |
# File 'lib/xcake/dsl/configurable.rb', line 85 def release_configuration(name = nil, &block) configuration(name, :release, &block) end |