Method: PythonLang.parse_file

Defined in:
lib/cutting_edge/langs/python.rb

.parse_file(name, content) ⇒ Object

Parse a dependency file

name - String contents of the file content - String contents of the file

Returns an Array of tuples of each dependency and its latest version: [[<Gem::Dependency>, <Gem::Version>]]



39
40
41
42
43
44
45
46
47
# File 'lib/cutting_edge/langs/python.rb', line 39

def parse_file(name, content)
  return nil unless content
  if name =~ /\.txt$/
    results = parse_requirements(content)
  elsif name =~ /Pipfile/
    results = parse_toml(content, PIPFILE_SECTIONS)
  end
  dependency_with_latest(results) if results
end