lib/itamae/resource/remote_file.rb in itamae-1.1.21 vs lib/itamae/resource/remote_file.rb in itamae-1.1.22

- old
+ new

@@ -22,16 +22,18 @@ dirs = attributes.path.split(::File::SEPARATOR) dirs.shift if dirs.first == "" searched_paths = [] dirs.size.times do |i| - path = ::File.join(@recipe.dir, source_file_dir, "#{dirs[i..-1].join("/")}#{source_file_ext}") - if ::File.exist?(path) - Logger.debug "#{path} is used as a source file." - return path - else - searched_paths << path + source_file_exts.each do |ext| + path = ::File.join(@recipe.dir, source_file_dir, "#{dirs[i..-1].join("/")}#{ext}") + if ::File.exist?(path) + Logger.debug "#{path} is used as a source file." + return path + else + searched_paths << path + end end end raise SourceNotFoundError, "source file is not found (searched paths: #{searched_paths.join(', ')})" else @@ -41,11 +43,11 @@ def source_file_dir "files" end - def source_file_ext - "" + def source_file_exts + [""] end end end end