Class: Xezat::Detector::Python27

Inherits:
Object
  • Object
show all
Defined in:
lib/xezat/detector/python27.rb

Instance Method Summary collapse

Instance Method Details

#detect(variables) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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