lib/grntest/tester.rb in grntest-1.3.2 vs lib/grntest/tester.rb in grntest-1.3.3

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com> +# Copyright (C) 2012-2019 Kouhei Sutou <kou@clear-code.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -413,10 +413,18 @@ @exclude_test_suite_patterns.any? do |pattern| pattern === test_suite_name end end + def plugins_directory + groonga_path = Pathname(@groonga) + unless groonga_path.absolute? + groonga_path = Pathname(resolve_command_path(@groonga)).expand_path + end + groonga_path.parent.parent + "plugins" + end + private def load_tests(*targets) default_group_name = "." tests = {default_group_name => []} targets.each do |target| @@ -469,22 +477,26 @@ @vagrind = nil @default_valgrind = "valgrind" @vagrind_gen_suppressions = false end - def command_exist?(name) + def resolve_command_path(name) exeext = RbConfig::CONFIG["EXEEXT"] ENV["PATH"].split(File::PATH_SEPARATOR).each do |path| raw_candidate = File.join(path, name) candidates = [ raw_candidate, "#{raw_candidate}#{exeext}", ] candidates.each do |candidate| - return true if File.executable?(candidate) + return candidate if File.executable?(candidate) end end - false + nil + end + + def command_exist?(name) + not resolve_command_path(name).nil? end def guess_color_availability return false unless @output.tty? case ENV["TERM"]