lib/onceover/testconfig.rb in onceover-3.6.0 vs lib/onceover/testconfig.rb in onceover-3.6.1

- old
+ new

@@ -29,11 +29,11 @@ attr_accessor :force attr_accessor :strict_variables def initialize(file, opts = {}) begin - config = YAML.safe_load(File.read(file)) + config = YAML.safe_load(File.read(file), [Symbol]) rescue Errno::ENOENT raise "Could not find #{file}" rescue Psych::SyntaxError raise "Could not parse #{file}, check that it is valid YAML and that the encoding is correct" end @@ -345,11 +345,25 @@ FileUtils.rm_rf("#{repo.tempdir}/spec/fixtures/modules") FileUtils.mkdir_p("#{repo.tempdir}/spec/fixtures/modules") repo.temp_modulepath.split(':').each do |path| Dir["#{path}/*"].each do |mod| modulename = File.basename(mod) - logger.debug "Symlinking #{mod} to #{repo.tempdir}/spec/fixtures/modules/#{modulename}" - FileUtils.ln_s(mod, "#{repo.tempdir}/spec/fixtures/modules/#{modulename}") + link = "#{repo.tempdir}/spec/fixtures/modules/#{modulename}" + logger.debug "Symlinking #{mod} to #{link}" + unless File.symlink?(link) + # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library + # uses this to check for Windows + if !!File::ALT_SEPARATOR + mod = File.join(File.dirname(link), mod) unless Pathname.new(mod).absolute? + if Dir.respond_to?(:create_junction) + Dir.create_junction(link, mod) + else + system("call mklink /J \"#{link.gsub('/', '\\')}\" \"#{mod.gsub('/', '\\')}\"") + end + else + FileUtils.ln_s(mod, link) + end + end end end end def run_filters(tests)