Kouhei Sutou
null+****@clear*****
Wed Feb 10 14:17:31 JST 2016
Kouhei Sutou 2016-02-10 14:17:31 +0900 (Wed, 10 Feb 2016) New Revision: bd26bce7a56c68b291303e9e6c21281acdcedc8d https://github.com/groonga/grntest/commit/bd26bce7a56c68b291303e9e6c21281acdcedc8d Message: Support "#{db_path}" in paths in copy-path directive Modified files: lib/grntest/executors/base-executor.rb Modified: lib/grntest/executors/base-executor.rb (+13 -2) =================================================================== --- lib/grntest/executors/base-executor.rb 2016-02-05 16:09:15 +0900 (5e7c2a5) +++ lib/grntest/executors/base-executor.rb 2016-02-10 14:17:31 +0900 (6df216d) @@ -128,6 +128,17 @@ module Grntest execute_script(Pathname(path)) end + def expand_variables(string) + string.gsub(/\#{(.+?)}/) do |matched| + case $1 + when "db_path" + @context.db_path.to_s + else + matched + end + end + end + def execute_directive_copy_path(line, content, options) source, destination, = options if source.nil? or destination.nil? @@ -140,8 +151,8 @@ module Grntest end return end - source = resolve_path(Pathname(source)) - destination = resolve_path(Pathname(destination)) + source = resolve_path(Pathname(expand_variables(source))) + destination = resolve_path(Pathname(expand_variables(destination))) FileUtils.cp_r(source.to_s, destination.to_s) end -------------- next part -------------- HTML����������������������������... Download