Module: Dependabot::Utils

Defined in:
lib/dependabot/utils.rb

Constant Summary collapse

BUMP_TMP_FILE_PREFIX =
"dependabot_"
BUMP_TMP_DIR_PATH =
File.expand_path(Dir::Tmpname.create("", "tmp") { nil })

Class Method Summary collapse

Class Method Details

.always_clone_for_package_manager?(package_manager) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/dependabot/utils.rb', line 42

def self.always_clone_for_package_manager?(package_manager)
  @cloning_package_managers.include?(package_manager)
end

.register_always_clone(package_manager) ⇒ Object



46
47
48
# File 'lib/dependabot/utils.rb', line 46

def self.register_always_clone(package_manager)
  @cloning_package_managers << package_manager
end

.register_requirement_class(package_manager, requirement_class) ⇒ Object



36
37
38
# File 'lib/dependabot/utils.rb', line 36

def self.register_requirement_class(package_manager, requirement_class)
  @requirement_classes[package_manager] = requirement_class
end

.register_version_class(package_manager, version_class) ⇒ Object



23
24
25
# File 'lib/dependabot/utils.rb', line 23

def self.register_version_class(package_manager, version_class)
  @version_classes[package_manager] = version_class
end

.requirement_class_for_package_manager(package_manager) ⇒ Object



29
30
31
32
33
34
# File 'lib/dependabot/utils.rb', line 29

def self.requirement_class_for_package_manager(package_manager)
  requirement_class = @requirement_classes[package_manager]
  return requirement_class if requirement_class

  raise "Unsupported package_manager #{package_manager}"
end

.version_class_for_package_manager(package_manager) ⇒ Object



16
17
18
19
20
21
# File 'lib/dependabot/utils.rb', line 16

def self.version_class_for_package_manager(package_manager)
  version_class = @version_classes[package_manager]
  return version_class if version_class

  raise "Unsupported package_manager #{package_manager}"
end