Module: Dependabot::Devcontainers::Utils

Extended by:
T::Sig
Defined in:
lib/dependabot/devcontainers/utils.rb

Class Method Summary collapse

Class Method Details

.expected_config_basename(directory) ⇒ Object



12
13
14
# File 'lib/dependabot/devcontainers/utils.rb', line 12

def self.expected_config_basename(directory)
  root_directory?(directory) ? ".devcontainer.json" : "devcontainer.json"
end

.expected_lockfile_name(config_file_name) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/dependabot/devcontainers/utils.rb', line 22

def self.expected_lockfile_name(config_file_name)
  if config_file_name.start_with?(".")
    ".devcontainer-lock.json"
  else
    "devcontainer-lock.json"
  end
end

.root_directory?(directory) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dependabot/devcontainers/utils.rb', line 17

def self.root_directory?(directory)
  Pathname.new(directory).cleanpath.to_path == Pathname.new(".").cleanpath.to_path
end