зеркало из https://github.com/github/ruby.git
test/unit.rb: --excludes-dir list
* test/lib/test/unit.rb (ExcludesOption): allow directory list by PATH_SEPARATOR to --excludes-dir option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
04196d1f8c
Коммит
7dddd592d1
|
@ -857,26 +857,32 @@ module Test
|
|||
end
|
||||
end
|
||||
|
||||
def self.load(dir, name)
|
||||
return unless dir and name
|
||||
path = File.join(dir, name.gsub(/::/, '/') + ".rb")
|
||||
begin
|
||||
src = File.read(path)
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
else
|
||||
instance = new({})
|
||||
instance.instance_eval(src)
|
||||
instance
|
||||
def self.load(dirs, name)
|
||||
return unless dirs and name
|
||||
instance = nil
|
||||
dirs.each do |dir|
|
||||
path = File.join(dir, name.gsub(/::/, '/') + ".rb")
|
||||
begin
|
||||
src = File.read(path)
|
||||
rescue Errno::ENOENT
|
||||
nil
|
||||
else
|
||||
instance ||= new({})
|
||||
instance.instance_eval(src)
|
||||
end
|
||||
end
|
||||
instance
|
||||
end
|
||||
end
|
||||
|
||||
def setup_options(parser, options)
|
||||
super
|
||||
options[:excludes] = ENV["EXCLUDES"]
|
||||
if excludes = ENV["EXCLUDES"]
|
||||
excludes = excludes.split(File::PATH_SEPARATOR)
|
||||
end
|
||||
options[:excludes] = excludes || []
|
||||
parser.on '-X', '--excludes-dir DIRECTORY', "Directory name of exclude files" do |d|
|
||||
options[:excludes] = d
|
||||
options[:excludes].concat d.split(File::PATH_SEPARATOR)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче