Sha256: 13808c68c143899492c7ccf8f12c0c68558f60815a411eb064da1347aba1ffb9

Contents?: true

Size: 672 Bytes

Versions: 29

Compression:

Stored size: 672 Bytes

Contents

class Puppeteer::ExecutablePathFinder
  # @param executable_names [Array<String>] executable file names to find.
  def initialize(*executable_names)
    @executable_names = executable_names
  end

  def find_executables_in_path
    Enumerator.new do |result|
      @executable_names.each do |name|
        # Find the first existing path.
        paths.each do |path|
          candidate = File.join(path, name)
          next unless File.exist?(candidate)
          result << candidate
          break
        end
      end
    end
  end

  def find_first
    find_executables_in_path.first
  end

  private def paths
    ENV['PATH'].split(File::PATH_SEPARATOR)
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
puppeteer-ruby-0.45.6 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.5 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.4 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.3 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.2 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.2.alpha2 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.2.alpha1 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.1 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.45.0 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.44.3 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.44.2 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.44.1 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.44.0 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.43.1 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.43.0 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.42.0 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.41.0 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.40.7 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.40.6 lib/puppeteer/executable_path_finder.rb
puppeteer-ruby-0.40.5 lib/puppeteer/executable_path_finder.rb