class Xezat::Detector::Python27

Public Instance Methods

detect(variables) click to toggle source
# File lib/xezat/detector/python27.rb, line 8
def detect(variables)
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python2.7'))

  Find.find(variables[:D]) do |file|
    next unless file.end_with?('.py')

    File.foreach(file) do |line|
      return true if line.strip == '#!/usr/bin/env python' || line.strip.start_with?('#!/usr/bin/env python2')

      break
    end
  end
  false
end