lib/autoproj/variable_expansion.rb in autoproj-2.0.0.b7 vs lib/autoproj/variable_expansion.rb in autoproj-2.0.0.rc1
- old
+ new
@@ -51,11 +51,13 @@
# Does a non-recursive expansion in +data+ of configuration variables
# ($VAR_NAME) listed in +definitions+
#
# If the values listed in +definitions+ also contain configuration
# variables, they do not get expanded
- def self.single_expansion(data, definitions)
+ def self.single_expansion(data, definitions, options = Hash.new)
+ options = Kernel.validate_options options, config: Autoproj.config
+
if !data.respond_to?(:to_str)
return data
end
definitions = { 'HOME' => ENV['HOME'] }.merge(definitions)
@@ -69,10 +71,10 @@
else
constant_name = constant_name[2..-1]
end
if !(value = definitions[constant_name])
- if !(value = config.get(constant_name))
+ if !(value = options[:config].get(constant_name))
if !block_given? || !(value = yield(constant_name))
raise ArgumentError, "cannot find a definition for $#{constant_name}"
end
end
end