Class: Dependabot::Python::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Defined in:
lib/dependabot/python/file_updater.rb,
lib/dependabot/python/file_updater/pipfile_preparer.rb,
lib/dependabot/python/file_updater/pyproject_preparer.rb,
lib/dependabot/python/file_updater/poetry_file_updater.rb,
lib/dependabot/python/file_updater/pipfile_file_updater.rb,
lib/dependabot/python/file_updater/requirement_replacer.rb,
lib/dependabot/python/file_updater/setup_file_sanitizer.rb,
lib/dependabot/python/file_updater/pip_compile_file_updater.rb,
lib/dependabot/python/file_updater/pipfile_manifest_updater.rb,
lib/dependabot/python/file_updater/requirement_file_updater.rb

Defined Under Namespace

Classes: PipCompileFileUpdater, PipfileFileUpdater, PipfileManifestUpdater, PipfilePreparer, PoetryFileUpdater, PyprojectPreparer, RequirementFileUpdater, RequirementReplacer, SetupFileSanitizer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dependabot/python/file_updater.rb', line 15

def self.updated_files_regex
  [
    /^Pipfile$/,
    /^Pipfile\.lock$/,
    /.*\.txt$/,
    /.*\.in$/,
    /^setup\.py$/,
    /^pyproject\.toml$/,
    /^pyproject\.lock$/
  ]
end

Instance Method Details

#updated_dependency_filesObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dependabot/python/file_updater.rb', line 27

def updated_dependency_files
  updated_files =
    case resolver_type
    when :pipfile then updated_pipfile_based_files
    when :poetry then updated_poetry_based_files
    when :pip_compile then updated_pip_compile_based_files
    when :requirements then updated_requirement_based_files
    else raise "Unexpected resolver type: #{resolver_type}"
    end

  if updated_files.none? ||
     updated_files.sort_by(&:name) == dependency_files.sort_by(&:name)
    raise "No files have changed!"
  end

  updated_files
end