[Groonga-commit] groonga/grntest [master] Add copy-path directive

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 11 22:32:27 JST 2012


Kouhei Sutou	2012-10-11 22:32:27 +0900 (Thu, 11 Oct 2012)

  New Revision: 71fb13a491e626965315b794e9007d72734eb7cd
  https://github.com/groonga/grntest/commit/71fb13a491e626965315b794e9007d72734eb7cd

  Log:
    Add copy-path directive

  Modified files:
    lib/grntest/tester.rb

  Modified: lib/grntest/tester.rb (+24 -4)
===================================================================
--- lib/grntest/tester.rb    2012-10-11 21:52:00 +0900 (b164031)
+++ lib/grntest/tester.rb    2012-10-11 22:32:27 +0900 (d6b123e)
@@ -1235,6 +1235,14 @@ EOF
         end
       end
 
+      def resolve_path(path)
+        if path.relative?
+          @context.base_directory + path
+        else
+          path
+        end
+      end
+
       def execute_directive(line, content)
         command, *options = Shellwords.split(content)
         case command
@@ -1258,6 +1266,21 @@ EOF
             return
           end
           execute_script(Pathname(path))
+        when "copy-path"
+          source, destination, = options
+          if source.nil? or destination.nil?
+            log_input(line)
+            if source.nil?
+              log_error("#|e| [copy-path] source is missing")
+            end
+            if destiantion.nil?
+              log_error("#|e| [copy-path] destination is missing")
+            end
+            return
+          end
+          source = resolve_path(Pathname(source))
+          destination = resolve_path(Pathname(destination))
+          FileUtils.cp_r(source.to_s, destination.to_s)
         else
           log_input(line)
           log_error("#|e| unknown directive: <#{command}>")
@@ -1282,10 +1305,7 @@ EOF
 
       def execute_script(script_path)
         executor = create_sub_executor(@context)
-        if script_path.relative?
-          script_path =****@conte*****_directory + script_path
-        end
-        executor.execute(script_path)
+        executor.execute(resolve_path(script_path))
       end
 
       def execute_command_line(command_line)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index