lib/physique/tool_locator.rb in physique-0.2.2 vs lib/physique/tool_locator.rb in physique-0.3.0

- old
+ new

@@ -10,11 +10,11 @@ # locate_tool 'C:/Program Files/Microsoft SQL Server/**/Tools/Binn/SQLCMD.EXE' # # The tool sorts any matching executables in descending order to that the most recent version is returned. To # change this behavior call the method with the reverse option. # - # locate_tool 'C:/path/to/**/tool.exe', reverse: false + # locate_tool 'C:/path/to/**/tool.exe', find_latest: false # # Throws a ToolNotFoundError if no tool could be found. def locate_tool(paths, options = {}) # FileList only correctly handles forward-slashes, even on Windows paths = paths.gsub('\\', '/') @@ -22,12 +22,12 @@ info { "Extracting paths from the following pattern #{paths}" } paths = FileList[paths] unless paths.respond_to?(:each) info { "Attempting to locate tool in the following paths #{paths}" } opts = Map.options(options) - opts = opts.apply :reverse => true + opts = opts.apply :find_latest => true paths = paths.collect { |p| which(p) }.compact.sort - paths = paths.reverse if opts[:reverse] + paths = paths.reverse if opts[:find_latest] tool = paths.first raise ToolNotFoundError, "Could not find tool in the following paths: \n #{paths}" if tool.nil? tool end \ No newline at end of file