DEV: Allow rake plugin:spec to traverse symlinks

This commit is contained in:
David Taylor 2019-02-01 10:40:41 +00:00
parent 3119e88efe
commit dfd63b185f
1 changed files with 2 additions and 1 deletions

View File

@ -87,7 +87,8 @@ desc 'run plugin specs'
task 'plugin:spec', :plugin do |t, args| task 'plugin:spec', :plugin do |t, args|
args.with_defaults(plugin: "*") args.with_defaults(plugin: "*")
ruby = `which ruby`.strip ruby = `which ruby`.strip
files = Dir.glob("./plugins/#{args[:plugin]}/spec/**/*_spec.rb") # Traverse symlinks (https://stackoverflow.com/questions/357754/can-i-traverse-symlinked-directories-in-ruby-with-a-glob)
files = Dir.glob("./plugins/#{args[:plugin]}/spec/**{,/*/**}/*_spec.rb")
if files.length > 0 if files.length > 0
sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')}" sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')}"
else else