lib/xcake/configurable.rb in xcake-0.5.1 vs lib/xcake/configurable.rb in xcake-0.5.2
- old
+ new
@@ -84,28 +84,32 @@
# This either finds a release configuration
# with the same name or creates one.
#
# @return [Configuration] the new or existing debug configuration
#
- def debug_configuration(name, &block)
+ def debug_configuration(name = nil, &block)
build_configuration(:debug, name, &block)
end
# This either finds a release configuration
# with the same name or creates one.
#
# @return [Configuration] the new or existing release configuration
#
- def release_configuration(name, &block)
+ def release_configuration(name = nil, &block)
build_configuration(:release, name, &block)
end
private
def build_configuration(method, name, &block)
configuration_name = send("#{method}_configurations")
- configuration = configuration_name.detect do |c|
- c.name == name.to_s
+ if name.nil?
+ configuration = configuration_name.first
+ else
+ configuration = configuration_name.detect do |c|
+ c.name == name.to_s
+ end
end
if configuration.nil?
configuration = Configuration.new(name) do |b|
block.call(b) if block_given?